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

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

                Author: ASF GitHub Bot
            Created on: 10/Dec/18 22:52
            Start Date: 10/Dec/18 22:52
    Worklog Time Spent: 10m 
      Work Description: kennknowles closed pull request #7179: [BEAM-3657] Port 
JoinExamplesTest off DoFnTester
URL: https://github.com/apache/beam/pull/7179
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesTest.java
 
b/examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesTest.java
index a5c9a33440c4..b91ca985ddcd 100644
--- 
a/examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesTest.java
+++ 
b/examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesTest.java
@@ -26,11 +26,9 @@
 import org.apache.beam.sdk.testing.TestPipeline;
 import org.apache.beam.sdk.testing.ValidatesRunner;
 import org.apache.beam.sdk.transforms.Create;
-import org.apache.beam.sdk.transforms.DoFnTester;
+import org.apache.beam.sdk.transforms.ParDo;
 import org.apache.beam.sdk.values.KV;
 import org.apache.beam.sdk.values.PCollection;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -62,12 +60,14 @@
   static final TableRow[] EVENTS = new TableRow[] {row1, row2, row3};
   static final List<TableRow> EVENT_ARRAY = Arrays.asList(EVENTS);
 
-  private static final KV<String, String> kv1 =
-      KV.of("VM", "Date: 20141212, Actor1: LAOS, url: 
http://www.chicagotribune.com";);
-  private static final KV<String, String> kv2 =
-      KV.of("BE", "Date: 20141213, Actor1: AFGHANISTAN, url: http://cnn.com";);
-  private static final KV<String, String> kv3 = KV.of("BE", "Belgium");
-  private static final KV<String, String> kv4 = KV.of("VM", "Vietnam");
+  private static final List<KV<String, String>> PARSED_EVENTS =
+      Arrays.asList(
+          KV.of("VM", "Date: 20141212, Actor1: LAOS, url: 
http://www.chicagotribune.com";),
+          KV.of("BE", "Date: 20141213, Actor1: AFGHANISTAN, url: 
http://cnn.com";),
+          KV.of("VM", "Date: 20141212, Actor1: BANGKOK, url: http://cnn.com";));
+
+  private static final List<KV<String, String>> PARSED_COUNTRY_CODES =
+      Arrays.asList(KV.of("BE", "Belgium"), KV.of("VM", "Vietnam"));
 
   private static final TableRow cc1 =
       new TableRow().set("FIPSCC", "VM").set("HumanName", "Vietnam");
@@ -90,20 +90,20 @@
 
   @Test
   public void testExtractEventDataFn() throws Exception {
-    DoFnTester<TableRow, KV<String, String>> extractEventDataFn =
-        DoFnTester.of(new ExtractEventDataFn());
-    List<KV<String, String>> results = 
extractEventDataFn.processBundle(EVENTS);
-    Assert.assertThat(results, CoreMatchers.hasItem(kv1));
-    Assert.assertThat(results, CoreMatchers.hasItem(kv2));
+    PCollection<KV<String, String>> output =
+        p.apply(Create.of(EVENT_ARRAY)).apply(ParDo.of(new 
ExtractEventDataFn()));
+
+    PAssert.that(output).containsInAnyOrder(PARSED_EVENTS);
+    p.run().waitUntilFinish();
   }
 
   @Test
   public void testExtractCountryInfoFn() throws Exception {
-    DoFnTester<TableRow, KV<String, String>> extractCountryInfoFn =
-        DoFnTester.of(new ExtractCountryInfoFn());
-    List<KV<String, String>> results = extractCountryInfoFn.processBundle(CCS);
-    Assert.assertThat(results, CoreMatchers.hasItem(kv3));
-    Assert.assertThat(results, CoreMatchers.hasItem(kv4));
+    PCollection<KV<String, String>> output =
+        p.apply(Create.of(CC_ARRAY)).apply(ParDo.of(new 
ExtractCountryInfoFn()));
+
+    PAssert.that(output).containsInAnyOrder(PARSED_COUNTRY_CODES);
+    p.run().waitUntilFinish();
   }
 
   @Test


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 173804)
    Time Spent: 1h 40m  (was: 1.5h)

> Port JoinExamplesTest off DoFnTester
> ------------------------------------
>
>                 Key: BEAM-3657
>                 URL: https://issues.apache.org/jira/browse/BEAM-3657
>             Project: Beam
>          Issue Type: Sub-task
>          Components: examples-java
>            Reporter: Kenneth Knowles
>            Assignee: Cade Markegard
>            Priority: Major
>              Labels: beginner, newbie, starter
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to