You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/08/04 01:26:12 UTC

[04/19] incubator-beam git commit: Rename NoOpDoFn to NoOpOldDoFn

Rename NoOpDoFn to NoOpOldDoFn


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/e1609664
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/e1609664
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/e1609664

Branch: refs/heads/master
Commit: e16096648fa92e72822dc02dd1958f5e53fd6fa0
Parents: a64baf4
Author: Kenneth Knowles <kl...@google.com>
Authored: Mon Jul 25 21:27:02 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Wed Aug 3 18:25:52 2016 -0700

----------------------------------------------------------------------
 .../DoFnDelegatingAggregatorTest.java           |  10 +-
 .../sdk/transforms/DoFnWithContextTest.java     |   2 +-
 .../apache/beam/sdk/transforms/NoOpDoFn.java    | 144 -------------------
 .../apache/beam/sdk/transforms/NoOpOldDoFn.java | 144 +++++++++++++++++++
 .../beam/sdk/transforms/OldDoFnContextTest.java |   2 +-
 .../apache/beam/sdk/transforms/OldDoFnTest.java |  12 +-
 6 files changed, 157 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnDelegatingAggregatorTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnDelegatingAggregatorTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnDelegatingAggregatorTest.java
index 2488042..4e8d06c 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnDelegatingAggregatorTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnDelegatingAggregatorTest.java
@@ -54,7 +54,7 @@ public class DoFnDelegatingAggregatorTest {
 
   @Test
   public void testAddValueWithoutDelegateThrowsException() {
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     String name = "agg";
     CombineFn<Double, ?, Double> combiner = mockCombineFn(Double.class);
@@ -74,7 +74,7 @@ public class DoFnDelegatingAggregatorTest {
     String name = "agg";
     CombineFn<Long, ?, Long> combiner = mockCombineFn(Long.class);
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     DelegatingAggregator<Long, Long> aggregator =
         (DelegatingAggregator<Long, Long>) doFn.createAggregator(name, combiner);
@@ -91,7 +91,7 @@ public class DoFnDelegatingAggregatorTest {
     String name = "agg";
     CombineFn<Double, ?, Double> combiner = mockCombineFn(Double.class);
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     DelegatingAggregator<Double, Double> aggregator =
         (DelegatingAggregator<Double, Double>) doFn.createAggregator(name, combiner);
@@ -114,7 +114,7 @@ public class DoFnDelegatingAggregatorTest {
     String name = "agg";
     CombineFn<Double, ?, Double> combiner = mockCombineFn(Double.class);
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     DelegatingAggregator<Double, Double> aggregator =
         (DelegatingAggregator<Double, Double>) doFn.createAggregator(name, combiner);
@@ -127,7 +127,7 @@ public class DoFnDelegatingAggregatorTest {
     String name = "agg";
     CombineFn<Double, ?, Double> combiner = mockCombineFn(Double.class);
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     DelegatingAggregator<Double, Double> aggregator =
         (DelegatingAggregator<Double, Double>) doFn.createAggregator(name, combiner);

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnWithContextTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnWithContextTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnWithContextTest.java
index 8b00c03..0a910b8 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnWithContextTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/DoFnWithContextTest.java
@@ -141,7 +141,7 @@ public class DoFnWithContextTest implements Serializable {
 
   @Test
   public void testDoFnWithContextUsingAggregators() {
-    NoOpDoFn<Object, Object> noOpFn = new NoOpDoFn<>();
+    NoOpOldDoFn<Object, Object> noOpFn = new NoOpOldDoFn<>();
     OldDoFn<Object, Object>.Context context = noOpFn.context();
 
     OldDoFn<Object, Object> fn = spy(noOpFn);

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpDoFn.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpDoFn.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpDoFn.java
deleted file mode 100644
index 5c43755..0000000
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpDoFn.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.sdk.transforms;
-
-import org.apache.beam.sdk.options.PipelineOptions;
-import org.apache.beam.sdk.transforms.Combine.CombineFn;
-import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
-import org.apache.beam.sdk.transforms.windowing.PaneInfo;
-import org.apache.beam.sdk.util.WindowingInternals;
-import org.apache.beam.sdk.values.PCollectionView;
-import org.apache.beam.sdk.values.TupleTag;
-
-import org.joda.time.Instant;
-
-/**
- * A {@link OldDoFn} that does nothing with provided elements. Used for testing
- * methods provided by the OldDoFn abstract class.
- *
- * @param <InputT> unused.
- * @param <OutputT> unused.
- */
-class NoOpDoFn<InputT, OutputT> extends OldDoFn<InputT, OutputT> {
-  @Override
-  public void processElement(OldDoFn<InputT, OutputT>.ProcessContext c) throws Exception {
-  }
-
-  /**
-   * Returns a new NoOp Context.
-   */
-  public OldDoFn<InputT, OutputT>.Context context() {
-    return new NoOpDoFnContext();
-  }
-
-  /**
-   * Returns a new NoOp Process Context.
-   */
-  public OldDoFn<InputT, OutputT>.ProcessContext processContext() {
-    return new NoOpDoFnProcessContext();
-  }
-
-  /**
-   * A {@link OldDoFn.Context} that does nothing and returns exclusively null.
-   */
-  private class NoOpDoFnContext extends OldDoFn<InputT, OutputT>.Context {
-    @Override
-    public PipelineOptions getPipelineOptions() {
-      return null;
-    }
-    @Override
-    public void output(OutputT output) {
-    }
-    @Override
-    public void outputWithTimestamp(OutputT output, Instant timestamp) {
-    }
-    @Override
-    public <T> void sideOutput(TupleTag<T> tag, T output) {
-    }
-    @Override
-    public <T> void sideOutputWithTimestamp(TupleTag<T> tag, T output,
-        Instant timestamp) {
-    }
-    @Override
-    protected <AggInputT, AggOutputT> Aggregator<AggInputT, AggOutputT>
-        createAggregatorInternal(String name, CombineFn<AggInputT, ?, AggOutputT> combiner) {
-      return null;
-    }
-  }
-
-  /**
-   * A {@link OldDoFn.ProcessContext} that does nothing and returns exclusively
-   * null.
-   */
-  private class NoOpDoFnProcessContext extends OldDoFn<InputT, OutputT>.ProcessContext {
-    @Override
-    public InputT element() {
-      return null;
-    }
-
-    @Override
-    public <T> T sideInput(PCollectionView<T> view) {
-      return null;
-    }
-
-    @Override
-    public Instant timestamp() {
-      return null;
-    }
-
-    @Override
-    public BoundedWindow window() {
-      return null;
-    }
-
-    @Override
-    public PaneInfo pane() {
-      return null;
-    }
-
-    @Override
-    public WindowingInternals<InputT, OutputT> windowingInternals() {
-      return null;
-    }
-
-    @Override
-    public PipelineOptions getPipelineOptions() {
-      return null;
-    }
-
-    @Override
-    public void output(OutputT output) {}
-
-    @Override
-    public void outputWithTimestamp(OutputT output, Instant timestamp) {}
-
-    @Override
-    public <T> void sideOutput(TupleTag<T> tag, T output) {}
-
-    @Override
-    public <T> void sideOutputWithTimestamp(TupleTag<T> tag, T output,
-        Instant timestamp) {}
-
-    @Override
-    protected <AggInputT, AggOutputT> Aggregator<AggInputT, AggOutputT>
-        createAggregatorInternal(String name, CombineFn<AggInputT, ?, AggOutputT> combiner) {
-      return null;
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpOldDoFn.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpOldDoFn.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpOldDoFn.java
new file mode 100644
index 0000000..8f2bd5e
--- /dev/null
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/NoOpOldDoFn.java
@@ -0,0 +1,144 @@
+/*
+ * 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.sdk.transforms;
+
+import org.apache.beam.sdk.options.PipelineOptions;
+import org.apache.beam.sdk.transforms.Combine.CombineFn;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.transforms.windowing.PaneInfo;
+import org.apache.beam.sdk.util.WindowingInternals;
+import org.apache.beam.sdk.values.PCollectionView;
+import org.apache.beam.sdk.values.TupleTag;
+
+import org.joda.time.Instant;
+
+/**
+ * A {@link OldDoFn} that does nothing with provided elements. Used for testing
+ * methods provided by the OldDoFn abstract class.
+ *
+ * @param <InputT> unused.
+ * @param <OutputT> unused.
+ */
+class NoOpOldDoFn<InputT, OutputT> extends OldDoFn<InputT, OutputT> {
+  @Override
+  public void processElement(OldDoFn<InputT, OutputT>.ProcessContext c) throws Exception {
+  }
+
+  /**
+   * Returns a new NoOp Context.
+   */
+  public OldDoFn<InputT, OutputT>.Context context() {
+    return new NoOpDoFnContext();
+  }
+
+  /**
+   * Returns a new NoOp Process Context.
+   */
+  public OldDoFn<InputT, OutputT>.ProcessContext processContext() {
+    return new NoOpDoFnProcessContext();
+  }
+
+  /**
+   * A {@link OldDoFn.Context} that does nothing and returns exclusively null.
+   */
+  private class NoOpDoFnContext extends OldDoFn<InputT, OutputT>.Context {
+    @Override
+    public PipelineOptions getPipelineOptions() {
+      return null;
+    }
+    @Override
+    public void output(OutputT output) {
+    }
+    @Override
+    public void outputWithTimestamp(OutputT output, Instant timestamp) {
+    }
+    @Override
+    public <T> void sideOutput(TupleTag<T> tag, T output) {
+    }
+    @Override
+    public <T> void sideOutputWithTimestamp(TupleTag<T> tag, T output,
+        Instant timestamp) {
+    }
+    @Override
+    protected <AggInputT, AggOutputT> Aggregator<AggInputT, AggOutputT>
+        createAggregatorInternal(String name, CombineFn<AggInputT, ?, AggOutputT> combiner) {
+      return null;
+    }
+  }
+
+  /**
+   * A {@link OldDoFn.ProcessContext} that does nothing and returns exclusively
+   * null.
+   */
+  private class NoOpDoFnProcessContext extends OldDoFn<InputT, OutputT>.ProcessContext {
+    @Override
+    public InputT element() {
+      return null;
+    }
+
+    @Override
+    public <T> T sideInput(PCollectionView<T> view) {
+      return null;
+    }
+
+    @Override
+    public Instant timestamp() {
+      return null;
+    }
+
+    @Override
+    public BoundedWindow window() {
+      return null;
+    }
+
+    @Override
+    public PaneInfo pane() {
+      return null;
+    }
+
+    @Override
+    public WindowingInternals<InputT, OutputT> windowingInternals() {
+      return null;
+    }
+
+    @Override
+    public PipelineOptions getPipelineOptions() {
+      return null;
+    }
+
+    @Override
+    public void output(OutputT output) {}
+
+    @Override
+    public void outputWithTimestamp(OutputT output, Instant timestamp) {}
+
+    @Override
+    public <T> void sideOutput(TupleTag<T> tag, T output) {}
+
+    @Override
+    public <T> void sideOutputWithTimestamp(TupleTag<T> tag, T output,
+        Instant timestamp) {}
+
+    @Override
+    protected <AggInputT, AggOutputT> Aggregator<AggInputT, AggOutputT>
+        createAggregatorInternal(String name, CombineFn<AggInputT, ?, AggOutputT> combiner) {
+      return null;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnContextTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnContextTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnContextTest.java
index 9234ccb..b2d4aed 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnContextTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnContextTest.java
@@ -46,7 +46,7 @@ public class OldDoFnContextTest {
 
     // Need to be real objects to call the constructor, and to reference the
     // outer instance of OldDoFn
-    NoOpDoFn<Object, Object> noOpFn = new NoOpDoFn<>();
+    NoOpOldDoFn<Object, Object> noOpFn = new NoOpOldDoFn<>();
     OldDoFn<Object, Object>.Context noOpContext = noOpFn.context();
 
     fn = spy(noOpFn);

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/e1609664/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnTest.java
index 49f4366..9d144b3 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/OldDoFnTest.java
@@ -60,7 +60,7 @@ public class OldDoFnTest implements Serializable {
     String name = "testAggregator";
     Sum.SumLongFn combiner = new Sum.SumLongFn();
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     Aggregator<Long, Long> aggregator = doFn.createAggregator(name, combiner);
 
@@ -73,7 +73,7 @@ public class OldDoFnTest implements Serializable {
     thrown.expect(NullPointerException.class);
     thrown.expectMessage("name cannot be null");
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     doFn.createAggregator(null, new Sum.SumLongFn());
   }
@@ -85,7 +85,7 @@ public class OldDoFnTest implements Serializable {
     thrown.expect(NullPointerException.class);
     thrown.expectMessage("combiner cannot be null");
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     doFn.createAggregator("testAggregator", combiner);
   }
@@ -97,7 +97,7 @@ public class OldDoFnTest implements Serializable {
     thrown.expect(NullPointerException.class);
     thrown.expectMessage("combiner cannot be null");
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     doFn.createAggregator("testAggregator", combiner);
   }
@@ -107,7 +107,7 @@ public class OldDoFnTest implements Serializable {
     String name = "testAggregator";
     CombineFn<Double, ?, Double> combiner = new Max.MaxDoubleFn();
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     doFn.createAggregator(name, combiner);
 
@@ -125,7 +125,7 @@ public class OldDoFnTest implements Serializable {
     String nameTwo = "aggregatorPrime";
     CombineFn<Double, ?, Double> combiner = new Max.MaxDoubleFn();
 
-    OldDoFn<Void, Void> doFn = new NoOpDoFn<>();
+    OldDoFn<Void, Void> doFn = new NoOpOldDoFn<>();
 
     Aggregator<Double, Double> aggregatorOne =
         doFn.createAggregator(nameOne, combiner);