diff --git a/pom.xml b/pom.xml
index 6e8f38016..1d6b95add 100644
--- a/pom.xml
+++ b/pom.xml
@@ -125,7 +125,7 @@
0.8.9
2.10.6
2.4.0
- 5.10.2
+ 5.12.2
5.11.0
1.10.0
provided
diff --git a/wayang-api/wayang-api-scala-java/src/test/java/org/apache/wayang/api/JavaApiTest.java b/wayang-api/wayang-api-scala-java/src/test/java/org/apache/wayang/api/JavaApiTest.java
index 2d4bb6ca5..9240f2d9c 100644
--- a/wayang-api/wayang-api-scala-java/src/test/java/org/apache/wayang/api/JavaApiTest.java
+++ b/wayang-api/wayang-api-scala-java/src/test/java/org/apache/wayang/api/JavaApiTest.java
@@ -18,9 +18,6 @@
package org.apache.wayang.api;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
import org.apache.wayang.basic.data.Tuple2;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.api.WayangContext;
@@ -38,6 +35,8 @@
import org.apache.wayang.spark.Spark;
import org.apache.wayang.sqlite3.Sqlite3;
import org.apache.wayang.sqlite3.operators.Sqlite3TableSource;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
@@ -57,15 +56,17 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Test suite for the Java API.
*/
-public class JavaApiTest {
+class JavaApiTest {
private Configuration sqlite3Configuration;
- @Before
- public void setUp() throws SQLException, IOException {
+ @BeforeEach
+ void setUp() throws SQLException, IOException {
// Generate test data.
this.sqlite3Configuration = new Configuration();
File sqlite3dbFile = File.createTempFile("wayang-sqlite3", "db");
@@ -83,7 +84,7 @@ public void setUp() throws SQLException, IOException {
}
@Test
- public void testMapReduce() {
+ void testMapReduce() {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder javaPlanBuilder = new JavaPlanBuilder(wayangContext);
@@ -94,11 +95,11 @@ public void testMapReduce() {
.reduce((a, b) -> a + b).withName("sum")
.collect();
- Assert.assertEquals(WayangCollections.asSet(1 + 4 + 9 + 16), WayangCollections.asSet(outputCollection));
+ assertEquals(WayangCollections.asSet(1 + 4 + 9 + 16), WayangCollections.asSet(outputCollection));
}
@Test
- public void testMapReduceBy() {
+ void testMapReduceBy() {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder javaPlanBuilder = new JavaPlanBuilder(wayangContext);
@@ -109,11 +110,11 @@ public void testMapReduceBy() {
.reduceByKey(i -> i & 1, (a, b) -> a + b).withName("sum")
.collect();
- Assert.assertEquals(WayangCollections.asSet(4 + 16, 1 + 9), WayangCollections.asSet(outputCollection));
+ assertEquals(WayangCollections.asSet(4 + 16, 1 + 9), WayangCollections.asSet(outputCollection));
}
@Test
- public void testBroadcast2() {
+ void testBroadcast2() {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder javaPlanBuilder = new JavaPlanBuilder(wayangContext);
@@ -129,11 +130,11 @@ public void testBroadcast2() {
.map(new AddOffset("offset")).withName("add offset").withBroadcast(offsetDataQuanta, "offset")
.collect();
- Assert.assertEquals(WayangCollections.asSet(-2, -1, 0, 1, 2), WayangCollections.asSet(outputCollection));
+ assertEquals(WayangCollections.asSet(-2, -1, 0, 1, 2), WayangCollections.asSet(outputCollection));
}
@Test
- public void testCustomOperatorShortCut() {
+ void testCustomOperatorShortCut() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
@@ -154,11 +155,11 @@ public void testCustomOperatorShortCut() {
// Check the outcome.
final List expectedOutputValues = WayangArrays.asList(2, 3, 4, 5);
- Assert.assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
+ assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
}
@Test
- public void testWordCount() {
+ void testWordCount() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
@@ -179,11 +180,11 @@ public void testWordCount() {
new Tuple2<>("is", 2),
new Tuple2<>("data", 3)
);
- Assert.assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
+ assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
}
@Test
- public void testWordCountOnSparkAndJava() {
+ void testWordCountOnSparkAndJava() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin()).with(Spark.basicPlugin());
@@ -204,11 +205,11 @@ public void testWordCountOnSparkAndJava() {
new Tuple2<>("is", 2),
new Tuple2<>("data", 3)
);
- Assert.assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
+ assertEquals(WayangCollections.asSet(expectedOutputValues), WayangCollections.asSet(outputValues));
}
@Test
- public void testSample() {
+ void testSample() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin()).with(Spark.basicPlugin());
@@ -222,13 +223,13 @@ public void testSample() {
.collect();
// Check the outcome.
- Assert.assertEquals(10, outputValues.size());
- Assert.assertEquals(10, WayangCollections.asSet(outputValues).size());
+ assertEquals(10, outputValues.size());
+ assertEquals(10, WayangCollections.asSet(outputValues).size());
}
@Test
- public void testDoWhile() {
+ void testDoWhile() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
@@ -253,7 +254,7 @@ public void testDoWhile() {
.collect();
Set expectedValues = WayangCollections.asSet(1, 2, 3, 6, 12, 24, 48, 96, 192);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
private static class AddOffset implements FunctionDescriptor.ExtendedSerializableFunction {
@@ -278,7 +279,7 @@ public Integer apply(Integer input) {
}
@Test
- public void testRepeat() {
+ void testRepeat() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
@@ -296,7 +297,7 @@ public void testRepeat() {
.collect();
Set expectedValues = WayangCollections.asSet(42, 43);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
private static class SelectWords implements PredicateDescriptor.ExtendedSerializablePredicate {
@@ -321,7 +322,7 @@ public boolean test(String word) {
}
@Test
- public void testBroadcast() {
+ void testBroadcast() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -340,11 +341,11 @@ public void testBroadcast() {
// Verify the outcome.
Set expectedValues = WayangCollections.asSet("Hello", "World");
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testGroupBy() {
+ void testGroupBy() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -369,11 +370,11 @@ public void testGroupBy() {
// Verify the outcome.
Set expectedValues = WayangCollections.asSet(5d, 6d);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testJoin() {
+ void testJoin() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -404,11 +405,11 @@ public void testJoin() {
new Tuple2<>("Orange juice", 10),
new Tuple2<>("Tap water", 0)
);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testJoinAndAssemble() {
+ void testJoinAndAssemble() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -439,11 +440,11 @@ public void testJoinAndAssemble() {
new Tuple2<>("Orange juice", 10),
new Tuple2<>("Tap water", 0)
);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testCoGroup() {
+ void testCoGroup() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin()).with(Spark.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -485,11 +486,11 @@ public void testCoGroup() {
WayangCollections.asSet(new Tuple2<>("Apple juice", "Juice"), new Tuple2<>("Orange juice", "Juice"))
)
);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testCoGroupViaKeyBy() {
+ void testCoGroupViaKeyBy() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin()).with(Spark.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -532,11 +533,11 @@ public void testCoGroupViaKeyBy() {
WayangCollections.asSet(new Tuple2<>("Apple juice", "Juice"), new Tuple2<>("Orange juice", "Juice"))
)
);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testIntersect() {
+ void testIntersect() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -552,11 +553,11 @@ public void testIntersect() {
// Verify the outcome.
Set expectedValues = WayangCollections.asSet(2, 3, 4, 5, 7, 8, 9);
- Assert.assertEquals(expectedValues, WayangCollections.asSet(outputValues));
+ assertEquals(expectedValues, WayangCollections.asSet(outputValues));
}
@Test
- public void testSort() {
+ void testSort() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -570,12 +571,12 @@ public void testSort() {
// Verify the outcome.
List expectedValues = Arrays.asList(1, 2, 3, 4, 5);
- Assert.assertEquals(expectedValues, WayangCollections.asList(outputValues));
+ assertEquals(expectedValues, WayangCollections.asList(outputValues));
}
@Test
- public void testPageRank() {
+ void testPageRank() {
// Set up WayangContext.
WayangContext wayangContext = new WayangContext()
.with(Java.basicPlugin())
@@ -601,14 +602,14 @@ public void testPageRank() {
sortedPageRanks.sort((pr1, pr2) -> Float.compare(pr2.field1, pr1.field1));
System.out.println(sortedPageRanks);
- Assert.assertEquals(1L, sortedPageRanks.get(0).field0.longValue());
- Assert.assertEquals(0L, sortedPageRanks.get(1).field0.longValue());
- Assert.assertEquals(2L, sortedPageRanks.get(2).field0.longValue());
- Assert.assertEquals(3L, sortedPageRanks.get(3).field0.longValue());
+ assertEquals(1L, sortedPageRanks.get(0).field0.longValue());
+ assertEquals(0L, sortedPageRanks.get(1).field0.longValue());
+ assertEquals(2L, sortedPageRanks.get(2).field0.longValue());
+ assertEquals(3L, sortedPageRanks.get(3).field0.longValue());
}
@Test
- public void testMapPartitions() {
+ void testMapPartitions() {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -635,11 +636,11 @@ public void testMapPartitions() {
Set> expectedOutput = WayangCollections.asSet(
new Tuple2<>("even", 5), new Tuple2<>("odd", 2)
);
- Assert.assertEquals(expectedOutput, WayangCollections.asSet(outputValues));
+ assertEquals(expectedOutput, WayangCollections.asSet(outputValues));
}
@Test
- public void testZipWithId() {
+ void testZipWithId() {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -667,11 +668,11 @@ public void testZipWithId() {
// Check the output.
Set> expectedOutput = Collections.singleton(new Tuple2<>(42, 100));
- Assert.assertEquals(expectedOutput, WayangCollections.asSet(outputValues));
+ assertEquals(expectedOutput, WayangCollections.asSet(outputValues));
}
@Test
- public void testWriteTextFile() throws IOException, URISyntaxException {
+ void testWriteTextFile() throws IOException, URISyntaxException {
WayangContext wayangContext = new WayangContext().with(Java.basicPlugin());
JavaPlanBuilder builder = new JavaPlanBuilder(wayangContext);
@@ -689,11 +690,11 @@ public void testWriteTextFile() throws IOException, URISyntaxException {
// Check the output.
Set actualLines = Files.lines(Paths.get(new URI(targetUrl))).collect(Collectors.toSet());
Set expectedLines = inputValues.stream().map(d -> String.format("%.2f", d)).collect(Collectors.toSet());
- Assert.assertEquals(expectedLines, actualLines);
+ assertEquals(expectedLines, actualLines);
}
@Test
- public void testSqlOnJava() throws IOException, SQLException {
+ void testSqlOnJava() throws IOException, SQLException {
// Execute job.
final WayangContext wayangCtx = new WayangContext(this.sqlite3Configuration)
.with(Java.basicPlugin())
@@ -707,14 +708,14 @@ public void testSqlOnJava() throws IOException, SQLException {
.collect();
// Test the outcome.
- Assert.assertEquals(
+ assertEquals(
WayangCollections.asSet("John", "Evelyn"),
WayangCollections.asSet(outputValues)
);
}
@Test
- public void testSqlOnSqlite3() throws IOException, SQLException {
+ void testSqlOnSqlite3() throws IOException, SQLException {
// Execute job.
final WayangContext wayangCtx = new WayangContext(this.sqlite3Configuration)
.with(Java.basicPlugin())
@@ -728,7 +729,7 @@ public void testSqlOnSqlite3() throws IOException, SQLException {
.collect();
// Test the outcome.
- Assert.assertEquals(
+ assertEquals(
WayangCollections.asSet("John", "Evelyn"),
WayangCollections.asSet(outputValues)
);
diff --git a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/ApiTest.scala b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/ApiTest.scala
index cc05bd20b..25ef9ac49 100644
--- a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/ApiTest.scala
+++ b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/ApiTest.scala
@@ -24,7 +24,6 @@ import java.nio.file.{Files, Paths}
import java.sql.{Connection, Statement}
import java.util.function.Consumer
-import org.junit.{Assert, Test}
import org.apache.wayang.basic.WayangBasics
import org.apache.wayang.core.api.{Configuration, WayangContext}
import org.apache.wayang.core.function.FunctionDescriptor.ExtendedSerializablePredicate
@@ -35,6 +34,8 @@ import org.apache.wayang.java.operators.JavaMapOperator
import org.apache.wayang.spark.Spark
import org.apache.wayang.sqlite3.Sqlite3
import org.apache.wayang.sqlite3.operators.Sqlite3TableSource
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test
/**
* Tests the Wayang API.
@@ -57,7 +58,7 @@ class ApiTest {
// Check the outcome.
val expectedOutputValues = inputValues.map(_ + 2)
- Assert.assertArrayEquals(expectedOutputValues, outputValues.toArray)
+ assertArrayEquals(expectedOutputValues, outputValues.toArray)
}
@Test
@@ -87,7 +88,7 @@ class ApiTest {
// Check the outcome.
val expectedOutputValues = inputValues.map(_ + 2)
- Assert.assertArrayEquals(expectedOutputValues, outputValues.toArray)
+ assertArrayEquals(expectedOutputValues, outputValues.toArray)
}
@Test
@@ -113,7 +114,7 @@ class ApiTest {
// Check the outcome.
val expectedOutputValues = inputValues.map(_ + 2)
- Assert.assertArrayEquals(expectedOutputValues, outputValues.toArray)
+ assertArrayEquals(expectedOutputValues, outputValues.toArray)
}
@Test
@@ -135,7 +136,7 @@ class ApiTest {
val expectedWordCounts = Set(("big", 3), ("is", 2), ("data", 3))
- Assert.assertEquals(expectedWordCounts, wordCounts)
+ assertEquals(expectedWordCounts, wordCounts)
}
@Test
@@ -157,7 +158,7 @@ class ApiTest {
val expectedWordCounts = Set(("big", 3), ("is", 2), ("data", 3))
- Assert.assertEquals(expectedWordCounts, wordCounts)
+ assertEquals(expectedWordCounts, wordCounts)
}
@Test
@@ -175,8 +176,8 @@ class ApiTest {
.collect()
// Check the result.
- Assert.assertEquals(10, sample.size)
- Assert.assertEquals(10, sample.toSet.size)
+ assertEquals(10, sample.size)
+ assertEquals(10, sample.toSet.size)
}
@Test
@@ -199,7 +200,7 @@ class ApiTest {
.collect().toSet
val expectedValues = Set(1, 2, 3, 6, 12, 24, 48, 96, 192)
- Assert.assertEquals(expectedValues, values)
+ assertEquals(expectedValues, values)
}
@Test
@@ -222,7 +223,7 @@ class ApiTest {
// initial: 1,2 -> 1st: 2,3 -> 2nd: 6,7 => 3rd: 42,43
val expectedValues = Set(42, 43)
- Assert.assertEquals(expectedValues, values)
+ assertEquals(expectedValues, values)
}
@Test
@@ -256,7 +257,7 @@ class ApiTest {
.collect().toSet
val expectedValues = Set("Hello", "World")
- Assert.assertEquals(expectedValues, values)
+ assertEquals(expectedValues, values)
}
@Test
@@ -280,7 +281,7 @@ class ApiTest {
.collect()
val expectedValues = Set(5, 6)
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@Test
@@ -304,7 +305,7 @@ class ApiTest {
.collect()
val expectedValues = Set(5)
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@Test
@@ -324,7 +325,7 @@ class ApiTest {
.collect()
val expectedValues = Set(("Apple juice", 10), ("Tap water", 0), ("Orange juice", 10))
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@Test
@@ -343,7 +344,7 @@ class ApiTest {
.collect()
val expectedValues = Set(("Apple juice", 10), ("Tap water", 0), ("Orange juice", 10))
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@@ -369,7 +370,7 @@ class ApiTest {
(Set(("Cola", 5)), Set()),
(Set(("Juice", 10)), Set(("Apple juice", "Juice"), ("Orange juice", "Juice")))
)
- Assert.assertEquals(expectedValues, actualValues)
+ assertEquals(expectedValues, actualValues)
}
@Test
@@ -388,7 +389,7 @@ class ApiTest {
.collect()
val expectedValues = Set(2, 3, 4, 5, 7, 8, 9)
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@@ -406,7 +407,7 @@ class ApiTest {
.collect()
val expectedValues = Array(1, 2, 3, 4, 5)
- Assert.assertArrayEquals(expectedValues, result.toArray)
+ assertArrayEquals(expectedValues, result.toArray)
}
@@ -430,9 +431,9 @@ class ApiTest {
print(pageRanks)
// Let's not check absolute numbers but only the relative ordering.
- Assert.assertTrue(pageRanks(1) > pageRanks(0))
- Assert.assertTrue(pageRanks(0) > pageRanks(2))
- Assert.assertTrue(pageRanks(2) > pageRanks(3))
+ assertTrue(pageRanks(1) > pageRanks(0))
+ assertTrue(pageRanks(0) > pageRanks(2))
+ assertTrue(pageRanks(2) > pageRanks(3))
}
@Test
@@ -452,7 +453,7 @@ class ApiTest {
.reduceByKey(_._1, { case ((kind1, count1), (kind2, count2)) => (kind1, count1 + count2) })
.collect()
- Assert.assertEquals(Set(("odd", 2), ("even", 5)), typeCounts.toSet)
+ assertEquals(Set(("odd", 2), ("even", 5)), typeCounts.toSet)
}
@Test
@@ -474,7 +475,7 @@ class ApiTest {
.collect()
val expectedValues = Set((42, 100))
- Assert.assertEquals(expectedValues, result.toSet)
+ assertEquals(expectedValues, result.toSet)
}
@Test
@@ -497,7 +498,7 @@ class ApiTest {
})
val expectedLines = inputValues.map(v => f"${v % .2f}").toSet
- Assert.assertEquals(expectedLines, lines)
+ assertEquals(expectedLines, lines)
}
@Test
@@ -535,7 +536,7 @@ class ApiTest {
.toSet
val expectedValues = Set("John", "Evelyn")
- Assert.assertEquals(expectedValues, result)
+ assertEquals(expectedValues, result)
}
@Test
@@ -573,6 +574,6 @@ class ApiTest {
.toSet
val expectedValues = Set("John", "Evelyn")
- Assert.assertEquals(expectedValues, result)
+ assertEquals(expectedValues, result)
}
}
diff --git a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OperatorSerializationTests.scala b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OperatorSerializationTests.scala
index 6dff434ba..1f97ce0de 100644
--- a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OperatorSerializationTests.scala
+++ b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OperatorSerializationTests.scala
@@ -26,7 +26,7 @@ import org.apache.wayang.postgres.Postgres
import org.apache.wayang.postgres.operators.PostgresTableSource
import org.apache.wayang.sqlite3.Sqlite3
import org.apache.wayang.sqlite3.operators.Sqlite3TableSource
-import org.junit.Test
+import org.junit.jupiter.api.Test
import java.io.{File, PrintWriter}
import java.sql.{Connection, Statement}
diff --git a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OtherSerializationTests.scala b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OtherSerializationTests.scala
index 1f01b2f98..5ba562962 100644
--- a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OtherSerializationTests.scala
+++ b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/OtherSerializationTests.scala
@@ -28,7 +28,8 @@ import org.apache.wayang.core.platform.Platform
import org.apache.wayang.core.util.ReflectionUtils
import org.apache.wayang.java.Java
import org.apache.wayang.spark.Spark
-import org.junit.{Assert, Test}
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test
import java.nio.file.{Files, Paths}
@@ -45,15 +46,15 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serializedConfiguration = SerializationUtils.serialize(configuration)
val deserializedConfiguration = SerializationUtils.deserialize[Configuration](serializedConfiguration)
- Assert.assertEquals(deserializedConfiguration.getStringProperty("spark.master"), "random_master_url_1")
- Assert.assertEquals(deserializedConfiguration.getStringProperty("spark.app.name"), "random_app_name_2")
+ assertEquals(deserializedConfiguration.getStringProperty("spark.master"), "random_master_url_1")
+ assertEquals(deserializedConfiguration.getStringProperty("spark.app.name"), "random_app_name_2")
val serializedMultiContext = SerializationUtils.serialize(multiContext)
val deserializedMultiContext = SerializationUtils.deserialize[MultiContext](serializedMultiContext)
- Assert.assertEquals(deserializedMultiContext.getConfiguration.getStringProperty("spark.master"), "random_master_url_1")
- Assert.assertEquals(deserializedMultiContext.getConfiguration.getStringProperty("spark.app.name"), "random_app_name_2")
- Assert.assertEquals(deserializedMultiContext.getSink.get.asInstanceOf[MultiContext.TextFileSink].url, "file:///tmp/out11")
- Assert.assertArrayEquals(multiContext.getConfiguration.getPlatformProvider.provideAll().toArray, deserializedMultiContext.getConfiguration.getPlatformProvider.provideAll().toArray)
+ assertEquals(deserializedMultiContext.getConfiguration.getStringProperty("spark.master"), "random_master_url_1")
+ assertEquals(deserializedMultiContext.getConfiguration.getStringProperty("spark.app.name"), "random_app_name_2")
+ assertEquals(deserializedMultiContext.getSink.get.asInstanceOf[MultiContext.TextFileSink].url, "file:///tmp/out11")
+ assertArrayEquals(multiContext.getConfiguration.getPlatformProvider.provideAll().toArray, deserializedMultiContext.getConfiguration.getPlatformProvider.provideAll().toArray)
} catch {
case t: Throwable =>
t.printStackTrace()
@@ -76,19 +77,19 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serialized = SerializationUtils.serializeAsString(planBuilder)
val deserialized = SerializationUtils.deserializeFromString[PlanBuilder](serialized)
- // SerializationTestBase.log(SerializationUtils.serializeAsString(deserialized), testName.getMethodName + ".log.json")
+ // SerializationTestBase.log(SerializationUtils.serializeAsString(deserialized), testName + ".log.json")
- Assert.assertEquals(
+ assertEquals(
planBuilder.udfJars,
deserialized.udfJars
)
- Assert.assertEquals(
- deserialized.wayangContext.asInstanceOf[MultiContext].getConfiguration.getStringProperty("spark.master"),
- "master1"
+ assertEquals(
+ "master1",
+ deserialized.wayangContext.asInstanceOf[MultiContext].getConfiguration.getStringProperty("spark.master")
)
- Assert.assertEquals(
+ assertEquals(
+ "file:///tmp/out11",
deserialized.wayangContext.asInstanceOf[MultiContext].getSink.get.asInstanceOf[MultiContext.TextFileSink].url,
- "file:///tmp/out11"
)
}
catch {
@@ -116,25 +117,25 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serialized = SerializationUtils.serializeAsString(multiContextPlanBuilder)
val deserialized = SerializationUtils.deserializeFromString[MultiContextPlanBuilder](serialized)
- // SerializationTestBase.log(SerializationUtils.serializeAsString(deserialized), testName.getMethodName + ".log.json")
+ // SerializationTestBase.log(SerializationUtils.serializeAsString(deserialized), testName + ".log.json")
- Assert.assertEquals(
+ assertEquals(
multiContextPlanBuilder.udfJars,
deserialized.udfJars
)
- Assert.assertEquals(
+ assertEquals(
multiContextPlanBuilder.multiContexts(0).getConfiguration.getStringProperty("spark.master"),
"master1"
)
- Assert.assertEquals(
+ assertEquals(
multiContextPlanBuilder.multiContexts(1).getConfiguration.getStringProperty("spark.master"),
"master2"
)
- Assert.assertEquals(
+ assertEquals(
multiContextPlanBuilder.multiContexts(0).getSink.get.asInstanceOf[MultiContext.TextFileSink].url,
"file:///tmp/out11"
)
- Assert.assertEquals(
+ assertEquals(
multiContextPlanBuilder.multiContexts(1).getSink.get.asInstanceOf[MultiContext.ObjectFileSink].url,
"file:///tmp/out12"
)
@@ -169,7 +170,7 @@ class OtherSerializationTests extends SerializationTestBase {
val operator = TempFileUtils.readFromTempFileFromString[Operator](tempfile)
// Attach an output sink to deserialized plan
- val tempFileOut = s"/tmp/${testName.getMethodName}.out"
+ val tempFileOut = s"/tmp/$testName.out"
val sink = new TextFileSink[AnyRef](s"file://$tempFileOut", classOf[AnyRef])
operator.connectTo(0, sink, 0)
@@ -226,7 +227,7 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serialized = SerializationUtils.serialize(Java.platform())
val deserialized = SerializationUtils.deserialize[Platform](serialized)
- Assert.assertEquals(deserialized.getClass.getName, Java.platform().getClass.getName)
+ assertEquals(deserialized.getClass.getName, Java.platform().getClass.getName)
} catch {
case t: Throwable =>
t.printStackTrace()
@@ -250,10 +251,10 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serialized = SerializationUtils.serializeAsString(dataQuanta.operator)
val deserialized = SerializationUtils.deserializeFromString[Operator](serialized)
- Assert.assertEquals(deserialized.getTargetPlatforms.size(), 2)
+ assertEquals(deserialized.getTargetPlatforms.size(), 2)
val deserializedPlatformNames = deserialized.getTargetPlatforms.toArray.map(p => p.getClass.getName)
- Assert.assertTrue(deserializedPlatformNames.contains(Spark.platform().getClass.getName))
- Assert.assertTrue(deserializedPlatformNames.contains(Java.platform().getClass.getName))
+ assertTrue(deserializedPlatformNames.contains(Spark.platform().getClass.getName))
+ assertTrue(deserializedPlatformNames.contains(Java.platform().getClass.getName))
} catch {
case t: Throwable =>
t.printStackTrace()
@@ -282,8 +283,8 @@ class OtherSerializationTests extends SerializationTestBase {
try {
val serialized = SerializationUtils.serializeAsString(dataQuanta.operator)
val deserialized = SerializationUtils.deserializeFromString[Operator](serialized)
- Assert.assertEquals(deserialized.getTargetPlatforms.size(), 1)
- Assert.assertEquals(deserialized.getTargetPlatforms.toArray.toList(0).getClass.getName, Spark.platform().getClass.getName)
+ assertEquals(deserialized.getTargetPlatforms.size(), 1)
+ assertEquals(deserialized.getTargetPlatforms.toArray.toList(0).getClass.getName, Spark.platform().getClass.getName)
} catch {
case t: Throwable =>
t.printStackTrace()
@@ -326,8 +327,8 @@ class OtherSerializationTests extends SerializationTestBase {
.getFunctionDescriptor
.getLoadProfileEstimator.get().asInstanceOf[NestableLoadProfileEstimator]
- Assert.assertEquals(originalLoadProfileEstimator.getConfigurationKeys, deserializedLoadProfileEstimator.getConfigurationKeys)
- Assert.assertEquals(originalLoadProfileEstimator.getTemplateKeys, deserializedLoadProfileEstimator.getTemplateKeys)
+ assertEquals(originalLoadProfileEstimator.getConfigurationKeys, deserializedLoadProfileEstimator.getConfigurationKeys)
+ assertEquals(originalLoadProfileEstimator.getTemplateKeys, deserializedLoadProfileEstimator.getTemplateKeys)
/*// Print the contents of configuration keys array for both the originalLoadProfileEstimator and the deserializedLoadProfileEstimator
println("originalLoadProfileEstimator.getConfigurationKeys: " + originalLoadProfileEstimator.getConfigurationKeys.mkString(","))
diff --git a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/SerializationTestBase.scala b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/SerializationTestBase.scala
index 5b8379817..cabca74db 100644
--- a/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/SerializationTestBase.scala
+++ b/wayang-api/wayang-api-scala-java/src/test/scala/org/apache/wayang/api/serialization/SerializationTestBase.scala
@@ -23,8 +23,8 @@ import org.apache.wayang.basic.operators.TextFileSink
import org.apache.wayang.core.api.WayangContext
import org.apache.wayang.core.plan.wayangplan.{LoopHeadOperator, Operator, WayangPlan}
import org.apache.wayang.core.util.ReflectionUtils
-import org.junit.rules.TestName
-import org.junit.{Assert, Rule}
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.{BeforeEach, TestInfo}
import java.io.{File, FileWriter}
import java.nio.file.{Files, Paths}
@@ -34,19 +34,13 @@ import scala.jdk.CollectionConverters.asScalaBufferConverter
trait SerializationTestBase {
- //
- // Some magic from https://stackoverflow.com/a/36152864/5589918 in order to get the current test name
- //
- var _testName: TestName = new TestName
+ var testName: String = _
- @Rule
- def testName: TestName = _testName
-
- def testName_=(aTestName: TestName): Unit = {
- _testName = aTestName
+ @BeforeEach
+ def setUp(info: TestInfo): Unit = {
+ testName = info.getTestMethod.orElseThrow().getName
}
-
def serializeDeserializeExecuteAssert(operator: Operator, wayangContext: WayangContext, expectedLines: List[String], log: Boolean = false): Unit = {
var tempFileOut: Option[String] = None
try {
@@ -70,12 +64,12 @@ trait SerializationTestBase {
def serializeDeserializeExecute(operator: Operator, wayangContext: WayangContext, log: Boolean = false): String = {
try {
val serialized = SerializationUtils.serializeAsString(operator)
- if (log) SerializationTestBase.log(serialized, testName.getMethodName + ".log.json")
+ if (log) SerializationTestBase.log(serialized, testName + ".log.json")
val deserialized = SerializationUtils.deserializeFromString[Operator](serialized)
// Create an output sink
val outType = deserialized.getOutput(0).getType.getDataUnitType.getTypeClass
- val tempFilenameOut = s"/tmp/${testName.getMethodName}.out"
+ val tempFilenameOut = s"/tmp/$testName.out"
val sink = new TextFileSink(s"file://$tempFilenameOut", outType)
// And attach it to the deserialized operator
@@ -106,11 +100,11 @@ object SerializationTestBase {
val lines = Files.lines(Paths.get(outputFilename)).collect(Collectors.toList[String]).asScala
// Assert number of lines
- Assert.assertEquals("Number of lines in the file should match", expectedLines.size, lines.size)
+ assertEquals(expectedLines.size, lines.size, "Number of lines in the file should match")
// Assert content of lines
lines.zip(expectedLines).foreach { case (actual, expected) =>
- Assert.assertEquals("Line content should match", expected, actual)
+ assertEquals(expected, actual, "Line content should match")
}
}
@@ -120,7 +114,7 @@ object SerializationTestBase {
val lines = Files.lines(Paths.get(outputFilename)).collect(Collectors.toList[String]).asScala
// Assert number of lines
- Assert.assertEquals("Number of lines in the file should match", expectedNumberOfLines, lines.size)
+ assertEquals(expectedNumberOfLines, lines.size, "Number of lines in the file should match")
}
diff --git a/wayang-api/wayang-api-sql/src/test/java/org/apache/wayang/api/sql/SqlToWayangRelTest.java b/wayang-api/wayang-api-sql/src/test/java/org/apache/wayang/api/sql/SqlToWayangRelTest.java
index bd4bca54b..64372c40d 100755
--- a/wayang-api/wayang-api-sql/src/test/java/org/apache/wayang/api/sql/SqlToWayangRelTest.java
+++ b/wayang-api/wayang-api-sql/src/test/java/org/apache/wayang/api/sql/SqlToWayangRelTest.java
@@ -19,14 +19,12 @@
import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.externalize.RelWriterImpl;
import org.apache.calcite.rel.rules.CoreRules;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.rex.RexBuilder;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.sql.SqlExplainLevel;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
@@ -34,43 +32,33 @@
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.tools.RuleSet;
import org.apache.calcite.tools.RuleSets;
-
import org.apache.wayang.api.sql.calcite.convention.WayangConvention;
import org.apache.wayang.api.sql.calcite.converter.functions.FilterPredicateImpl;
import org.apache.wayang.api.sql.calcite.converter.functions.ProjectMapFuncImpl;
import org.apache.wayang.api.sql.calcite.optimizer.Optimizer;
import org.apache.wayang.api.sql.calcite.rules.WayangRules;
import org.apache.wayang.api.sql.calcite.schema.SchemaUtils;
-import org.apache.wayang.api.sql.calcite.schema.WayangSchema;
-import org.apache.wayang.api.sql.calcite.schema.WayangSchemaBuilder;
-import org.apache.wayang.api.sql.calcite.schema.WayangTable;
-import org.apache.wayang.api.sql.calcite.schema.WayangTableBuilder;
import org.apache.wayang.api.sql.calcite.utils.ModelParser;
-import org.apache.wayang.api.sql.calcite.utils.PrintUtils;
import org.apache.wayang.api.sql.context.SqlContext;
+import org.apache.wayang.basic.data.Record;
import org.apache.wayang.basic.data.Tuple2;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.function.FunctionDescriptor.SerializablePredicate;
-import org.apache.wayang.core.plan.wayangplan.Operator;
import org.apache.wayang.core.plan.wayangplan.PlanTraversal;
import org.apache.wayang.core.plan.wayangplan.WayangPlan;
import org.apache.wayang.java.Java;
import org.apache.wayang.spark.Spark;
-import org.apache.wayang.basic.data.Record;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
-
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -80,20 +68,24 @@
import java.util.Properties;
import java.util.stream.Collectors;
-public class SqlToWayangRelTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SqlToWayangRelTest {
/**
* Method for building {@link WayangPlan}s useful for testing, benchmarking and
* other
* usages where you want to handle the intermediate {@link WayangPlan}
- *
+ *
* @param sql sql query string with the {@code ;} cut off
* @param udfJars
* @return a {@link WayangPlan} of a given sql string
* @throws SqlParseException
* @throws SQLException
*/
- public Tuple2, WayangPlan> buildCollectorAndWayangPlan(final SqlContext context,
+ private Tuple2, WayangPlan> buildCollectorAndWayangPlan(final SqlContext context,
final String sql, final String... udfJars) throws SqlParseException, SQLException {
final Properties configProperties = Optimizer.ConfigProperties.getDefaults();
final RelDataTypeFactory relDataTypeFactory = new JavaTypeFactoryImpl();
@@ -131,7 +123,7 @@ public Tuple2, WayangPlan> buildCollectorAndWayangPlan(final
}
@Test
- public void javaJoinTest() throws Exception {
+ void javaJoinTest() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
"SELECT * FROM fs.largeLeftTableIndex JOIN fs.exampleRefToRef ON largeLeftTableIndex.NAMEA = exampleRefToRef.NAMEA");
@@ -139,18 +131,16 @@ public void javaJoinTest() throws Exception {
final WayangPlan wayangPlan = t.field1;
// except reduce by
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Java.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Java.platform()));
sqlContext.execute(wayangPlan);
- assert (result.stream()
+ assertTrue(result.stream()
.anyMatch(rec -> rec.equals(new Record("test1", "test1", "test2", "test1", "test1"))));
}
@Test
- public void javaMultiConditionJoin() throws Exception {
+ void javaMultiConditionJoin() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
"SELECT * FROM fs.largeLeftTableIndex JOIN fs.exampleRefToRef ON largeLeftTableIndex.NAMEB = exampleRefToRef.NAMEB AND largeLeftTableIndex.NAMEC = exampleRefToRef.NAMEB");
@@ -158,20 +148,18 @@ public void javaMultiConditionJoin() throws Exception {
final WayangPlan wayangPlan = t.field1;
// except reduce by
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Java.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Java.platform()));
sqlContext.execute(wayangPlan);
final boolean checkEq = result.stream()
.allMatch(rec -> rec.equals(new Record("", "test2", "test2", "", "test2")));
- assert (checkEq);
+ assertTrue(checkEq);
}
@Test
- public void aggregateCountInJavaWithIntegers() throws Exception {
+ void aggregateCountInJavaWithIntegers() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/exampleInt.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
"SELECT exampleInt.NAMEC, COUNT(*) FROM fs.exampleInt GROUP BY NAMEC");
@@ -179,19 +167,17 @@ public void aggregateCountInJavaWithIntegers() throws Exception {
final WayangPlan wayangPlan = t.field1;
// except reduce by
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Java.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Java.platform()));
sqlContext.execute(wayangPlan);
- final Record rec = result.stream().findFirst().get();
- assert (rec.size() == 2);
- assert (rec.getInt(1) == 3);
+ final Record rec = result.stream().findFirst().orElseThrow();
+ assertEquals(2, rec.size());
+ assertEquals(3, rec.getInt(1));
}
@Test
- public void aggregateCountInJava() throws Exception {
+ void aggregateCountInJava() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
"SELECT largeLeftTableIndex.NAMEC, COUNT(*) FROM fs.largeLeftTableIndex GROUP BY NAMEC");
@@ -199,19 +185,17 @@ public void aggregateCountInJava() throws Exception {
final WayangPlan wayangPlan = t.field1;
// except reduce by
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Java.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Java.platform()));
sqlContext.execute(wayangPlan);
- final Record rec = result.stream().findFirst().get();
- assert (rec.size() == 2);
- assert (rec.getInt(1) == 3);
+ final Record rec = result.stream().findFirst().orElseThrow();
+ assertEquals(2, rec.size());
+ assertEquals(3, rec.getInt(1));
}
@Test
- public void filterIsNull() throws Exception {
+ void filterIsNull() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -220,11 +204,11 @@ public void filterIsNull() throws Exception {
final Collection result = t.field0;
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (result.size() == 0);
+ assertTrue(result.isEmpty());
}
@Test
- public void javaAverage() throws Exception {
+ void javaAverage() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/exampleSort.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -235,12 +219,12 @@ public void javaAverage() throws Exception {
sqlContext.execute(wayangPlan);
- assert (result.size() == 1);
- assert (result.stream().findFirst().get().getDouble(0) == 0.875f);
+ assertEquals(1, result.size());
+ assertEquals(0.875f, result.stream().findFirst().orElseThrow().getDouble(0));
}
@Test
- public void filterNotEqualsValue() throws Exception {
+ void filterNotEqualsValue() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -252,11 +236,11 @@ public void filterNotEqualsValue() throws Exception {
sqlContext.execute(wayangPlan);
- assert (!result.stream().anyMatch(record -> record.getField(0).equals("test1")));
+ assertTrue(result.stream().noneMatch(rec -> rec.getField(0).equals("test1")));
}
@Test
- public void filterIsNotNull() throws Exception {
+ void filterIsNotNull() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -267,11 +251,11 @@ public void filterIsNotNull() throws Exception {
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (!result.stream().anyMatch(record -> record.getField(0).equals(null)));
+ assertTrue(result.stream().noneMatch(rec -> rec.getField(0) == null));
}
@Test
- public void javaReduceBy() throws Exception {
+ void javaReduceBy() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(
@@ -281,17 +265,15 @@ public void javaReduceBy() throws Exception {
final Collection result = t.field0;
final WayangPlan wayangPlan = t.field1;
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Java.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Java.platform()));
sqlContext.execute(wayangPlan);
- assert (result.stream().anyMatch(rec -> rec.equals(new Record("item1", 2))));
+ assertTrue(result.stream().anyMatch(rec -> rec.equals(new Record("item1", 2))));
}
@Test
- public void javaCrossJoin() throws Exception {
+ void javaCrossJoin() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(
@@ -316,11 +298,11 @@ public void javaCrossJoin() throws Exception {
final Map shouldBeTally = shouldBe.stream()
.collect(Collectors.toMap(rec -> rec, rec -> 1, Integer::sum));
- assert (resultTally.equals(shouldBeTally));
+ assertEquals(resultTally, shouldBeTally);
}
@Test
- public void filterWithNotLike() throws Exception {
+ void filterWithNotLike() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -331,11 +313,11 @@ public void filterWithNotLike() throws Exception {
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (!result.stream().anyMatch(record -> record.getString(0).equals("test1")));
+ assertTrue(result.stream().noneMatch(rec -> rec.getString(0).equals("test1")));
}
@Test
- public void filterWithLike() throws Exception {
+ void filterWithLike() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -346,11 +328,11 @@ public void filterWithLike() throws Exception {
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1", "test2"))));
+ assertTrue(result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1", "test2"))));
}
@Test
- public void javaLimit() throws Exception {
+ void javaLimit() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/exampleSort.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -361,14 +343,14 @@ public void javaLimit() throws Exception {
sqlContext.execute(wayangPlan);
- final List result = r.stream().collect(Collectors.toList());
+ final List result = new ArrayList<>(r);
- assert (result.size() == 1);
- assert (result.get(0).equals(new Record(2, "a", "a", 2)));
+ assertEquals(1, result.size());
+ assertEquals(new Record(2, "a", "a", 2), result.get(0));
}
@Test
- public void javaLimitNoSort() throws Exception {
+ void javaLimitNoSort() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/exampleSort.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -379,13 +361,13 @@ public void javaLimitNoSort() throws Exception {
sqlContext.execute(wayangPlan);
- final List result = r.stream().collect(Collectors.toList());
+ final List result = new ArrayList<>(r);
- assert (result.size() == 2);
+ assertEquals(2, result.size());
}
@Test
- public void javaSort() throws Exception {
+ void javaSort() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/exampleSort.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -396,19 +378,19 @@ public void javaSort() throws Exception {
sqlContext.execute(wayangPlan);
- final List result = r.stream().collect(Collectors.toList());
+ final List result = new ArrayList<>(r);
- assert (result.get(0).equals(new Record(2, "a", "a", 2)));
- assert (result.get(1).equals(new Record(1, "a", "b", 1)));
- assert (result.get(2).equals(new Record(1, "a", "a", 1)));
- assert (result.get(3).equals(new Record(1, "b", "b", 1)));
- assert (result.get(4).equals(new Record(0, "a", "b", 1)));
- assert (result.get(5).equals(new Record(0, "a", "a", 1)));
- assert (result.get(6).equals(new Record(0, "b", "b", 1)));
+ assertEquals(new Record(2, "a", "a", 2), result.get(0));
+ assertEquals(new Record(1, "a", "b", 1), result.get(1));
+ assertEquals(new Record(1, "a", "a", 1), result.get(2));
+ assertEquals(new Record(1, "b", "b", 1), result.get(3));
+ assertEquals(new Record(0, "a", "b", 1), result.get(4));
+ assertEquals(new Record(0, "a", "a", 1), result.get(5));
+ assertEquals(new Record(0, "b", "b", 1), result.get(6));
}
@Test
- public void joinWithLargeLeftTableIndexCorrect() throws Exception {
+ void joinWithLargeLeftTableIndexCorrect() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -429,7 +411,7 @@ public void joinWithLargeLeftTableIndexCorrect() throws Exception {
final Map shouldBeTally = shouldBe.stream()
.collect(Collectors.toMap(rec -> rec, rec -> 1, Integer::sum));
- assert (resultTally.equals(shouldBeTally));
+ assertEquals(resultTally, shouldBeTally);
}
// Imagine case: l = {item1, item2}, r = {item3,item4}, j = {item1, item2,
@@ -439,7 +421,7 @@ public void joinWithLargeLeftTableIndexCorrect() throws Exception {
// that it is always ordered as =(lRef,rRef), lRef < rRef.
// it may also be =($3,$1)
@Test
- public void joinWithLargeLeftTableIndexMirrorAlias() throws Exception {
+ void joinWithLargeLeftTableIndexMirrorAlias() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -460,11 +442,11 @@ public void joinWithLargeLeftTableIndexMirrorAlias() throws Exception {
final Map shouldBeTally = shouldBe.stream()
.collect(Collectors.toMap(rec -> rec, rec -> 1, Integer::sum));
- assert (resultTally.equals(shouldBeTally));
+ assertEquals(resultTally, shouldBeTally);
}
@Test
- public void sparkFilter() throws Exception {
+ void sparkFilter() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -474,17 +456,15 @@ public void sparkFilter() throws Exception {
final Collection result = t.field0;
final WayangPlan wayangPlan = t.field1;
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Spark.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Spark.platform()));
sqlContext.execute(wayangPlan);
- assert (result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1", "test2"))));
+ assertTrue(result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1", "test2"))));
}
@Test
- public void sparkAggregate() throws Exception {
+ void sparkAggregate() throws Exception {
final SqlContext sqlContext = this.createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
"SELECT largeLeftTableIndex.NAMEC, COUNT(*) FROM fs.largeLeftTableIndex GROUP BY NAMEC");
@@ -492,20 +472,18 @@ public void sparkAggregate() throws Exception {
final WayangPlan wayangPlan = t.field1;
// except reduce by
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Spark.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Spark.platform()));
sqlContext.execute(wayangPlan);
- final Record rec = result.stream().findFirst().get();
- assert (rec.size() == 2);
- assert (rec.getInt(1) == 3);
+ final Record rec = result.stream().findFirst().orElseThrow();
+ assertEquals(2, rec.size());
+ assertEquals(3, rec.getInt(1));
}
// tests sql-apis ability to serialize projections and joins
@Test
- public void sparkInnerJoin() throws Exception {
+ void sparkInnerJoin() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/largeLeftTableIndex.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -515,9 +493,7 @@ public void sparkInnerJoin() throws Exception {
final Collection result = t.field0;
final WayangPlan wayangPlan = t.field1;
- PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> {
- node.addTargetPlatform(Spark.platform());
- });
+ PlanTraversal.upstream().traverse(wayangPlan.getSinks()).getTraversedNodes().forEach(node -> node.addTargetPlatform(Spark.platform()));
sqlContext.execute(wayangPlan);
@@ -531,11 +507,11 @@ public void sparkInnerJoin() throws Exception {
final Map shouldBeTally = shouldBe.stream()
.collect(Collectors.toMap(rec -> rec, rec -> 1, Integer::sum));
- assert (resultTally.equals(shouldBeTally));
+ assertEquals(resultTally, shouldBeTally);
}
@Test
- public void serializeProjection() throws Exception {
+ void serializeProjection() throws Exception {
final RexBuilder rb = new RexBuilder(new JavaTypeFactoryImpl());
final RelDataTypeFactory typeFactory = rb.getTypeFactory();
@@ -566,10 +542,10 @@ public void serializeProjection() throws Exception {
final ObjectInputStream inStream = new ObjectInputStream(byteInStream);
final ProjectMapFuncImpl deserializedImpl = (ProjectMapFuncImpl) inStream.readObject();
inStream.close();
-
+
final Record testRecord = new Record(1,2,3);
- assert (impl.apply(testRecord).equals(deserializedImpl.apply(testRecord)));
+ assertEquals(impl.apply(testRecord), deserializedImpl.apply(testRecord));
}
@Test
@@ -593,11 +569,11 @@ public void serializeFilter() throws Exception {
final Object deserializedObject = objectInputStream.readObject();
objectInputStream.close();
- assert (((FilterPredicateImpl) deserializedObject).test(new Record("test")));
+ assertTrue(((FilterPredicateImpl) deserializedObject).test(new Record("test")));
}
@Test
- public void exampleFilterTableRefToTableRef() throws Exception {
+ void exampleFilterTableRefToTableRef() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/exampleRefToRef.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -608,11 +584,11 @@ public void exampleFilterTableRefToTableRef() throws Exception {
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1"))));
+ assertTrue(result.stream().anyMatch(rec -> rec.equals(new Record("test1", "test1"))));
}
@Test
- public void exampleMinWithStrings() throws Exception {
+ void exampleMinWithStrings() throws Exception {
final SqlContext sqlContext = createSqlContext("/data/exampleMin.csv");
final Tuple2, WayangPlan> t = this.buildCollectorAndWayangPlan(sqlContext,
@@ -622,7 +598,7 @@ public void exampleMinWithStrings() throws Exception {
final WayangPlan wayangPlan = t.field1;
sqlContext.execute(wayangPlan);
- assert (result.stream().findAny().get().getString(0).equals("AA"));
+ assertEquals("AA", result.stream().findAny().orElseThrow().getString(0));
}
private SqlContext createSqlContext(final String tableResourceName)
@@ -646,18 +622,15 @@ private SqlContext createSqlContext(final String tableResourceName)
" \"separator\": \";\"\r\n" + //
" }\r\n" + //
" \r\n" + //
- " \r\n" + //
- "";
+ " \r\n";
final JSONObject calciteModelJSON = (JSONObject) new JSONParser().parse(calciteModel);
final Configuration configuration = new ModelParser(new Configuration(), calciteModelJSON)
.setProperties();
- assert (configuration != null)
- : "Could not get configuration with calcite model: " + calciteModel;
+ assertNotNull(configuration,"Could not get configuration with calcite model: " + calciteModel);
final String dataPath = this.getClass().getResource(tableResourceName).getPath();
- assert (dataPath != null && dataPath != "")
- : "Could not get table resource from path: " + tableResourceName;
+ assertTrue(dataPath != null && !dataPath.isEmpty(), "Could not get table resource from path: " + tableResourceName);
configuration.setProperty("wayang.fs.table.url", dataPath);
diff --git a/wayang-applications/pom.xml b/wayang-applications/pom.xml
index 834879650..dbc3f3263 100644
--- a/wayang-applications/pom.xml
+++ b/wayang-applications/pom.xml
@@ -52,7 +52,7 @@
0.8.9
2.10.6
2.4.0
- 5.10.2
+ 5.12.2
5.11.0
@@ -113,9 +113,9 @@
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter
+ test
diff --git a/wayang-benchmark/src/test/java/org/apache/wayang/apps/tpch/data/LineItemTupleTest.java b/wayang-benchmark/src/test/java/org/apache/wayang/apps/tpch/data/LineItemTupleTest.java
index 506a0cbdc..e5385f0de 100644
--- a/wayang-benchmark/src/test/java/org/apache/wayang/apps/tpch/data/LineItemTupleTest.java
+++ b/wayang-benchmark/src/test/java/org/apache/wayang/apps/tpch/data/LineItemTupleTest.java
@@ -18,40 +18,41 @@
package org.apache.wayang.apps.tpch.data;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Calendar;
import java.util.GregorianCalendar;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Test suited for {@link LineItemTuple}.
*/
-public class LineItemTupleTest {
+class LineItemTupleTest {
@Test
- public void testParser() {
+ void testParser() {
LineItemTuple.Parser parser = new LineItemTuple.Parser();
final LineItemTuple tuple = parser.parse("\"3249925\";\"37271\";\"9775\";\"1\";\"9.00\";\"10874.43\";\"0.10\";" +
"\"0.04\";\"N\";\"O\";\"1998-04-19\";\"1998-06-17\";\"1998-04-21\";\"TAKE BACK RETURN \";" +
"\"AIR \";\"express instructions among the excuses nag\"");
- Assert.assertEquals(3249925, tuple.L_ORDERKEY);
- Assert.assertEquals(37271, tuple.L_PARTKEY);
- Assert.assertEquals(9775, tuple.L_SUPPKEY);
- Assert.assertEquals(1, tuple.L_LINENUMBER);
- Assert.assertEquals(9.00, tuple.L_QUANTITY, 0);
- Assert.assertEquals(10874.43, tuple.L_EXTENDEDPRICE, 0.001);
- Assert.assertEquals(0.10, tuple.L_DISCOUNT, 0.001);
- Assert.assertEquals(0.04, tuple.L_TAX, 0.001);
- Assert.assertEquals('N', tuple.L_RETURNFLAG);
- Assert.assertEquals('O', tuple.L_LINESTATUS);
- Assert.assertEquals(this.toDateInteger(1998, 4, 19), tuple.L_SHIPDATE);
- Assert.assertEquals(this.toDateInteger(1998, 6, 17), tuple.L_COMMITDATE);
- Assert.assertEquals(this.toDateInteger(1998, 4, 21), tuple.L_RECEIPTDATE);
- Assert.assertEquals("TAKE BACK RETURN ", tuple.L_SHIPINSTRUCT);
- Assert.assertEquals("AIR ", tuple.L_SHIPMODE);
- Assert.assertEquals("express instructions among the excuses nag", tuple.L_COMMENT);
+ assertEquals(3249925, tuple.L_ORDERKEY);
+ assertEquals(37271, tuple.L_PARTKEY);
+ assertEquals(9775, tuple.L_SUPPKEY);
+ assertEquals(1, tuple.L_LINENUMBER);
+ assertEquals(9.00, tuple.L_QUANTITY, 0);
+ assertEquals(10874.43, tuple.L_EXTENDEDPRICE, 0.001);
+ assertEquals(0.10, tuple.L_DISCOUNT, 0.001);
+ assertEquals(0.04, tuple.L_TAX, 0.001);
+ assertEquals('N', tuple.L_RETURNFLAG);
+ assertEquals('O', tuple.L_LINESTATUS);
+ assertEquals(this.toDateInteger(1998, 4, 19), tuple.L_SHIPDATE);
+ assertEquals(this.toDateInteger(1998, 6, 17), tuple.L_COMMITDATE);
+ assertEquals(this.toDateInteger(1998, 4, 21), tuple.L_RECEIPTDATE);
+ assertEquals("TAKE BACK RETURN ", tuple.L_SHIPINSTRUCT);
+ assertEquals("AIR ", tuple.L_SHIPMODE);
+ assertEquals("express instructions among the excuses nag", tuple.L_COMMENT);
}
private int toDateInteger(int year, int month, int date) {
diff --git a/wayang-benchmark/src/test/scala/org/apache/wayang/apps/kmeans/KmeansTest.scala b/wayang-benchmark/src/test/scala/org/apache/wayang/apps/kmeans/KmeansTest.scala
index 53d6fead1..8a96a3041 100644
--- a/wayang-benchmark/src/test/scala/org/apache/wayang/apps/kmeans/KmeansTest.scala
+++ b/wayang-benchmark/src/test/scala/org/apache/wayang/apps/kmeans/KmeansTest.scala
@@ -19,8 +19,8 @@
package org.apache.wayang.apps.kmeans
import org.apache.wayang.commons.util.profiledb.model.{Experiment, Subject}
-import org.junit.Assert._
-import org.junit.Test
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test;
import org.apache.wayang.core.api.Configuration
import org.apache.wayang.java.Java
import org.apache.wayang.spark.Spark
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/function/ProjectionDescriptorTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/function/ProjectionDescriptorTest.java
index 453226434..72f60994d 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/function/ProjectionDescriptorTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/function/ProjectionDescriptorTest.java
@@ -18,35 +18,34 @@
package org.apache.wayang.basic.function;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.basic.data.Record;
import org.apache.wayang.basic.types.RecordType;
+import org.junit.jupiter.api.Test;
import java.util.function.Function;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
/**
* Tests for the {@link ProjectionDescriptor}.
*/
-public class ProjectionDescriptorTest {
+class ProjectionDescriptorTest {
@Test
- public void testPojoImplementation() {
+ void testPojoImplementation() {
final ProjectionDescriptor stringDescriptor = new ProjectionDescriptor<>(Pojo.class, String.class, "string");
final Function stringImplementation = stringDescriptor.getJavaImplementation();
final ProjectionDescriptor integerDescriptor = new ProjectionDescriptor<>(Pojo.class, Integer.class, "integer");
final Function integerImplementation = integerDescriptor.getJavaImplementation();
- Assert.assertEquals(
+ assertEquals(
"testValue",
stringImplementation.apply(new Pojo("testValue", 1))
);
- Assert.assertEquals(
- null,
- stringImplementation.apply(new Pojo(null, 1))
- );
- Assert.assertEquals(
+ assertNull(stringImplementation.apply(new Pojo(null, 1)));
+ assertEquals(
Integer.valueOf(1),
integerImplementation.apply(new Pojo("testValue", 1))
);
@@ -54,13 +53,13 @@ public void testPojoImplementation() {
}
@Test
- public void testRecordImplementation() {
+ void testRecordImplementation() {
RecordType inputType = new RecordType("a", "b", "c");
final ProjectionDescriptor descriptor = ProjectionDescriptor.createForRecords(inputType, "c", "a");
- Assert.assertEquals(new RecordType("c", "a"), descriptor.getOutputType());
+ assertEquals(new RecordType("c", "a"), descriptor.getOutputType());
final Function javaImplementation = descriptor.getJavaImplementation();
- Assert.assertEquals(
+ assertEquals(
new Record("world", 10),
javaImplementation.apply(new Record(10, "hello", "world"))
);
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/mapping/ReduceByMappingTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/mapping/ReduceByMappingTest.java
index 20d5a63f4..4a3ee742b 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/mapping/ReduceByMappingTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/mapping/ReduceByMappingTest.java
@@ -18,8 +18,7 @@
package org.apache.wayang.basic.mapping;
-import org.junit.Assert;
-import org.junit.Test;
+
import org.apache.wayang.basic.data.Tuple2;
import org.apache.wayang.basic.function.ProjectionDescriptor;
import org.apache.wayang.basic.operators.GroupByOperator;
@@ -36,14 +35,18 @@
import org.apache.wayang.core.plan.wayangplan.UnarySource;
import org.apache.wayang.core.types.DataSetType;
import org.apache.wayang.core.types.DataUnitType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
/**
* Test suite for the {@link ReduceByMapping}.
*/
-public class ReduceByMappingTest {
+class ReduceByMappingTest {
@Test
- public void testMapping() {
+ void testMapping() {
// Construct a plan: source -> groupBy -> reduce -> sink.
UnarySource> source = new TestSource<>(DataSetType.createDefault(Tuple2.class));
@@ -83,10 +86,10 @@ public void testMapping() {
// Check that now we have this plan: source -> reduceBy -> sink.
final Operator finalSink = plan.getSinks().iterator().next();
final Operator inputOperator = finalSink.getEffectiveOccupant(0).getOwner();
- Assert.assertTrue(inputOperator instanceof ReduceByOperator);
+ assertInstanceOf(ReduceByOperator.class, inputOperator);
ReduceByOperator reduceBy = (ReduceByOperator) inputOperator;
- Assert.assertEquals(keyDescriptor, reduceBy.getKeyDescriptor());
- Assert.assertEquals(reduceDescriptor, reduceBy.getReduceDescriptor());
- Assert.assertEquals(source, reduceBy.getEffectiveOccupant(0).getOwner());
+ assertEquals(keyDescriptor, reduceBy.getKeyDescriptor());
+ assertEquals(reduceDescriptor, reduceBy.getReduceDescriptor());
+ assertEquals(source, reduceBy.getEffectiveOccupant(0).getOwner());
}
}
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/model/op/OpTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/model/op/OpTest.java
index d4af8aa26..3fa46c8a0 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/model/op/OpTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/model/op/OpTest.java
@@ -22,12 +22,12 @@
import org.apache.wayang.basic.model.op.nn.CrossEntropyLoss;
import org.apache.wayang.basic.model.op.nn.Linear;
import org.apache.wayang.basic.model.op.nn.ReLU;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class OpTest {
+class OpTest {
@Test
- public void testBuild() {
+ void testBuild() {
// model
Linear l1 = new Linear(4, 4, true, "l1");
ReLU r1 = new ReLU("r1");
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/MaterializedGroupByOperatorTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/MaterializedGroupByOperatorTest.java
index d5f21a791..f165798b4 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/MaterializedGroupByOperatorTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/MaterializedGroupByOperatorTest.java
@@ -18,20 +18,20 @@
package org.apache.wayang.basic.operators;
-import org.junit.Test;
import org.apache.wayang.core.function.TransformationDescriptor;
import org.apache.wayang.core.types.DataSetType;
import org.apache.wayang.core.types.DataUnitType;
+import org.junit.jupiter.api.Test;
import java.util.stream.StreamSupport;
/**
* Tests for the {@link MaterializedGroupByOperator}.
*/
-public class MaterializedGroupByOperatorTest {
+class MaterializedGroupByOperatorTest {
@Test
- public void testConnectingToMap() {
+ void testConnectingToMap() {
final MaterializedGroupByOperator materializedGroupByOperator =
new MaterializedGroupByOperator<>(String::length, String.class, Integer.class);
final MapOperator, Integer> mapOperator = new MapOperator<>(
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/TextFileSourceTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/TextFileSourceTest.java
index 83b78105c..a41821cc7 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/TextFileSourceTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/operators/TextFileSourceTest.java
@@ -22,8 +22,6 @@
import org.apache.wayang.commons.util.profiledb.instrumentation.StopWatch;
import org.apache.wayang.commons.util.profiledb.model.Experiment;
import org.apache.wayang.commons.util.profiledb.model.Subject;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.api.Job;
import org.apache.wayang.core.optimizer.DefaultOptimizationContext;
@@ -31,7 +29,7 @@
import org.apache.wayang.core.optimizer.cardinality.CardinalityEstimator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-
+import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
@@ -42,18 +40,19 @@
import java.net.URL;
import java.util.Optional;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Test suite for {@link TextFileSource}.
*/
-public class TextFileSourceTest {
+class TextFileSourceTest {
private final Logger logger = LogManager.getLogger(this.getClass());
@Test
- public void testCardinalityEstimation() throws URISyntaxException, IOException {
+ void testCardinalityEstimation() throws URISyntaxException, IOException {
Job job = mock(Job.class);
DefaultOptimizationContext optimizationContext = mock(DefaultOptimizationContext.class);
when(job.getOptimizationContext()).thenReturn(optimizationContext);
@@ -84,7 +83,7 @@ public void testCardinalityEstimation() throws URISyntaxException, IOException {
final Optional cardinalityEstimator = textFileSource
.createCardinalityEstimator(0, optimizationContext.getConfiguration());
- Assert.assertTrue(cardinalityEstimator.isPresent());
+ assertTrue(cardinalityEstimator.isPresent());
final CardinalityEstimate estimate = cardinalityEstimator.get().estimate(optimizationContext);
this.logger.info("Estimated between {} and {} lines in {} and counted {}.",
@@ -93,8 +92,8 @@ public void testCardinalityEstimation() throws URISyntaxException, IOException {
testFile,
numLineFeeds);
- Assert.assertTrue(estimate.getLowerEstimate() <= numLineFeeds);
- Assert.assertTrue(estimate.getUpperEstimate() >= numLineFeeds);
+ assertTrue(estimate.getLowerEstimate() <= numLineFeeds);
+ assertTrue(estimate.getUpperEstimate() >= numLineFeeds);
}
}
diff --git a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/types/RecordTypeTest.java b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/types/RecordTypeTest.java
index 9d8b4724e..7fccc2e1b 100644
--- a/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/types/RecordTypeTest.java
+++ b/wayang-commons/wayang-basic/src/test/java/org/apache/wayang/basic/types/RecordTypeTest.java
@@ -18,29 +18,31 @@
package org.apache.wayang.basic.types;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.basic.data.Record;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests for the {@link RecordType}.
*/
-public class RecordTypeTest {
+class RecordTypeTest {
@Test
- public void testSupertype() {
+ void testSupertype() {
DataSetType t1 = DataSetType.createDefault(Record.class);
DataSetType t2 = DataSetType.createDefault(new RecordType("a", "b"));
DataSetType t3 = DataSetType.createDefault(new RecordType("a", "b", "c"));
- Assert.assertTrue(t1.isSupertypeOf(t2));
- Assert.assertFalse(t2.isSupertypeOf(t1));
- Assert.assertTrue(t1.isSupertypeOf(t3));
- Assert.assertFalse(t3.isSupertypeOf(t1));
- Assert.assertTrue(t2.isSupertypeOf(t2));
- Assert.assertFalse(t2.isSupertypeOf(t3));
- Assert.assertTrue(t3.isSupertypeOf(t3));
- Assert.assertFalse(t3.isSupertypeOf(t2));
+ assertTrue(t1.isSupertypeOf(t2));
+ assertFalse(t2.isSupertypeOf(t1));
+ assertTrue(t1.isSupertypeOf(t3));
+ assertFalse(t3.isSupertypeOf(t1));
+ assertTrue(t2.isSupertypeOf(t2));
+ assertFalse(t2.isSupertypeOf(t3));
+ assertTrue(t3.isSupertypeOf(t3));
+ assertFalse(t3.isSupertypeOf(t2));
}
}
diff --git a/wayang-commons/wayang-core/pom.xml b/wayang-commons/wayang-core/pom.xml
index 784a54187..10157ec72 100644
--- a/wayang-commons/wayang-core/pom.xml
+++ b/wayang-commons/wayang-core/pom.xml
@@ -124,6 +124,12 @@
httpclient
4.5.13
+
+
+ org.junit.jupiter
+ junit-jupiter
+ test
+
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/SlotTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/SlotTest.java
index ebc8e8af2..112d20ce7 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/SlotTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/SlotTest.java
@@ -18,28 +18,31 @@
package org.apache.wayang.core;
-import org.junit.Test;
import org.apache.wayang.core.plan.wayangplan.Slot;
import org.apache.wayang.core.plan.wayangplan.test.TestSink;
import org.apache.wayang.core.plan.wayangplan.test.TestSource;
import org.apache.wayang.core.test.TestDataUnit;
import org.apache.wayang.core.test.TestDataUnit2;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Test suite for {@link Slot}s.
*/
-public class SlotTest {
+class SlotTest {
- @Test(expected = IllegalArgumentException.class)
- public void testConnectMismatchingSlotFails() {
+ @Test
+ void testConnectMismatchingSlotFails() {
TestSink testSink = new TestSink<>(DataSetType.createDefault(TestDataUnit.class));
TestSource testSource = new TestSource<>(DataSetType.createDefault(TestDataUnit2.class));
- testSource.connectTo(0, testSink, 0);
+ assertThrows(IllegalArgumentException.class, () ->
+ testSource.connectTo(0, testSink, 0));
}
@Test
- public void testConnectMatchingSlots() {
+ void testConnectMatchingSlots() {
TestSink testSink = new TestSink<>(DataSetType.createDefault(TestDataUnit.class));
TestSource testSource = new TestSource<>(DataSetType.createDefault(TestDataUnit.class));
testSource.connectTo(0, testSink, 0);
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/OperatorPatternTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/OperatorPatternTest.java
index 1cc7101e6..2d03674ff 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/OperatorPatternTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/OperatorPatternTest.java
@@ -18,29 +18,31 @@
package org.apache.wayang.core.mapping;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.test.DummyExecutionOperator;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Tests for {@link OperatorPattern}.
*/
-public class OperatorPatternTest {
+class OperatorPatternTest {
@Test
- public void testAdditionalTests() {
+ void testAdditionalTests() {
DummyExecutionOperator operator1 = new DummyExecutionOperator(1, 1, true);
DummyExecutionOperator operator2 = new DummyExecutionOperator(1, 1, true);
OperatorPattern pattern = new OperatorPattern<>("test", operator1, false);
// The pattern should, of course, now match the operators.
- Assert.assertNotNull(pattern.match(operator1));
- Assert.assertNotNull(pattern.match(operator2));
+ assertNotNull(pattern.match(operator1));
+ assertNotNull(pattern.match(operator2));
// The following test now should restrict the matching operators to operator1.
pattern.withAdditionalTest(op -> op == operator1);
- Assert.assertNotNull(pattern.match(operator1));
- Assert.assertNull(pattern.match(operator2));
+ assertNotNull(pattern.match(operator1));
+ assertNull(pattern.match(operator2));
}
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/PlanTransformationTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/PlanTransformationTest.java
index d98cbb8ce..9b09057b4 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/PlanTransformationTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/PlanTransformationTest.java
@@ -18,8 +18,6 @@
package org.apache.wayang.core.mapping;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.mapping.test.TestSinkToTestSink2Factory;
import org.apache.wayang.core.plan.wayangplan.Operator;
import org.apache.wayang.core.plan.wayangplan.OperatorAlternative;
@@ -31,14 +29,18 @@
import org.apache.wayang.core.plan.wayangplan.test.TestSource;
import org.apache.wayang.core.test.TestDataUnit;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
/**
* Test suite for the {@link org.apache.wayang.core.mapping.PlanTransformation} class.
*/
-public class PlanTransformationTest {
+class PlanTransformationTest {
@Test
- public void testReplace() {
+ void testReplace() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -58,14 +60,14 @@ public void testReplace() {
planTransformation.transform(plan, Operator.FIRST_EPOCH + 1);
// Check the correctness of the transformation.
- Assert.assertEquals(1, plan.getSinks().size());
+ assertEquals(1, plan.getSinks().size());
final Operator replacedSink = plan.getSinks().iterator().next();
- Assert.assertTrue(replacedSink instanceof TestSink2);
- Assert.assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
+ assertInstanceOf(TestSink2.class, replacedSink);
+ assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
}
@Test
- public void testIntroduceAlternative() {
+ void testIntroduceAlternative() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -85,18 +87,18 @@ public void testIntroduceAlternative() {
planTransformation.transform(plan, Operator.FIRST_EPOCH + 1);
// Check the correctness of the transformation.
- Assert.assertEquals(1, plan.getSinks().size());
+ assertEquals(1, plan.getSinks().size());
final Operator replacedSink = plan.getSinks().iterator().next();
- Assert.assertTrue(replacedSink instanceof OperatorAlternative);
+ assertInstanceOf(OperatorAlternative.class, replacedSink);
OperatorAlternative operatorAlternative = (OperatorAlternative) replacedSink;
- Assert.assertEquals(2, operatorAlternative.getAlternatives().size());
- Assert.assertTrue(operatorAlternative.getAlternatives().get(0).getContainedOperator() instanceof TestSink);
- Assert.assertTrue(operatorAlternative.getAlternatives().get(1).getContainedOperator() instanceof TestSink2);
- Assert.assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
+ assertEquals(2, operatorAlternative.getAlternatives().size());
+ assertInstanceOf(TestSink.class, operatorAlternative.getAlternatives().get(0).getContainedOperator());
+ assertInstanceOf(TestSink2.class, operatorAlternative.getAlternatives().get(1).getContainedOperator());
+ assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
}
@Test
- public void testFlatAlternatives() {
+ void testFlatAlternatives() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -117,15 +119,15 @@ public void testFlatAlternatives() {
planTransformation.transform(plan, Operator.FIRST_EPOCH + 1);
// Check the correctness of the transformation.
- Assert.assertEquals(1, plan.getSinks().size());
+ assertEquals(1, plan.getSinks().size());
final Operator replacedSink = plan.getSinks().iterator().next();
- Assert.assertTrue(replacedSink instanceof OperatorAlternative);
+ assertInstanceOf(OperatorAlternative.class, replacedSink);
OperatorAlternative operatorAlternative = (OperatorAlternative) replacedSink;
- Assert.assertEquals(3, operatorAlternative.getAlternatives().size());
- Assert.assertTrue(operatorAlternative.getAlternatives().get(0).getContainedOperator() instanceof TestSink);
- Assert.assertTrue(operatorAlternative.getAlternatives().get(1).getContainedOperator() instanceof TestSink2);
- Assert.assertTrue(operatorAlternative.getAlternatives().get(2).getContainedOperator() instanceof TestSink2);
- Assert.assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
+ assertEquals(3, operatorAlternative.getAlternatives().size());
+ assertInstanceOf(TestSink.class, operatorAlternative.getAlternatives().get(0).getContainedOperator());
+ assertInstanceOf(TestSink2.class, operatorAlternative.getAlternatives().get(1).getContainedOperator());
+ assertInstanceOf(TestSink2.class, operatorAlternative.getAlternatives().get(2).getContainedOperator());
+ assertEquals(source, replacedSink.getEffectiveOccupant(0).getOwner());
}
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/SubplanPatternTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/SubplanPatternTest.java
index dec530be0..cfd3b3ece 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/SubplanPatternTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/mapping/SubplanPatternTest.java
@@ -18,8 +18,6 @@
package org.apache.wayang.core.mapping;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.plan.wayangplan.Operator;
import org.apache.wayang.core.plan.wayangplan.WayangPlan;
import org.apache.wayang.core.plan.wayangplan.UnarySink;
@@ -28,16 +26,19 @@
import org.apache.wayang.core.plan.wayangplan.test.TestSource;
import org.apache.wayang.core.test.TestDataUnit;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.Test;
import java.util.List;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Test suite for the {@link SubplanPattern}.
*/
-public class SubplanPatternTest {
+class SubplanPatternTest {
@Test
- public void testMatchSinkPattern() {
+ void testMatchSinkPattern() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -53,13 +54,13 @@ public void testMatchSinkPattern() {
final List matches = subplanPattern.match(plan, Operator.FIRST_EPOCH);
// Evaluate the matches.
- Assert.assertEquals(1, matches.size());
+ assertEquals(1, matches.size());
final SubplanMatch match = matches.get(0);
- Assert.assertEquals(sink, match.getOperatorMatches().get("sink").getOperator());
+ assertEquals(sink, match.getOperatorMatches().get("sink").getOperator());
}
@Test
- public void testMatchSourcePattern() {
+ void testMatchSourcePattern() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -75,13 +76,13 @@ public void testMatchSourcePattern() {
final List matches = subplanPattern.match(plan, Operator.FIRST_EPOCH);
// Evaluate the matches.
- Assert.assertEquals(1, matches.size());
+ assertEquals(1, matches.size());
final SubplanMatch match = matches.get(0);
- Assert.assertEquals(source, match.getOperatorMatches().get("source").getOperator());
+ assertEquals(source, match.getOperatorMatches().get("source").getOperator());
}
@Test
- public void testMatchChainedPattern() {
+ void testMatchChainedPattern() {
// Build the plan.
UnarySource source = new TestSource(DataSetType.createDefault(TestDataUnit.class));
UnarySink sink = new TestSink(DataSetType.createDefault(TestDataUnit.class));
@@ -99,10 +100,10 @@ public void testMatchChainedPattern() {
final List matches = subplanPattern.match(plan, Operator.FIRST_EPOCH);
// Evaluate the matches.
- Assert.assertEquals(1, matches.size());
+ assertEquals(1, matches.size());
final SubplanMatch match = matches.get(0);
- Assert.assertEquals(source, match.getOperatorMatches().get("source").getOperator());
- Assert.assertEquals(sink, match.getOperatorMatches().get("sink").getOperator());
+ assertEquals(source, match.getOperatorMatches().get("source").getOperator());
+ assertEquals(sink, match.getOperatorMatches().get("sink").getOperator());
}
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/AggregatingCardinalityEstimatorTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/AggregatingCardinalityEstimatorTest.java
index e72d942d3..cfac1fe8c 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/AggregatingCardinalityEstimatorTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/AggregatingCardinalityEstimatorTest.java
@@ -18,23 +18,23 @@
package org.apache.wayang.core.optimizer.cardinality;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.optimizer.OptimizationContext;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Test suite for {@link AggregatingCardinalityEstimator}.
*/
-public class AggregatingCardinalityEstimatorTest {
+class AggregatingCardinalityEstimatorTest {
@Test
- public void testEstimate() {
+ void testEstimate() {
OptimizationContext optimizationContext = mock(OptimizationContext.class);
when(optimizationContext.getConfiguration()).thenReturn(new Configuration());
@@ -48,7 +48,7 @@ public void testEstimate() {
CardinalityEstimate outputEstimate = estimator.estimate(optimizationContext, inputEstimate);
CardinalityEstimate expectedEstimate = new CardinalityEstimate(2 * 10, 2 * 100, 0.3 * 0.9);
- Assert.assertEquals(expectedEstimate, outputEstimate);
+ assertEquals(expectedEstimate, outputEstimate);
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/DefaultCardinalityEstimatorTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/DefaultCardinalityEstimatorTest.java
index 44584a32c..fa9e08c59 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/DefaultCardinalityEstimatorTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/DefaultCardinalityEstimatorTest.java
@@ -21,9 +21,9 @@
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.function.FunctionDescriptor;
import org.apache.wayang.core.optimizer.OptimizationContext;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -31,10 +31,10 @@
/**
* Test suite for the {@link DefaultCardinalityEstimator}.
*/
-public class DefaultCardinalityEstimatorTest {
+class DefaultCardinalityEstimatorTest {
@Test
- public void testBinaryInputEstimation() {
+ void testBinaryInputEstimation() {
OptimizationContext optimizationContext = mock(OptimizationContext.class);
when(optimizationContext.getConfiguration()).thenReturn(new Configuration());
@@ -53,9 +53,9 @@ public void testBinaryInputEstimation() {
CardinalityEstimate estimate = estimator.estimate(optimizationContext, inputEstimate1, inputEstimate2);
- Assert.assertEquals(0.9 * 0.4, estimate.getCorrectnessProbability(), 0.001);
- Assert.assertEquals(singlePointEstimator.applyAsLong(new long[]{50, 10}), estimate.getLowerEstimate());
- Assert.assertEquals(singlePointEstimator.applyAsLong(new long[]{60, 100}), estimate.getUpperEstimate());
+ assertEquals(0.9 * 0.4, estimate.getCorrectnessProbability(), 0.001);
+ assertEquals(singlePointEstimator.applyAsLong(new long[]{50, 10}), estimate.getLowerEstimate());
+ assertEquals(singlePointEstimator.applyAsLong(new long[]{60, 100}), estimate.getUpperEstimate());
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/LoopSubplanCardinalityPusherTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/LoopSubplanCardinalityPusherTest.java
index 5a4583e2e..81c08936a 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/LoopSubplanCardinalityPusherTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/LoopSubplanCardinalityPusherTest.java
@@ -18,10 +18,9 @@
package org.apache.wayang.core.optimizer.cardinality;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+
import org.apache.wayang.core.api.Configuration;
+
import org.apache.wayang.core.api.Job;
import org.apache.wayang.core.api.configuration.FunctionalKeyValueProvider;
import org.apache.wayang.core.api.configuration.KeyValueProvider;
@@ -38,18 +37,24 @@
import org.apache.wayang.core.plan.wayangplan.test.TestSource;
import org.apache.wayang.core.test.MockFactory;
import org.apache.wayang.core.util.WayangCollections;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test suite for {@link LoopSubplanCardinalityPusher}.
*/
-public class LoopSubplanCardinalityPusherTest {
+class LoopSubplanCardinalityPusherTest {
private Job job;
private Configuration configuration;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
this.configuration = new Configuration();
KeyValueProvider, CardinalityEstimator> estimatorProvider =
new FunctionalKeyValueProvider<>(
@@ -66,7 +71,7 @@ public void setUp() {
}
@Test
- public void testWithSingleLoopAndSingleIteration() {
+ void testWithSingleLoopAndSingleIteration() {
TestLoopHead loopHead = new TestLoopHead<>(Integer.class);
loopHead.setNumExpectedIterations(1);
@@ -78,7 +83,7 @@ public void testWithSingleLoopAndSingleIteration() {
inLoopFilter.connectTo("out", loopHead, "loopInput");
final LoopSubplan loop = LoopIsolator.isolate(loopHead);
- Assert.assertNotNull(loop);
+ assertNotNull(loop);
OptimizationContext optimizationContext = new DefaultOptimizationContext(this.job, loop);
final OptimizationContext.OperatorContext loopCtx = optimizationContext.getOperatorContext(loop);
final CardinalityEstimate inputCardinality = new CardinalityEstimate(123, 321, 0.123d);
@@ -93,12 +98,12 @@ public void testWithSingleLoopAndSingleIteration() {
Math.round(inputCardinality.getUpperEstimate() * filterSelectivity),
inputCardinality.getCorrectnessProbability()
);
- Assert.assertEquals(expectedCardinality, loopCtx.getOutputCardinality(0));
+ assertEquals(expectedCardinality, loopCtx.getOutputCardinality(0));
}
@Test
- public void testWithSingleLoopAndManyIteration() {
+ void testWithSingleLoopAndManyIteration() {
TestLoopHead loopHead = new TestLoopHead<>(Integer.class);
loopHead.setNumExpectedIterations(1000);
@@ -110,7 +115,7 @@ public void testWithSingleLoopAndManyIteration() {
inLoopFilter.connectTo("out", loopHead, "loopInput");
final LoopSubplan loop = LoopIsolator.isolate(loopHead);
- Assert.assertNotNull(loop);
+ assertNotNull(loop);
OptimizationContext optimizationContext = new DefaultOptimizationContext(this.job, loop);
final OptimizationContext.OperatorContext loopCtx = optimizationContext.getOperatorContext(loop);
final CardinalityEstimate inputCardinality = new CardinalityEstimate(123, 321, 0.123d);
@@ -125,12 +130,12 @@ public void testWithSingleLoopAndManyIteration() {
Math.round(inputCardinality.getUpperEstimate() * Math.pow(filterSelectivity, 1000)),
inputCardinality.getCorrectnessProbability()
);
- Assert.assertTrue(expectedCardinality.equalsWithinDelta(loopCtx.getOutputCardinality(0), 0.0001, 1, 1));
+ assertTrue(expectedCardinality.equalsWithinDelta(loopCtx.getOutputCardinality(0), 0.0001, 1, 1));
}
@Test
- public void testWithSingleLoopWithConstantInput() {
+ void testWithSingleLoopWithConstantInput() {
TestSource mainSource = new TestSource<>(Integer.class);
TestSource sideSource = new TestSource<>(Integer.class);
@@ -146,7 +151,7 @@ public void testWithSingleLoopWithConstantInput() {
inLoopJoin.connectTo("out", loopHead, "loopInput");
final LoopSubplan loop = LoopIsolator.isolate(loopHead);
- Assert.assertNotNull(loop);
+ assertNotNull(loop);
OptimizationContext optimizationContext = new DefaultOptimizationContext(this.job, loop);
final OptimizationContext.OperatorContext loopCtx = optimizationContext.getOperatorContext(loop);
@@ -171,13 +176,13 @@ public void testWithSingleLoopWithConstantInput() {
* Math.pow(TestJoin.ESTIMATION_CERTAINTY, numIterations)
);
final CardinalityEstimate outputCardinality = loopCtx.getOutputCardinality(0);
- Assert.assertTrue(
- String.format("Expected %s, got %s.", expectedCardinality, outputCardinality),
- expectedCardinality.equalsWithinDelta(outputCardinality, 0.0001, 0, 0));
+ assertTrue(
+ expectedCardinality.equalsWithinDelta(outputCardinality, 0.0001, 0, 0),
+ String.format("Expected %s, got %s.", expectedCardinality, outputCardinality));
}
@Test
- public void testNestedLoops() {
+ void testNestedLoops() {
TestLoopHead outerLoopHead = new TestLoopHead<>(Integer.class);
outerLoopHead.setNumExpectedIterations(100);
@@ -197,9 +202,9 @@ public void testNestedLoops() {
inInnerLoopFilter.setSelectivity(0.1d);
LoopSubplan innerLoop = LoopIsolator.isolate(innerLoopHead);
- Assert.assertNotNull(innerLoop);
+ assertNotNull(innerLoop);
LoopSubplan outerLoop = LoopIsolator.isolate(outerLoopHead);
- Assert.assertNotNull(outerLoop);
+ assertNotNull(outerLoop);
OptimizationContext optimizationContext = new DefaultOptimizationContext(this.job, outerLoop);
final OptimizationContext.OperatorContext loopCtx = optimizationContext.getOperatorContext(outerLoop);
@@ -220,7 +225,7 @@ public void testNestedLoops() {
Math.round(inputCardinality.getUpperEstimate() * loopSelectivity),
inputCardinality.getCorrectnessProbability()
);
- Assert.assertTrue(expectedCardinality.equalsWithinDelta(loopCtx.getOutputCardinality(0), 0.0001, 1, 1));
+ assertTrue(expectedCardinality.equalsWithinDelta(loopCtx.getOutputCardinality(0), 0.0001, 1, 1));
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/SubplanCardinalityPusherTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/SubplanCardinalityPusherTest.java
index 60b194a06..ebe2fa4fa 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/SubplanCardinalityPusherTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/cardinality/SubplanCardinalityPusherTest.java
@@ -18,9 +18,6 @@
package org.apache.wayang.core.optimizer.cardinality;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.api.Job;
import org.apache.wayang.core.api.configuration.FunctionalKeyValueProvider;
@@ -35,18 +32,22 @@
import org.apache.wayang.core.plan.wayangplan.test.TestSource;
import org.apache.wayang.core.test.MockFactory;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test suite for {@link SubplanCardinalityPusher}.
*/
-public class SubplanCardinalityPusherTest {
+class SubplanCardinalityPusherTest {
private Job job;
private Configuration configuration;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
this.configuration = new Configuration();
KeyValueProvider, CardinalityEstimator> estimatorProvider =
new FunctionalKeyValueProvider<>(
@@ -64,7 +65,7 @@ public void setUp() {
@Test
- public void testSimpleSubplan() {
+ void testSimpleSubplan() {
TestMapOperator op1 = new TestMapOperator<>(
DataSetType.createDefault(String.class),
DataSetType.createDefault(String.class)
@@ -86,11 +87,11 @@ public void testSimpleSubplan() {
final CardinalityPusher pusher = SubplanCardinalityPusher.createFor(subplan, this.configuration);
pusher.push(subplanCtx, this.configuration);
- Assert.assertEquals(inputCardinality, subplanCtx.getOutputCardinality(0));
+ assertEquals(inputCardinality, subplanCtx.getOutputCardinality(0));
}
@Test
- public void testSourceSubplan() {
+ void testSourceSubplan() {
TestSource source = new TestSource<>(DataSetType.createDefault(String.class));
final CardinalityEstimate sourceCardinality = new CardinalityEstimate(123, 321, 0.123d);
source.setCardinalityEstimators((optimizationContext, inputEstimates) -> sourceCardinality);
@@ -109,12 +110,12 @@ public void testSourceSubplan() {
final CardinalityPusher pusher = SubplanCardinalityPusher.createFor(subplan, this.configuration);
pusher.push(subplanCtx, this.configuration);
- Assert.assertEquals(sourceCardinality, subplanCtx.getOutputCardinality(0));
+ assertEquals(sourceCardinality, subplanCtx.getOutputCardinality(0));
}
@Test
- public void testDAGShapedSubplan() {
+ void testDAGShapedSubplan() {
// _/-\_
// \ /
final DataSetType stringDataSetType = DataSetType.createDefault(String.class);
@@ -147,7 +148,7 @@ public void testDAGShapedSubplan() {
final CardinalityEstimate outputCardinality = subplanCtx.getOutputCardinality(0);
final CardinalityEstimate expectedCardinality = new CardinalityEstimate(10 * 10, 100 * 100, 0.9d * 0.7d);
- Assert.assertEquals(expectedCardinality, outputCardinality);
+ assertEquals(expectedCardinality, outputCardinality);
}
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/channels/ChannelConversionGraphTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/channels/ChannelConversionGraphTest.java
index 7013c6c99..4866a3400 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/channels/ChannelConversionGraphTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/channels/ChannelConversionGraphTest.java
@@ -18,9 +18,6 @@
package org.apache.wayang.core.optimizer.channels;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.api.Job;
import org.apache.wayang.core.optimizer.DefaultOptimizationContext;
@@ -38,14 +35,21 @@
import org.apache.wayang.core.test.DummyReusableChannel;
import org.apache.wayang.core.test.MockFactory;
import org.apache.wayang.core.util.WayangCollections;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.function.Supplier;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test suite for {@link ChannelConversionGraph}.
*/
-public class ChannelConversionGraphTest {
+class ChannelConversionGraphTest {
private static DefaultChannelConversion reusableToNonReusableChannelConversion;
@@ -69,8 +73,8 @@ private static Supplier createDummyExecutionOperatorFactory(C
};
}
- @BeforeClass
- public static void initializeChannelConversions() {
+ @BeforeAll
+ static void initializeChannelConversions() {
reusableToNonReusableChannelConversion = new DefaultChannelConversion(
DummyReusableChannel.DESCRIPTOR,
DummyNonReusableChannel.DESCRIPTOR,
@@ -102,7 +106,7 @@ public static void initializeChannelConversions() {
}
@Test
- public void findDirectConversion() throws Exception {
+ void findDirectConversion() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(configuration);
ExecutionOperator sourceOperator = new DummyExecutionOperator(0, 1, false);
@@ -128,7 +132,7 @@ public void findDirectConversion() throws Exception {
}
@Test
- public void findIntricateConversion() throws Exception {
+ void findIntricateConversion() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(new Configuration());
channelConversionGraph.add(reusableToNonReusableChannelConversion);
channelConversionGraph.add(nonReusableToReusableChannelConversion);
@@ -157,7 +161,7 @@ public void findIntricateConversion() throws Exception {
}
@Test
- public void findIntricateConversion2() throws Exception {
+ void findIntricateConversion2() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(new Configuration());
channelConversionGraph.add(reusableToNonReusableChannelConversion);
channelConversionGraph.add(nonReusableToReusableChannelConversion);
@@ -186,7 +190,7 @@ public void findIntricateConversion2() throws Exception {
}
@Test
- public void updateExistingConversionWithOnlySourceChannel() throws Exception {
+ void updateExistingConversionWithOnlySourceChannel() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(new Configuration());
channelConversionGraph.add(reusableToNonReusableChannelConversion);
channelConversionGraph.add(nonReusableToReusableChannelConversion);
@@ -215,19 +219,19 @@ public void updateExistingConversionWithOnlySourceChannel() throws Exception {
optimizationContext
);
- Assert.assertTrue(junction.getSourceChannel() == sourceChannel);
+ assertSame(junction.getSourceChannel(), sourceChannel);
final Channel targetChannel0 = junction.getTargetChannel(0);
- Assert.assertTrue(targetChannel0 instanceof DummyReusableChannel);
- Assert.assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel0).getOriginal() == sourceChannel);
+ assertInstanceOf(DummyReusableChannel.class, targetChannel0);
+ assertSame(OptimizationUtils.getPredecessorChannel(targetChannel0).getOriginal(), sourceChannel);
final Channel targetChannel1 = junction.getTargetChannel(1);
- Assert.assertTrue(targetChannel1 instanceof DummyExternalReusableChannel);
- Assert.assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel1) == targetChannel0);
+ assertInstanceOf(DummyExternalReusableChannel.class, targetChannel1);
+ assertSame(OptimizationUtils.getPredecessorChannel(targetChannel1), targetChannel0);
}
@Test
- public void updateExistingConversionWithReachedDestination() throws Exception {
+ void updateExistingConversionWithReachedDestination() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(new Configuration());
channelConversionGraph.add(reusableToNonReusableChannelConversion);
channelConversionGraph.add(nonReusableToReusableChannelConversion);
@@ -261,20 +265,20 @@ public void updateExistingConversionWithReachedDestination() throws Exception {
optimizationContext
);
- Assert.assertTrue(junction.getSourceChannel() == sourceChannel);
+ assertSame(junction.getSourceChannel(), sourceChannel);
final Channel targetChannel0 = junction.getTargetChannel(0);
- Assert.assertTrue(targetChannel0 == reusableChannel);
- Assert.assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel0) == sourceChannel);
+ assertSame(targetChannel0, reusableChannel);
+ assertSame(OptimizationUtils.getPredecessorChannel(targetChannel0), sourceChannel);
final Channel targetChannel1 = junction.getTargetChannel(1);
- Assert.assertTrue(targetChannel1 instanceof DummyExternalReusableChannel);
- Assert.assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel1).isCopy());
- Assert.assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel1).getOriginal() == targetChannel0);
+ assertInstanceOf(DummyExternalReusableChannel.class, targetChannel1);
+ assertTrue(OptimizationUtils.getPredecessorChannel(targetChannel1).isCopy());
+ assertSame(OptimizationUtils.getPredecessorChannel(targetChannel1).getOriginal(), targetChannel0);
}
@Test
- public void updateExistingConversionWithTwoOpenChannels() throws Exception {
+ void updateExistingConversionWithTwoOpenChannels() throws Exception {
ChannelConversionGraph channelConversionGraph = new ChannelConversionGraph(new Configuration());
channelConversionGraph.add(reusableToNonReusableChannelConversion);
channelConversionGraph.add(nonReusableToReusableChannelConversion);
@@ -305,18 +309,18 @@ public void updateExistingConversionWithTwoOpenChannels() throws Exception {
optimizationContext
);
- Assert.assertTrue(junction.getSourceChannel() == sourceChannel);
+ assertSame(junction.getSourceChannel(), sourceChannel);
- Assert.assertTrue(sourceChannel.getConsumers().size() == 1);
+ assertEquals(1, sourceChannel.getConsumers().size());
ExecutionTask consumer = WayangCollections.getAny(sourceChannel.getConsumers());
Channel nextChannel = consumer.getOutputChannel(0);
- Assert.assertTrue(nextChannel == reusableChannel);
- Assert.assertTrue(junction.getTargetChannel(0).isCopy() && junction.getTargetChannel(0).getOriginal() == nextChannel);
+ assertSame(nextChannel, reusableChannel);
+ assertTrue(junction.getTargetChannel(0).isCopy() && junction.getTargetChannel(0).getOriginal() == nextChannel);
consumer = WayangCollections.getSingle(nextChannel.getConsumers());
nextChannel = consumer.getOutputChannel(0);
- Assert.assertTrue(nextChannel == externalChannel);
- Assert.assertTrue(junction.getTargetChannel(1).isCopy() && junction.getTargetChannel(1).getOriginal() == nextChannel);
+ assertSame(nextChannel, externalChannel);
+ assertTrue(junction.getTargetChannel(1).isCopy() && junction.getTargetChannel(1).getOriginal() == nextChannel);
}
diff --git a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/costs/NestableLoadProfileEstimatorTest.java b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/costs/NestableLoadProfileEstimatorTest.java
index 62950211b..5fcf292b9 100644
--- a/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/costs/NestableLoadProfileEstimatorTest.java
+++ b/wayang-commons/wayang-core/src/test/java/org/apache/wayang/core/optimizer/costs/NestableLoadProfileEstimatorTest.java
@@ -18,9 +18,6 @@
package org.apache.wayang.core.optimizer.costs;
-import java.util.HashMap;
-import org.junit.Assert;
-import org.junit.Test;
import org.apache.wayang.core.optimizer.OptimizationUtils;
import org.apache.wayang.core.optimizer.cardinality.CardinalityEstimate;
import org.apache.wayang.core.plan.wayangplan.ExecutionOperator;
@@ -28,16 +25,20 @@
import org.apache.wayang.core.platform.ChannelDescriptor;
import org.apache.wayang.core.platform.Platform;
import org.apache.wayang.core.types.DataSetType;
+import org.junit.jupiter.api.Test;
+import java.util.HashMap;
import java.util.List;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* Tests for the {@link NestableLoadProfileEstimator}.
*/
-public class NestableLoadProfileEstimatorTest {
+class NestableLoadProfileEstimatorTest {
@Test
- public void testFromJuelSpecification() {
+ void testFromJuelSpecification() {
String specification = "{" +
"\"type\":\"juel\"," +
"\"in\":2," +
@@ -59,18 +60,18 @@ public void testFromJuelSpecification() {
1
));
- Assert.assertEquals(3 * 10 + 2 * 100 + 7 * 200, estimate.getCpuUsage().getLowerEstimate(), 0.01);
- Assert.assertEquals(3 * 10 + 2 * 100 + 7 * 300, estimate.getCpuUsage().getUpperEstimate(), 0.01);
- Assert.assertEquals(
+ assertEquals(3 * 10 + 2 * 100 + 7 * 200, estimate.getCpuUsage().getLowerEstimate(), 0.01);
+ assertEquals(3 * 10 + 2 * 100 + 7 * 300, estimate.getCpuUsage().getUpperEstimate(), 0.01);
+ assertEquals(
OptimizationUtils.logisticGrowth(0.1, 0.1, 10000, 100 + 10),
estimate.getResourceUtilization(),
0.000000001
);
- Assert.assertEquals(143, estimate.getOverheadMillis());
+ assertEquals(143, estimate.getOverheadMillis());
}
@Test
- public void testFromMathExSpecification() {
+ void testFromMathExSpecification() {
String specification = "{" +
"\"type\":\"mathex\"," +
"\"in\":2," +
@@ -92,18 +93,18 @@ public void testFromMathExSpecification() {
1
));
- Assert.assertEquals(3 * 10 + 2 * 100 + 7 * 200, estimate.getCpuUsage().getLowerEstimate(), 0.01);
- Assert.assertEquals(3 * 10 + 2 * 100 + 7 * 300, estimate.getCpuUsage().getUpperEstimate(), 0.01);
- Assert.assertEquals(
+ assertEquals(3 * 10 + 2 * 100 + 7 * 200, estimate.getCpuUsage().getLowerEstimate(), 0.01);
+ assertEquals(3 * 10 + 2 * 100 + 7 * 300, estimate.getCpuUsage().getUpperEstimate(), 0.01);
+ assertEquals(
OptimizationUtils.logisticGrowth(0.1, 0.1, 10000, 100 + 10),
estimate.getResourceUtilization(),
0.000000001
);
- Assert.assertEquals(143, estimate.getOverheadMillis());
+ assertEquals(143, estimate.getOverheadMillis());
}
@Test
- public void testFromJuelSpecificationWithImport() {
+ void testFromJuelSpecificationWithImport() {
String specification = "{" +
"\"in\":2," +
"\"out\":1," +
@@ -128,18 +129,18 @@ public void testFromJuelSpecificationWithImport() {
1
));
- Assert.assertEquals((3 * 10 + 2 * 100 + 7 * 200) * execOp.getNumIterations(), estimate.getCpuUsage().getLowerEstimate(), 0.01);
- Assert.assertEquals((3 * 10 + 2 * 100 + 7 * 300) * execOp.getNumIterations(), estimate.getCpuUsage().getUpperEstimate(), 0.01);
- Assert.assertEquals(
+ assertEquals((3 * 10 + 2 * 100 + 7 * 200) * execOp.getNumIterations(), estimate.getCpuUsage().getLowerEstimate(), 0.01);
+ assertEquals((3 * 10 + 2 * 100 + 7 * 300) * execOp.getNumIterations(), estimate.getCpuUsage().getUpperEstimate(), 0.01);
+ assertEquals(
OptimizationUtils.logisticGrowth(0.1, 0.1, 10000, 100 + 10),
estimate.getResourceUtilization(),
0.000000001
);
- Assert.assertEquals(143, estimate.getOverheadMillis());
+ assertEquals(143, estimate.getOverheadMillis());
}
@Test
- public void testMathExFromSpecificationWithImport() {
+ void testMathExFromSpecificationWithImport() {
String specification = "{" +
"\"type\":\"mathex\"," +
"\"in\":2," +
@@ -165,14 +166,14 @@ public void testMathExFromSpecificationWithImport() {
1
));
- Assert.assertEquals((3 * 10 + 2 * 100 + 7 * 200) * execOp.getNumIterations(), estimate.getCpuUsage().getLowerEstimate(), 0.01);
- Assert.assertEquals((3 * 10 + 2 * 100 + 7 * 300) * execOp.getNumIterations(), estimate.getCpuUsage().getUpperEstimate(), 0.01);
- Assert.assertEquals(
+ assertEquals((3 * 10 + 2 * 100 + 7 * 200) * execOp.getNumIterations(), estimate.getCpuUsage().getLowerEstimate(), 0.01);
+ assertEquals((3 * 10 + 2 * 100 + 7 * 300) * execOp.getNumIterations(), estimate.getCpuUsage().getUpperEstimate(), 0.01);
+ assertEquals(
OptimizationUtils.logisticGrowth(0.1, 0.1, 10000, 100 + 10),
estimate.getResourceUtilization(),
0.000000001
);
- Assert.assertEquals(143, estimate.getOverheadMillis());
+ assertEquals(143, estimate.getOverheadMillis());
}
public static class SomeOperator extends UnaryToUnaryOperator