[ 
https://issues.apache.org/jira/browse/BEAM-2885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16269340#comment-16269340
 ] 

ASF GitHub Bot commented on BEAM-2885:
--------------------------------------

tgroh commented on a change in pull request #4150: [BEAM-2885] Maintain 
In-flight preparation requests
URL: https://github.com/apache/beam/pull/4150#discussion_r153599666
 
 

 ##########
 File path: 
runners/reference/job-server/src/test/java/org/apache/beam/runners/reference/job/ReferenceRunnerJobServiceTest.java
 ##########
 @@ -27,8 +47,54 @@
  */
 @RunWith(JUnit4.class)
 public class ReferenceRunnerJobServiceTest {
+  @Rule public TemporaryFolder temp = new TemporaryFolder();
+
+  private InProcessServerFactory serverFactory = 
InProcessServerFactory.create();
+  private ReferenceRunnerJobService service;
+  private GrpcFnServer<ReferenceRunnerJobService> server;
+  private JobServiceBlockingStub stub;
+
+  @Before
+  public void setup() throws Exception {
+    service = ReferenceRunnerJobService.create(serverFactory);
+    server = GrpcFnServer.allocatePortAndCreateFor(service, serverFactory);
+    stub =
+        JobServiceGrpc.newBlockingStub(
+            
InProcessChannelBuilder.forName(server.getApiServiceDescriptor().getUrl()).build());
+  }
+
+  @After
+  public void teardown() throws Exception {
+    server.close();
+  }
+
   @Test
-  public void testPrepareJob() {
-    // TODO: Implement when PrepareJob is implemented.
+  public void testPrepareJob() throws Exception {
+    PrepareJobResponse response =
+        stub.prepare(
+            PrepareJobRequest.newBuilder()
+                .setPipelineOptions(Struct.getDefaultInstance())
+                .setPipeline(Pipeline.getDefaultInstance())
+                .setJobName("myJobName")
+                .build());
+
+    ApiServiceDescriptor stagingEndpoint = 
response.getArtifactStagingEndpoint();
+    ArtifactServiceStager stager =
+        ArtifactServiceStager.overChannel(
+            InProcessChannelBuilder.forName(stagingEndpoint.getUrl()).build());
+    File foo = writeTempFile("foo", "foo, bar, baz".getBytes());
+    File bar = writeTempFile("spam", "spam, ham, eggs".getBytes());
+    stager.stage(ImmutableList.<File>of(foo, bar));
+    // TODO: 'run' the job with some sort of noop backend, to verify state is 
cleaned up.
+    // TODO: Verify that the artifacts have been staged
 
 Review comment:
   ack

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


> Support job+artifact APIs locally
> ---------------------------------
>
>                 Key: BEAM-2885
>                 URL: https://issues.apache.org/jira/browse/BEAM-2885
>             Project: Beam
>          Issue Type: Sub-task
>          Components: runner-dataflow
>            Reporter: Henning Rohde
>            Assignee: Thomas Groh
>              Labels: portability
>
> As per https://s.apache.org/beam-job-api, use local support for 
> submission-side. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to