damondouglas commented on code in PR #31796:
URL: https://github.com/apache/beam/pull/31796#discussion_r1672649263


##########
runners/prism/java/src/test/java/org/apache/beam/runners/prism/PrismLocatorTest.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.prism;
+
+import static com.google.common.truth.Truth.assertThat;
+import static 
org.apache.beam.runners.prism.PrismRunnerTest.getLocalPrismBuildOrIgnoreTest;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link PrismLocator}. */
+@RunWith(JUnit4.class)
+public class PrismLocatorTest {
+
+  @Test
+  public void givenVersionOverride_thenResolves() throws IOException {
+    PrismPipelineOptions options = options();
+    options.setPrismVersionOverride("2.57.0");
+    PrismLocator underTest = new PrismLocator(options);
+    String got = underTest.resolve();
+    assertThat(got).contains(".apache_beam/cache/prism/bin/");
+    assertThat(got).contains("2.57.0");
+    Path gotPath = Paths.get(got);
+    assertThat(Files.exists(gotPath)).isTrue();
+    Files.delete(gotPath);
+  }
+
+  @Test
+  public void givenHttpPrismLocationOption_thenResolves() throws IOException {
+    PrismPipelineOptions options = options();
+    options.setPrismLocation(
+        
"https://github.com/apache/beam/releases/download/v2.57.0/apache_beam-v2.57.0-prism-darwin-arm64.zip";);
+    PrismLocator underTest = new PrismLocator(options);
+    String got = underTest.resolve();
+    assertThat(got).contains(".apache_beam/cache/prism/bin/");
+    Path gotPath = Paths.get(got);
+    assertThat(Files.exists(gotPath)).isTrue();
+    Files.delete(gotPath);
+  }
+
+  @Test
+  public void givenFilePrismLocationOption_thenResolves() throws IOException {

Review Comment:
   FYI temp would require setting the destination which is not done to keep 
consistent with the Python prism runner. The behavior under test is both the 
source and destination. Only the source is configurable. Yes, there could be a 
hidden configuration for the destination but I wanted to keep consistent with 
what the Python prism runner does i.e. constant `~/.apache_beam/...`



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