alnzng commented on a change in pull request #1381:
URL: https://github.com/apache/samza/pull/1381#discussion_r438533644



##########
File path: 
samza-core/src/test/java/org/apache/samza/execution/TestJobGraphJsonGenerator.java
##########
@@ -368,4 +373,41 @@ String getCountry() {
       return "";
     }
   }
+
+  @Test
+  public void testOperatorToMapForTable() {
+    JobGraphJsonGenerator jsonGenerator = new JobGraphJsonGenerator();
+    Map<String, Object> map;
+    SendToTableOperatorSpec<Object, Object> sendToTableOperatorSpec =
+        OperatorSpecs.createSendToTableOperatorSpec("test-sent-to-table", 
"test-sent-to");
+    map = jsonGenerator.operatorToMap(sendToTableOperatorSpec);
+    assertTrue(map.containsKey("tableId"));
+    assertEquals(map.get("tableId"), "test-sent-to-table");
+    assertEquals(map.get("opCode"), OperatorSpec.OpCode.SEND_TO.name());
+    assertEquals(map.get("opId"), "test-sent-to");
+    StreamTableJoinOperatorSpec<String, String, String, String> 
streamTableJoinOperatorSpec =
+        OperatorSpecs.createStreamTableJoinOperatorSpec("test-join-table", new 
TestStreamTableJoinFunction(),
+            "test-join");
+    map = jsonGenerator.operatorToMap(streamTableJoinOperatorSpec);
+    assertTrue(map.containsKey("tableId"));
+    assertEquals(map.get("tableId"), "test-join-table");
+    assertEquals(map.get("opCode"), OperatorSpec.OpCode.JOIN.name());
+    assertEquals(map.get("opId"), "test-join");
+  }
+
+  private class TestStreamTableJoinFunction implements 
StreamTableJoinFunction<String, String, String, String> {
+    @Override
+    public String apply(String message, String record) {
+      return null;
+    }
+    @Override
+    public String getMessageKey(String message) {
+      return null;
+    }
+    @Override
+    public String getRecordKey(String record) {
+      return null;
+    }
+  }

Review comment:
       ah, good catch! Mock `StreamTableJoinFunction ` is a good idea, as we 
can remove those dummy codes.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to