Skip to content

Commit 78f49ac

Browse files
move test data to target dir
1 parent 574e123 commit 78f49ac

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed
-69 Bytes
Binary file not shown.
Binary file not shown.

modules/flink-common-api/src/test/scala/org/apache/flinkx/api/SchemaEvolutionTest.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import org.scalatest.matchers.should.Matchers
1111

1212
import java.io.ByteArrayOutputStream
1313
import java.nio.file.{Files, Path}
14+
import java.io.FileInputStream
1415

1516
class SchemaEvolutionTest extends AnyFlatSpec with Matchers {
1617
private implicit val newClickTypeInfo: TypeInformation[Click] = deriveTypeInformation[Click]
@@ -49,15 +50,18 @@ class SchemaEvolutionTest extends AnyFlatSpec with Matchers {
4950
modifiedResult shouldBe modifiedExpected
5051
}
5152

52-
ignore should "generate blob for event=click+purchase" in {
53+
def generateBlobForEvent() = {
5354
val buffer = new ByteArrayOutputStream()
5455
val eventSerializer = createSerializer[Event]
5556
eventSerializer.serialize(Click("p1", clicks), new DataOutputViewStreamWrapper(buffer))
56-
Files.write(Path.of("src/test/resources/click.dat"), buffer.toByteArray)
57+
val path = Path.of("target/test/resources/click.dat")
58+
Files.createDirectories(path.getParent())
59+
Files.write(path, buffer.toByteArray)
5760
}
5861

5962
it should "decode click when we added view" in {
60-
val buffer = this.getClass.getResourceAsStream("/click.dat")
63+
generateBlobForEvent()
64+
val buffer = new FileInputStream("target/test/resources/click.dat")
6165
val click = createSerializer[Event].deserialize(new DataInputViewStreamWrapper(buffer))
6266
click shouldBe Click("p1", clicks)
6367
}

modules/flink-common-api/src/test/scala/org/apache/flinkx/api/SerializerSnapshotTest.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
1616
import java.net.URLClassLoader
1717
import java.nio.file.{Files, Paths}
1818
import java.util.UUID
19+
import java.io.FileInputStream
1920

2021
class SerializerSnapshotTest extends AnyFlatSpec with Matchers {
2122

@@ -78,7 +79,7 @@ class SerializerSnapshotTest extends AnyFlatSpec with Matchers {
7879
}
7980
}
8081

81-
ignore should "serialize old serialization with the old serializer snapshot" in {
82+
def serializeWithOldSerializer() = {
8283
val uuid = UUID.fromString("4daf2791-abbe-420f-9594-f57ded1fee8c")
8384
val expectedData = OuterClass(Map(uuid -> List(SimpleClass2("a", 1))))
8485
val outerClassSerializer = implicitly[TypeSerializer[OuterClass]]
@@ -90,15 +91,18 @@ class SerializerSnapshotTest extends AnyFlatSpec with Matchers {
9091

9192
// Serialize the data
9293
outerClassSerializer.serialize(expectedData, out)
93-
Files.write(Paths.get("modules/flink-1-api/src/test/resources/old-serializer-snapshot.dat"), out.getSharedBuffer)
94+
val path = Paths.get("target/test/resources/old-serializer-snapshot.dat")
95+
Files.createDirectories(path.getParent())
96+
Files.write(path, out.getSharedBuffer)
9497
}
9598

9699
it should "deserialize old serialization with the new serializer snapshot" in {
100+
serializeWithOldSerializer()
97101
val uuid = UUID.fromString("4daf2791-abbe-420f-9594-f57ded1fee8c")
98102
val expectedData = OuterClass(Map(uuid -> List(SimpleClass2("a", 1))))
99103

100104
// Deserialize the old serialization
101-
val buffer = getClass.getResourceAsStream("/old-serializer-snapshot.dat").readAllBytes()
105+
val buffer = new FileInputStream("target/test/resources/old-serializer-snapshot.dat").readAllBytes()
102106
val in = new DataInputDeserializer(buffer)
103107
val deserializedSnapshot = TypeSerializerSnapshot
104108
.readVersionedSnapshot[OuterClass](in, getClass.getClassLoader) // Flink always calls this

0 commit comments

Comments
 (0)