Commits

Sam Adams committed d3022a4

Fix relative/absolute URIs in compchem + crystallography templates

Comments (0)

Files changed (1)

client-cli/src/test/java/net/chempound/client/cli/ChempoundClientCLIIntegrationTest.java

         assertEquals("wobble", fetchUrl(URI.create("http://localhost:12080/content/test/wobble.txt")));
     }
 
+    @Test
+    public void testDepositItemToCollectionWithoutSlash() throws Exception {
+        FileUtils.forceMkdir(tmpDir);
+        FileUtils.writeStringToFile(new File(tmpDir, "wibble.txt"), "wibble");
+
+        client.runMain("-R", "http://localhost:12080/content", "--cwd", tmpDir.getAbsolutePath(),
+                "deposit", "-s", "xyzzy", "wibble.txt");
+
+        assertTrue(tripleStore.containsTriple(createResource("http://localhost:12080/content/"), ORE.aggregates, createResource("http://localhost:12080/content/xyzzy/")));
+        assertTrue(tripleStore.containsTriple(createResource("http://localhost:12080/content/xyzzy/"), type, Item));
+        assertTrue(tripleStore.containsTriple(createResource("http://localhost:12080/content/xyzzy/"), ORE.aggregates, createResource("http://localhost:12080/content/xyzzy/wibble.txt")));
+
+        assertEquals("wibble", fetchUrl(URI.create("http://localhost:12080/content/xyzzy/wibble.txt")));
+    }
+
     private static String fetchUrl(final URI uri) throws IOException {
         InputStream in = uri.toURL().openStream();
         try {