@@ -9,8 +9,6 @@ import org.apache.flink.util.FlinkRuntimeException
9
9
import org .scalatest .flatspec .AnyFlatSpec
10
10
import org .scalatest .matchers .should .Matchers
11
11
12
- import scala .util .{Failure , Success , Try }
13
-
14
12
class StreamExecutionEnvironmentTest extends AnyFlatSpec with Matchers with IntegrationTest {
15
13
16
14
it should " create a stream from a source" in {
@@ -26,32 +24,19 @@ class StreamExecutionEnvironmentTest extends AnyFlatSpec with Matchers with Inte
26
24
}
27
25
28
26
it should " create a stream from a sequence" in {
29
- import org .apache .flinkx .api .serializers ._
27
+ import org .apache .flinkx .api .serializers .*
30
28
val typeInfo = implicitly[TypeInformation [Long ]]
31
29
32
30
val stream = env.fromSequence(1 , 100 )
33
31
34
32
stream.dataType shouldBe typeInfo
35
33
}
36
34
37
- " From Flink 1.19, TypeInformation.of(Class)" should " fail-fast trying to resolve Scala type" in {
38
- Try (Class .forName(" org.apache.flink.configuration.PipelineOptions" ).getField(" SERIALIZATION_CONFIG" )) match {
39
- case Failure (_) => // Before Flink 1.19: no fail-fast, exception happens at execution
40
- implicit val typeInfo : TypeInformation [Option [Int ]] = TypeInformation .of(classOf [Option [Int ]])
41
- val stream = env.fromElements(Some (1 ), None , Some (100 ))
42
- val exception = intercept[UnsupportedOperationException ] {
43
- stream.executeAndCollect(3 )
44
- }
45
- exception.getMessage should startWith(
46
- " Generic types have been disabled in the ExecutionConfig and type scala.Option is treated as a generic type."
47
- )
48
-
49
- case Success (_) => // From Flink 1.19: fail-fast at Scala type resolution
50
- val exception = intercept[FlinkRuntimeException ] {
51
- TypeInformation .of(classOf [Option [Int ]])
52
- }
53
- exception.getMessage should startWith(" You are using a 'Class' to resolve 'scala.Option' Scala type." )
35
+ " TypeInformation.of(Class)" should " fail-fast trying to resolve Scala type" in {
36
+ val exception = intercept[FlinkRuntimeException ] {
37
+ TypeInformation .of(classOf [Option [Int ]])
54
38
}
39
+ exception.getMessage should startWith(" You are using a 'Class' to resolve 'scala.Option' Scala type." )
55
40
}
56
41
57
42
// --------------------------------------------------------------------------
0 commit comments