diff env/lib/python3.7/site-packages/schema_salad/java/test_utils/DefaultFetcherTest.java @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.7/site-packages/schema_salad/java/test_utils/DefaultFetcherTest.java	Sat May 02 07:14:21 2020 -0400
@@ -0,0 +1,37 @@
+package ${package}.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DefaultFetcherTest {
+  @Test
+  public void testUnderscoreJoin() {
+    final DefaultFetcher fetcher = new DefaultFetcher();
+    Assert.assertEquals(fetcher.urlJoin("http://googl.com/", "_:/moo"), "_:/moo");
+  }
+
+  @Test
+  public void testUnixJoin() {
+    final DefaultFetcher fetcher = new DefaultFetcher();
+    String url;
+
+    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "soup.cwl");
+    Assert.assertEquals(url, "file:///home/fred/soup.cwl");
+
+    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "../alice/soup.cwl");
+    Assert.assertEquals(url, "file:///home/alice/soup.cwl");
+    // relative from root
+    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "/baz/soup.cwl");
+    Assert.assertEquals(url, "file:///baz/soup.cwl");
+
+    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "http://example.com/bar/soup.cwl");
+    Assert.assertEquals(url, "http://example.com/bar/soup.cwl");
+
+    url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "soup.cwl");
+    Assert.assertEquals(url, "http://example.com/fred/soup.cwl");
+
+    // Root-relative -- here relative to http host, not file:///
+    url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "/bar/soup.cwl");
+    Assert.assertEquals(url, "http://example.com/bar/soup.cwl");
+  }
+}