jiangxin369 commented on code in PR #193:
URL: https://github.com/apache/flink-ml/pull/193#discussion_r1062297741


##########
flink-ml-benchmark/src/test/java/org/apache/flink/ml/benchmark/BenchmarkTest.java:
##########
@@ -54,6 +60,44 @@ public void testParseJsonFile() throws Exception {
         assertTrue(benchmarks.containsKey("KMeansModel-1"));
     }
 
+    @Test
+    public void testJsonFileLegality() throws IOException, 
ClassNotFoundException {
+        File resourcesDir =
+                new File(
+                                this.getClass()
+                                        .getClassLoader()
+                                        .getResource("benchmark-demo.json")
+                                        .getPath())
+                        .getParentFile();
+        File[] jsonFiles =
+                resourcesDir.listFiles(
+                        (dir, name) ->
+                                name.endsWith(".json") && 
!name.equals("benchmark-demo.json"));
+
+        for (File file : jsonFiles) {
+            Map<String, Map<String, Map<String, ?>>> benchmarks =
+                    BenchmarkUtils.parseJsonFile(file.getAbsolutePath());
+            for (Map<String, Map<String, ?>> params : benchmarks.values()) {
+                assertTrue(
+                        Arrays.asList("stage", "inputData", "modelData")
+                                .containsAll(params.keySet()));
+
+                WithParams stage = 
ReadWriteUtils.instantiateWithParams(params.get("stage"));
+                assertTrue(stage instanceof Stage);

Review Comment:
   An example stack trace is like this:
   ```
   java.lang.ClassCastException: 
org.apache.flink.ml.feature.imputer.ImputerTest cannot be cast to 
org.apache.flink.ml.api.Stage
        at 
org.apache.flink.ml.benchmark.BenchmarkTest.testJsonFileLegality(BenchmarkTest.java:137)
        at 
org.apache.flink.util.TestNameProvider$1.evaluate(TestNameProvider.java:45)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to