lukecwik commented on a change in pull request #11342: [BEAM-9577] New artifact 
staging and retrieval service for Java.
URL: https://github.com/apache/beam/pull/11342#discussion_r410513283
 
 

 ##########
 File path: 
runners/java-fn-execution/src/test/java/org/apache/beam/runners/fnexecution/artifact/ArtifactRetrievalServiceTest.java
 ##########
 @@ -0,0 +1,137 @@
+/*
+ * 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.runners.fnexecution.artifact;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.beam.model.jobmanagement.v1.ArtifactApi;
+import org.apache.beam.model.jobmanagement.v1.ArtifactRetrievalServiceGrpc;
+import org.apache.beam.model.pipeline.v1.RunnerApi;
+import org.apache.beam.runners.fnexecution.GrpcFnServer;
+import org.apache.beam.runners.fnexecution.InProcessServerFactory;
+import org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString;
+import org.apache.beam.vendor.grpc.v1p26p0.io.grpc.ManagedChannel;
+import 
org.apache.beam.vendor.grpc.v1p26p0.io.grpc.inprocess.InProcessChannelBuilder;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Charsets;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Strings;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class ArtifactRetrievalServiceTest {
+  private static final int TEST_BUFFER_SIZE = 1 << 10;
+  private GrpcFnServer<ArtifactRetrievalService> retrievalServer;
+  private ArtifactRetrievalService retrievalService;
+  private ArtifactRetrievalServiceGrpc.ArtifactRetrievalServiceStub 
retrievalStub;
+  private ArtifactRetrievalServiceGrpc.ArtifactRetrievalServiceBlockingStub 
retrievalBlockingStub;
+  private Path stagingDir;
+  @Rule public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  @Before
+  public void setUp() throws Exception {
+    retrievalService = new ArtifactRetrievalService(TEST_BUFFER_SIZE);
+    retrievalServer =
+        GrpcFnServer.allocatePortAndCreateFor(retrievalService, 
InProcessServerFactory.create());
+    ManagedChannel retrievalChannel =
 
 Review comment:
   Consider using the GrpcCleanupRule as seen here:
   
https://github.com/grpc/grpc-java/blob/68297d6d7c17453eeae0e0ffbce03edc1eda0a12/examples/src/test/java/io/grpc/examples/helloworld/HelloWorldServerTest.java#L49

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to