Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
c9edd9a8
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c9edd9a8
编写于
9月 07, 2015
作者:
C
Chiwan Park
提交者:
Stephan Ewen
9月 09, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-2619] [tests] Fix for some unexecuted Scala tests
This closes #1103
上级
063b1092
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
46 deletion
+59
-46
flink-runtime/src/test/scala/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.scala
...nk/runtime/executiongraph/ExecutionGraphRestartTest.scala
+4
-1
flink-runtime/src/test/scala/org/apache/flink/runtime/executiongraph/TaskManagerLossFailsTasksTest.scala
...untime/executiongraph/TaskManagerLossFailsTasksTest.scala
+4
-1
flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerRegistrationTest.scala
...flink/runtime/jobmanager/JobManagerRegistrationTest.scala
+3
-1
flink-staging/flink-gelly-scala/src/test/scala/org/apache/flink/graph/scala/test/operations/GraphOperationsITCase.scala
...k/graph/scala/test/operations/GraphOperationsITCase.scala
+1
-0
flink-staging/flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITSuite.scala
.../scala/org/apache/flink/api/scala/ScalaShellITSuite.scala
+43
-42
flink-tests/src/test/scala/org/apache/flink/api/scala/manual/MassiveCaseClassSortingITCase.scala
...link/api/scala/manual/MassiveCaseClassSortingITCase.scala
+4
-1
未找到文件。
flink-runtime/src/test/scala/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.scala
浏览文件 @
c9edd9a8
...
...
@@ -26,8 +26,11 @@ import org.apache.flink.runtime.jobgraph.{JobStatus, JobGraph, JobVertex}
import
org.apache.flink.runtime.jobmanager.Tasks
import
org.apache.flink.runtime.jobmanager.scheduler.Scheduler
import
org.apache.flink.runtime.testingUtils.TestingUtils
import
org.junit.runner.RunWith
import
org.scalatest.junit.JUnitRunner
import
org.scalatest.
{
Matchers
,
WordSpecLike
}
@RunWith
(
classOf
[
JUnitRunner
])
class
ExecutionGraphRestartTest
extends
WordSpecLike
with
Matchers
{
val
NUM_TASKS
=
31
...
...
@@ -118,7 +121,7 @@ class ExecutionGraphRestartTest extends WordSpecLike with Matchers {
}
eg
.
getState
should
equal
(
JobStatus
.
FINISHED
)
}
catch
{
}
catch
{
case
t
:
Throwable
=>
t
.
printStackTrace
()
fail
(
t
.
getMessage
)
...
...
flink-runtime/src/test/scala/org/apache/flink/runtime/executiongraph/TaskManagerLossFailsTasksTest.scala
浏览文件 @
c9edd9a8
...
...
@@ -26,8 +26,11 @@ import org.apache.flink.runtime.jobgraph.{JobStatus, JobGraph, JobVertex}
import
org.apache.flink.runtime.jobmanager.Tasks
import
org.apache.flink.runtime.jobmanager.scheduler.Scheduler
import
org.apache.flink.runtime.testingUtils.TestingUtils
import
org.junit.runner.RunWith
import
org.scalatest.junit.JUnitRunner
import
org.scalatest.
{
Matchers
,
WordSpecLike
}
@RunWith
(
classOf
[
JUnitRunner
])
class
TaskManagerLossFailsTasksTest
extends
WordSpecLike
with
Matchers
{
"A task manager loss"
must
{
...
...
@@ -64,7 +67,7 @@ class TaskManagerLossFailsTasksTest extends WordSpecLike with Matchers {
instance1
.
markDead
()
eg
.
getState
should
equal
(
JobStatus
.
FAILING
)
}
catch
{
}
catch
{
case
t
:
Throwable
=>
t
.
printStackTrace
()
fail
(
t
.
getMessage
)
...
...
flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerRegistrationTest.scala
浏览文件 @
c9edd9a8
...
...
@@ -27,10 +27,11 @@ import org.apache.flink.configuration.Configuration
import
org.apache.flink.runtime.StreamingMode
import
org.apache.flink.runtime.akka.AkkaUtils
import
org.apache.flink.runtime.instance.
{
HardwareDescription
,
InstanceConnectionInfo
,
InstanceID
}
import
org.apache.flink.runtime.leaderelection.StandaloneLeaderElectionService
import
org.apache.flink.runtime.messages.JobManagerMessages.LeaderSessionMessage
import
org.apache.flink.runtime.messages.RegistrationMessages.
{
AcknowledgeRegistration
,
AlreadyRegistered
,
RegisterTaskManager
}
import
org.junit.Assert.
{
assertNotEquals
,
assertNotNull
}
import
org.junit.runner.RunWith
import
org.scalatest.junit.JUnitRunner
import
org.scalatest.
{
BeforeAndAfterAll
,
Matchers
,
WordSpecLike
}
import
scala.concurrent.duration._
...
...
@@ -41,6 +42,7 @@ import scala.language.postfixOps
* It also tests the JobManager's response to heartbeats from TaskManagers it does
* not know.
*/
@RunWith
(
classOf
[
JUnitRunner
])
class
JobManagerRegistrationTest
(
_system
:
ActorSystem
)
extends
TestKit
(
_system
)
with
ImplicitSender
with
WordSpecLike
with
Matchers
with
BeforeAndAfterAll
{
...
...
flink-staging/flink-gelly-scala/src/test/scala/org/apache/flink/graph/scala/test/operations/GraphOperationsITCase.scala
浏览文件 @
c9edd9a8
...
...
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.flink.graph.scala.test.operations
import
org.apache.flink.api.common.functions.FilterFunction
import
org.apache.flink.api.scala._
...
...
flink-staging/flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITSuite.scala
浏览文件 @
c9edd9a8
...
...
@@ -22,17 +22,20 @@ import java.io._
import
java.util.concurrent.TimeUnit
import
org.apache.flink.runtime.StreamingMode
import
org.apache.flink.test.util.
{
TestEnvironment
,
TestBaseUtils
,
ForkableFlinkMiniCluster
,
FlinkTestBase
}
import
org.scalatest.
{
BeforeAndAfterAll
,
BeforeAndAfter
,
FunSuite
,
Matchers
}
import
org.apache.flink.test.util.
{
ForkableFlinkMiniCluster
,
TestBaseUtils
,
TestEnvironment
}
import
org.junit.runner.RunWith
import
org.scalatest.junit.JUnitRunner
import
org.scalatest.
{
BeforeAndAfterAll
,
FunSuite
,
Matchers
}
import
scala.concurrent.duration.FiniteDuration
import
scala.tools.nsc.Settings
@RunWith
(
classOf
[
JUnitRunner
])
class
ScalaShellITSuite
extends
FunSuite
with
Matchers
with
BeforeAndAfterAll
{
test
(
"Iteration test with iterative Pi example"
)
{
val
input
:
String
=
val
input
:
String
=
"""
val initial = env.fromElements(0)
...
...
@@ -46,9 +49,9 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
}
val result = count map { c => c / 10000.0 * 4 }
result.collect()
"""
.
stripMargin
"""
.
stripMargin
val
output
:
String
=
processInShell
(
input
)
val
output
:
String
=
processInShell
(
input
)
output
should
not
include
"failed"
output
should
not
include
"error"
...
...
@@ -56,7 +59,8 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
}
test
(
"WordCount in Shell"
)
{
val
input
=
"""
val
input
=
"""
val text = env.fromElements("To be, or not to be,--that is the question:--",
"Whether 'tis nobler in the mind to suffer",
"The slings and arrows of outrageous fortune",
...
...
@@ -64,7 +68,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
val counts = text.flatMap { _.toLowerCase.split("\\W+") }.map { (_, 1) }.groupBy(0).sum(1)
val result = counts.print()
"""
.
stripMargin
"""
.
stripMargin
val
output
=
processInShell
(
input
)
...
...
@@ -72,7 +76,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
output
should
not
include
"error"
output
should
not
include
"Exception"
//
some of the words that should be included
//
some of the words that should be included
output
should
include
(
"(a,1)"
)
output
should
include
(
"(whether,1)"
)
output
should
include
(
"(to,4)"
)
...
...
@@ -80,14 +84,14 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
}
test
(
"Sum 1..10, should be 55"
)
{
val
input
:
String
=
val
input
=
"""
val input: DataSet[Int] = env.fromElements(0,1,2,3,4,5,6,7,8,9,10)
val reduced = input.reduce(_+_)
reduced.print
"""
.
stripMargin
val
output
:
String
=
processInShell
(
input
)
val
output
=
processInShell
(
input
)
output
should
not
include
"failed"
output
should
not
include
"error"
...
...
@@ -97,7 +101,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
}
test
(
"WordCount in Shell with custom case class"
)
{
val
input
:
String
=
val
input
=
"""
case class WC(word: String, count: Int)
...
...
@@ -111,7 +115,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
reduced.print()
"""
.
stripMargin
val
output
:
String
=
processInShell
(
input
)
val
output
=
processInShell
(
input
)
output
should
not
include
"failed"
output
should
not
include
"error"
...
...
@@ -120,11 +124,9 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
output
should
include
(
"WC(hello,1)"
)
output
should
include
(
"WC(world,10)"
)
}
test
(
"Submit external library"
)
{
val
input
:
String
=
val
input
=
"""
import org.apache.flink.ml.math._
val denseVectors = env.fromElements(DenseVector(1.0, 2.0, 3.0))
...
...
@@ -132,12 +134,14 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
"""
.
stripMargin
// find jar file that contains the ml code
var
externalJar
:
String
=
""
var
folder
:
File
=
new
File
(
"../flink-ml/target/"
);
var
listOfFiles
:
Array
[
File
]
=
folder
.
listFiles
();
for
(
i
<-
0
to
listOfFiles
.
length
-
1
){
var
filename
:
String
=
listOfFiles
(
i
).
getName
();
if
(!
filename
.
contains
(
"test"
)
&&
!
filename
.
contains
(
"original"
)
&&
filename
.
contains
(
".jar"
)){
var
externalJar
=
""
val
folder
=
new
File
(
"../flink-ml/target/"
)
val
listOfFiles
=
folder
.
listFiles
()
for
(
i
<-
listOfFiles
.
indices
)
{
val
filename
:
String
=
listOfFiles
(
i
).
getName
if
(!
filename
.
contains
(
"test"
)
&&
!
filename
.
contains
(
"original"
)
&&
filename
.
contains
(
".jar"
))
{
println
(
"ive found file:"
+
listOfFiles
(
i
).
getAbsolutePath
)
externalJar
=
listOfFiles
(
i
).
getAbsolutePath
}
...
...
@@ -145,13 +149,13 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
assert
(
externalJar
!=
""
)
val
output
:
String
=
processInShell
(
input
,
Option
(
externalJar
))
val
output
:
String
=
processInShell
(
input
,
Option
(
externalJar
))
output
should
not
include
"failed"
output
should
not
include
"error"
output
should
not
include
"Exception"
output
should
include
(
"\nDenseVector(1.0, 2.0, 3.0)"
)
output
should
include
(
"\nDenseVector(1.0, 2.0, 3.0)"
)
}
/**
...
...
@@ -159,8 +163,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
* @param input commands to be processed in the shell
* @return output of shell
*/
def
processInShell
(
input
:
String
,
externalJars
:
Option
[
String
]
=
None
)
:
String
={
def
processInShell
(
input
:
String
,
externalJars
:
Option
[
String
]
=
None
)
:
String
=
{
val
in
=
new
BufferedReader
(
new
StringReader
(
input
+
"\n"
))
val
out
=
new
StringWriter
()
val
baos
=
new
ByteArrayOutputStream
()
...
...
@@ -174,28 +177,26 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
case
Some
(
c
)
=>
c
.
getLeaderRPCPort
case
_
=>
throw
new
RuntimeException
(
"Test cluster not initialized."
)
}
var
repl
:
FlinkILoop
=
null
externalJars
match
{
case
Some
(
ej
)
=>
repl
=
new
FlinkILoop
(
host
,
port
,
Option
(
Array
(
ej
)),
val
repl
=
externalJars
match
{
case
Some
(
ej
)
=>
new
FlinkILoop
(
host
,
port
,
Option
(
Array
(
ej
)),
in
,
new
PrintWriter
(
out
))
case
None
=>
new
FlinkILoop
(
host
,
port
,
in
,
new
PrintWriter
(
out
))
case
None
=>
repl
=
new
FlinkILoop
(
host
,
port
,
in
,
new
PrintWriter
(
out
))
}
repl
.
settings
=
new
Settings
()
// enable this line to use scala in intellij
repl
.
settings
.
usejavacp
.
value
=
true
externalJars
match
{
case
Some
(
ej
)
=>
repl
.
settings
.
classpath
.
value
=
ej
case
None
=>
case
None
=>
}
repl
.
process
(
repl
.
settings
)
...
...
@@ -205,7 +206,7 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
System
.
setOut
(
oldOut
)
baos
.
flush
()
val
stdout
=
baos
.
toString
out
.
toString
+
stdout
...
...
@@ -230,6 +231,6 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll {
}
override
def
afterAll
()
:
Unit
=
{
cluster
.
map
(
c
=>
TestBaseUtils
.
stopCluster
(
c
,
new
FiniteDuration
(
1000
,
TimeUnit
.
SECONDS
)))
cluster
.
foreach
(
c
=>
TestBaseUtils
.
stopCluster
(
c
,
new
FiniteDuration
(
1000
,
TimeUnit
.
SECONDS
)))
}
}
flink-tests/src/test/scala/org/apache/flink/api/scala/m
isc
/MassiveCaseClassSortingITCase.scala
→
flink-tests/src/test/scala/org/apache/flink/api/scala/m
anual
/MassiveCaseClassSortingITCase.scala
浏览文件 @
c9edd9a8
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
package
org.apache.flink.api.scala.m
isc
package
org.apache.flink.api.scala.m
anual
import
java.io.File
import
java.util.Random
...
...
@@ -36,6 +36,9 @@ import org.apache.flink.api.java.typeutils.runtime.RuntimeSerializerFactory
import
org.junit.Assert._
import
org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable
/**
* This test is wrote as manual test.
*/
class
MassiveCaseClassSortingITCase
{
val
SEED
:
Long
=
347569784659278346L
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录