mkou commented on code in PR #2750:
URL: https://github.com/apache/calcite/pull/2750#discussion_r1437869345


##########
core/src/test/java/org/apache/calcite/util/SourceTest.java:
##########
@@ -121,6 +131,54 @@ void testAbsoluteFileToUrl(String path, String 
expectedUrl) throws URISyntaxExce
         () -> "Sources.of(Sources.of(file(" + path + 
").absolutePath).url()).file().getPath()");
   }
 
+  /**
+   * Resources created with the JAR protocol should also work.
+   * This will enable the Fixture test to work under Bazel.
+   */
+  @Test void testJarFileUrl() throws  MalformedURLException {
+    // mock jar file
+    final String jarPath = "jar:file:sources!/abcdef.txt";
+    final URL url = new URL(jarPath);
+    final Source source = of(url);
+    assertThat("No file retrieved for Sources.of(file " + jarPath + ")",
+        source.file(), notNullValue());
+    assertThat("Sources.of(file " + jarPath + ").url()).file().getPath()",
+        slashify(source.file().getPath()),
+        is("sources!/abcdef.txt"));
+
+  }
+
+  /** Tests {@link Sources#of(URL)} with code similar to
+   * {@code DiffRepository.Key#toRepo()}. */
+  @Test void testJarFileUrlWrite() {
+    final URL refFile = FoodmartQuerySet.class.getResource("/queries.json");

Review Comment:
   Crap it is so long ago I don't remember why I did that to test the diff repo



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