SteNicholas commented on a change in pull request #17873:
URL: https://github.com/apache/flink/pull/17873#discussion_r761901775



##########
File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
##########
@@ -577,6 +577,57 @@ public void invoke(Integer value, Context ctx) throws 
Exception {}
         env.getStreamGraph().getStreamingPlanAsJSON();
     }
 
+    @Test
+    public void testJsonGraphSlotSharingGroup() {
+        StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+        DataStream<Integer> source = env.fromElements(1, 2, 3);
+        DataStream<Integer> mapper = source.map(x -> x + 
1).slotSharingGroup("map");
+        mapper.addSink(
+                        new SinkFunction<Integer>() {
+                            @Override
+                            public void invoke(Integer value, Context ctx) 
throws Exception {}
+                        })
+                .slotSharingGroup("sink");
+
+        String jsonGraph =
+                "{\n"
+                        + "  \"nodes\" : [ {\n"
+                        + "    \"id\" : 43,\n"
+                        + "    \"type\" : \"Source: Collection Source\",\n"
+                        + "    \"pact\" : \"Data Source\",\n"
+                        + "    \"slot_sharing_group\" : \"default\",\n"
+                        + "    \"contents\" : \"Source: Collection Source\",\n"
+                        + "    \"parallelism\" : 1\n"
+                        + "  }, {\n"
+                        + "    \"id\" : 44,\n"
+                        + "    \"type\" : \"Map\",\n"
+                        + "    \"pact\" : \"Operator\",\n"
+                        + "    \"slot_sharing_group\" : \"map\",\n"
+                        + "    \"contents\" : \"Map\",\n"
+                        + "    \"parallelism\" : 16,\n"
+                        + "    \"predecessors\" : [ {\n"
+                        + "      \"id\" : 43,\n"
+                        + "      \"ship_strategy\" : \"REBALANCE\",\n"
+                        + "      \"side\" : \"second\"\n"
+                        + "    } ]\n"
+                        + "  }, {\n"
+                        + "    \"id\" : 45,\n"
+                        + "    \"type\" : \"Sink: Unnamed\",\n"
+                        + "    \"pact\" : \"Data Sink\",\n"
+                        + "    \"slot_sharing_group\" : \"sink\",\n"
+                        + "    \"contents\" : \"Sink: Unnamed\",\n"
+                        + "    \"parallelism\" : 16,\n"
+                        + "    \"predecessors\" : [ {\n"
+                        + "      \"id\" : 44,\n"
+                        + "      \"ship_strategy\" : \"FORWARD\",\n"
+                        + "      \"side\" : \"second\"\n"
+                        + "    } ]\n"
+                        + "  } ]\n"
+                        + "}";
+
+        assertEquals(jsonGraph, env.getStreamGraph().getStreamingPlanAsJSON());

Review comment:
       Could this only verify the `slot_sharing_group` of the JSON string, not 
the total JSON string?




-- 
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: [email protected]

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


Reply via email to