You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/03/06 04:24:09 UTC

[GitHub] [beam] chamikaramj commented on a change in pull request #14141: [BEAM-10861] Add RunnerImplementedSource and RunnerImplementedSink to Pubsub

chamikaramj commented on a change in pull request #14141:
URL: https://github.com/apache/beam/pull/14141#discussion_r588703004



##########
File path: model/pipeline/src/main/proto/beam_runner_api.proto
##########
@@ -393,8 +393,8 @@ message StandardPTransforms {
     // https://s.apache.org/beam-runner-api-combine-model#heading=h.h5697l1scd9x
     // Payload: CombinePayload
     COMBINE_PER_KEY_CONVERT_TO_ACCUMULATORS = 4
-        [(beam_urn) =
-             "beam:transform:combine_per_key_convert_to_accumulators:v1"];
+    [(beam_urn) =

Review comment:
       +1

##########
File path: sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsub/RunnerImplementedSourceTranslationTest.java
##########
@@ -0,0 +1,221 @@
+/*
+ * 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.io.gcp.pubsub;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import org.apache.beam.model.pipeline.v1.RunnerApi;
+import org.apache.beam.model.pipeline.v1.RunnerApi.PubSubReadPayload;
+import org.apache.beam.runners.core.construction.Environments;
+import org.apache.beam.runners.core.construction.PTransformTranslation;
+import org.apache.beam.runners.core.construction.SdkComponents;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.TopicPath;
+import org.apache.beam.sdk.io.gcp.pubsub.RunnerImplementedSourceTranslation.RunnerImplementedSourceTranslator;
+import org.apache.beam.sdk.options.ValueProvider;
+import org.apache.beam.sdk.options.ValueProvider.NestedValueProvider;
+import org.apache.beam.sdk.options.ValueProvider.StaticValueProvider;
+import org.apache.beam.sdk.runners.AppliedPTransform;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PValues;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+/** Test RunnerImplementedSourceTranslator. */
+@RunWith(Parameterized.class)
+public class RunnerImplementedSourceTranslationTest {
+  private static final String TIMESTAMP_ATTRIBUTE = "timestamp";
+  private static final String ID_ATTRIBUTE = "id";
+  private static final String PROJECT = "project";
+  private static final TopicPath TOPIC = PubsubClient.topicPathFromName(PROJECT, "testTopic");
+  private static final SubscriptionPath SUBSCRIPTION =
+      PubsubClient.subscriptionPathFromName(PROJECT, "testSubscription");
+  private final RunnerImplementedSourceTranslator sourceTranslator =
+      new RunnerImplementedSourceTranslator();
+
+  public static TestPipeline pipeline = TestPipeline.create().enableAbandonedNodeEnforcement(false);
+  private static final ValueProvider<TopicPath> TOPIC_PROVIDER = pipeline.newProvider(TOPIC);
+  private static final ValueProvider<SubscriptionPath> SUBSCRIPTION_PROVIDER =
+      pipeline.newProvider(SUBSCRIPTION);
+
+  @Parameters
+  public static Iterable<Object[]> data() {
+    return Arrays.asList(
+        new Object[][] {
+          {
+            new RunnerImplementedSource(

Review comment:
       Probably add a comment describing each of these test data.




----------------------------------------------------------------
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:
users@infra.apache.org