beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [8/9] beam git commit: Renames PubsubIO.Write builder methods to be style guide compliant
Date Sat, 29 Apr 2017 22:32:00 GMT
Renames PubsubIO.Write builder methods to be style guide compliant


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

Branch: refs/heads/master
Commit: 42c975ee533a63be750da2e8de1925b42efd2cad
Parents: df6ef96
Author: Eugene Kirpichov <kirpichov@google.com>
Authored: Thu Apr 20 17:41:48 2017 -0700
Committer: Eugene Kirpichov <kirpichov@google.com>
Committed: Sat Apr 29 13:15:48 2017 -0700

----------------------------------------------------------------------
 .../org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java     | 12 ++++++------
 .../org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/42c975ee/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
index 5702af1..99df3c6 100644
--- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
+++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
@@ -742,14 +742,14 @@ public class PubsubIO {
      * <p>See {@link PubsubIO.PubsubTopic#fromPath(String)} for more details on the
format of the
      * {@code topic} string.
      */
-    public Write<T> topic(String topic) {
-      return topic(StaticValueProvider.of(topic));
+    public Write<T> to(String topic) {
+      return to(StaticValueProvider.of(topic));
     }
 
     /**
      * Like {@code topic()} but with a {@link ValueProvider}.
      */
-    public Write<T> topic(ValueProvider<String> topic) {
+    public Write<T> to(ValueProvider<String> topic) {
       return toBuilder()
           .setTopicProvider(NestedValueProvider.of(topic, new TopicTranslator()))
           .build();
@@ -765,7 +765,7 @@ public class PubsubIO {
      * {@link PubsubIO.Read#withTimestampLabel(String)} can be used to ensure the other source
reads
      * these timestamps from the appropriate attribute.
      */
-    public Write<T> timestampLabel(String timestampLabel) {
+    public Write<T> withTimestampLabel(String timestampLabel) {
       return toBuilder().setTimestampLabel(timestampLabel).build();
     }
 
@@ -777,7 +777,7 @@ public class PubsubIO {
      * {@link PubsubIO.Read#withIdLabel(String)} can be used to ensure that* the other source
reads
      * these unique identifiers from the appropriate attribute.
      */
-    public Write<T> idLabel(String idLabel) {
+    public Write<T> withIdLabel(String idLabel) {
       return toBuilder().setIdLabel(idLabel).build();
     }
 
@@ -794,7 +794,7 @@ public class PubsubIO {
      * function translates the input type T to a PubsubMessage object, which is used by the
sink
      * to separately set the PubSub message's payload and attributes.
      */
-    public Write<T> withAttributes(SimpleFunction<T, PubsubMessage> formatFn)
{
+    public Write<T> withFormatFn(SimpleFunction<T, PubsubMessage> formatFn) {
       return toBuilder().setFormatFn(formatFn).build();
     }
 

http://git-wip-us.apache.org/repos/asf/beam/blob/42c975ee/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java
b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java
index 69d989f..f896bfc 100644
--- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java
+++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIOTest.java
@@ -52,7 +52,7 @@ public class PubsubIOTest {
     assertEquals("PubsubIO.Read",
         PubsubIO.<String>read().fromTopic("projects/myproject/topics/mytopic").getName());
     assertEquals("PubsubIO.Write",
-        PubsubIO.<String>write().topic("projects/myproject/topics/mytopic").getName());
+        PubsubIO.<String>write().to("projects/myproject/topics/mytopic").getName());
   }
 
   @Test
@@ -168,9 +168,9 @@ public class PubsubIOTest {
   public void testWriteDisplayData() {
     String topic = "projects/project/topics/topic";
     PubsubIO.Write<?> write = PubsubIO.<String>write()
-        .topic(topic)
-        .timestampLabel("myTimestamp")
-        .idLabel("myId");
+        .to(topic)
+        .withTimestampLabel("myTimestamp")
+        .withIdLabel("myId");
 
     DisplayData displayData = DisplayData.from(write);
 
@@ -183,7 +183,7 @@ public class PubsubIOTest {
   @Category(ValidatesRunner.class)
   public void testPrimitiveWriteDisplayData() {
     DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
-    PubsubIO.Write<?> write = PubsubIO.<String>write().topic("projects/project/topics/topic");
+    PubsubIO.Write<?> write = PubsubIO.<String>write().to("projects/project/topics/topic");
 
     Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(write);
     assertThat("PubsubIO.Write should include the topic in its primitive display data",


Mime
View raw message