[ 
https://issues.apache.org/jira/browse/BEAM-12453?focusedWorklogId=611651&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-611651
 ]

ASF GitHub Bot logged work on BEAM-12453:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Jun/21 23:20
            Start Date: 15/Jun/21 23:20
    Worklog Time Spent: 10m 
      Work Description: PawasChhokra commented on a change in pull request 
#14945:
URL: https://github.com/apache/beam/pull/14945#discussion_r652221920



##########
File path: 
runners/samza/src/test/java/org/apache/beam/runners/samza/renderer/PipelineJsonRendererTest.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.samza.renderer;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.Sum;
+import org.apache.beam.sdk.transforms.windowing.FixedWindows;
+import org.apache.beam.sdk.transforms.windowing.Window;
+import org.apache.beam.sdk.values.KV;
+import org.apache.beam.sdk.values.TimestampedValue;
+import org.joda.time.Duration;
+import org.joda.time.Instant;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link PipelineJsonRenderer}. */
+@RunWith(JUnit4.class)
+public class PipelineJsonRendererTest {
+
+  static {
+    System.setProperty("beamUseDummyRunner", Boolean.TRUE.toString());
+  }
+
+  @Rule public final transient TestPipeline p = TestPipeline.create();
+
+  @Test
+  public void testEmptyPipeline() {
+    System.out.println(PipelineJsonRenderer.toJsonString(p));
+    assertEquals(
+        "{  \"RootNode\": ["
+            + "    { \"fullName\":\"OuterMostNode\","
+            + "      \"shortName\":\"OuterMostNode\","
+            + "      \"id\":\"OuterMostNode\","
+            + "      \"ChildNode\":[    ]}],\"graphLinks\": []"
+            + "}",
+        
PipelineJsonRenderer.toJsonString(p).replaceAll(System.lineSeparator(), ""));
+  }
+
+  @Test
+  public void testCompositePipeline() throws IOException {
+
+    p.apply(Create.timestamped(TimestampedValue.of(KV.of(1, 1), new 
Instant(1))))
+        .apply(Window.into(FixedWindows.of(Duration.millis(10))))
+        .apply(Sum.integersPerKey());
+
+    String jsonDagFileName = "src/test/resources/ExpectedDag.json";
+    String jsonDag =
+        new String(Files.readAllBytes(Paths.get(jsonDagFileName)), 
StandardCharsets.UTF_8);
+
+    assertEquals(
+        jsonDag.replaceAll("\\s+", "").replaceAll(",\"hashId\":\"[^\"]*\"", 
""),
+        PipelineJsonRenderer.toJsonString(p)
+            .replaceAll(System.lineSeparator(), "")
+            .replaceAll("\\s+", "")

Review comment:
       I have removed the \s comparison and instead comparing the json object 
now.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 611651)
    Time Spent: 3h 40m  (was: 3.5h)

> Create an interface inside Samza Beam Runner to get I/O information for a 
> Samza Beam job
> ----------------------------------------------------------------------------------------
>
>                 Key: BEAM-12453
>                 URL: https://issues.apache.org/jira/browse/BEAM-12453
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-samza
>            Reporter: Pawas Chhokra
>            Assignee: Pawas Chhokra
>            Priority: P2
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> This interface can be implemented for various kinds of I/O functionality used 
> by a Samza job.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to