chamikaramj commented on code in PR #33026:
URL: https://github.com/apache/beam/pull/33026#discussion_r1831444171


##########
sdks/java/expansion-service/src/test/java/org/apache/beam/sdk/expansion/service/ExpansionServiceTest.java:
##########
@@ -146,6 +206,58 @@ public void testConstruct() {
     }
   }
 
+  @Test
+  public void testConstructWithPipelineOptions() {
+    PipelineOptionsFactory.register(TestOptions.class);
+    Pipeline p = Pipeline.create();
+    p.apply(Impulse.create());
+    RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p);
+    String inputPcollId =
+        Iterables.getOnlyElement(
+            
Iterables.getOnlyElement(pipelineProto.getComponents().getTransformsMap().values())
+                .getOutputsMap()
+                .values());
+
+    Struct optionsStruct =
+        Struct.newBuilder()
+            .putFields(
+                PIPELINE_OPTIONS_URN_PREFIX + "string_option" + 
PIPELINE_OPTIONS_URN_SUFFIX,
+                Value.newBuilder()
+                    
.setStringValue(TestTransformRegistrar.EXPECTED_STRING_VALUE)
+                    .build())
+            .putFields(
+                PIPELINE_OPTIONS_URN_PREFIX + "boolean_option" + 
PIPELINE_OPTIONS_URN_SUFFIX,
+                Value.newBuilder()
+                    
.setBoolValue(TestTransformRegistrar.EXPECTED_BOOLEAN_VALUE)
+                    .build())
+            .putFields(
+                PIPELINE_OPTIONS_URN_PREFIX + "integer_option" + 
PIPELINE_OPTIONS_URN_SUFFIX,
+                Value.newBuilder()
+                    
.setNumberValue(TestTransformRegistrar.EXPECTED_INTEGER_VALUE)
+                    .build())
+            .build();
+    ExpansionApi.ExpansionRequest request =
+        ExpansionApi.ExpansionRequest.newBuilder()
+            .setComponents(pipelineProto.getComponents())
+            .setPipelineOptions(optionsStruct)
+            .setTransform(
+                RunnerApi.PTransform.newBuilder()
+                    .setUniqueName(TEST_NAME)
+                    
.setSpec(RunnerApi.FunctionSpec.newBuilder().setUrn(TEST_OPTIONS_URN))
+                    .putInputs("input", inputPcollId))
+            .setNamespace(TEST_NAMESPACE)
+            .build();
+    ExpansionApi.ExpansionResponse response = expansionService.expand(request);

Review Comment:
   Yeah, the `expansionService.expand` call results in the transform provided 
in the `ExpansionRequest` being expanded. 
   
   
   
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to