Commits

Sam Adams  committed 4c4ff05

Fixed tests

  • Participants
  • Parent commits 2d4369c

Comments (0)

Files changed (4)

File chempound-api/src/main/java/net/chempound/config/ChempoundConfiguration.java

 
     URI getBaseUri();
 
-    URI getContentRootURI();
-
     File getWorkspace();
 
     File getCacheDirectory();
 
-    File getTempDirectory();
-
     List<FeedConfiguration> getFeeds();
 
 }

File chempound-app/src/main/java/net/chempound/config/DefaultChempoundConfiguration.java

     }
 
     @Override
-    public URI getContentRootURI() {
-        return baseUri.resolve("content/");
-    }
-
-    @Override
     public File getWorkspace() {
         if (!workspace.exists()) {
             if (!workspace.mkdirs()) {
     }
 
     @Override
-    public File getTempDirectory() {
-        if (tempDirectory == null) {
-            final String tmpDir = System.getProperty("java.io.tmpdir");
-            tempDirectory = new File(tmpDir, "chempound");
-        }
-        if (!tempDirectory.exists()) {
-            tempDirectory.mkdirs();
-        }
-        return tempDirectory;
-    }
-
-    @Override
     public File getCacheDirectory() {
         if (cacheDirectory == null) {
             cacheDirectory = new File(getWorkspace(), "cache");

File chempound-app/src/test/java/net/chempound/ChempoundApplicationTest.java

 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.Seq;
 import com.hp.hpl.jena.tdb.TDBFactory;
-import net.chempound.config.ChempoundConfiguration;
-import net.chempound.config.DefaultChempoundConfiguration;
 import net.chempound.content.DefaultDepositRequest;
 import net.chempound.content.DepositRequest;
 import net.chempound.content.DepositResponse;
         dataSet = TDBFactory.createDataset();
         JenaTripleStore dataStore = new JenaTripleStore(dataSet);
         ResourceStore resourceStore = new InMemoryResourceStore();
-        URI baseUri = URI.create("http://chempound.example.com");
+        URI baseUri = URI.create("http://chempound.example.com/repo/");
         URI contentRoot = baseUri.resolve("content/");
         final DepositHandler depositHandler = new DepositHandler(new EntryUriGenerator(dataStore, contentRoot),
                 dataStore, resourceStore, new IndexManager(), new ResourceMapGenerator(baseUri), contentRoot);
         assertNotNull(response);
         URI uri = response.getUri();
         assertNotNull(uri);
-        assertTrue(uri.toString().startsWith("http://chempound.example.com/content"));
+        assertTrue(uri.toString().startsWith("http://chempound.example.com/repo/content"));
         Model model = dataSet.getNamedModel(uri.toString());
         try {
             assertNotNull(model);
         DepositResponse response = chempound.loadContent(request);
         assertNotNull(response);
         URI uri = response.getUri();
-        assertEquals(URI.create("http://chempound.example.com/content/foobar/"), uri);
+        assertEquals(URI.create("http://chempound.example.com/repo/content/foobar/"), uri);
 
         Model model = dataSet.getNamedModel(uri.toString());
         try {
 
         Model model = dataSet.getNamedModel(uri.toString());
         try {
-            Resource item = model.getResource("http://chempound.example.com/content/foo/");
-            Resource html = model.getResource("http://chempound.example.com/content/foo/index.html");
-            Resource rdf = model.getResource("http://chempound.example.com/content/foo/index.rdf");
-            Resource n3 = model.getResource("http://chempound.example.com/content/foo/index.n3");
-            Resource ttl = model.getResource("http://chempound.example.com/content/foo/index.ttl");
+            Resource item = model.getResource("http://chempound.example.com/repo/content/foo/");
+            Resource html = model.getResource("http://chempound.example.com/repo/content/foo/index.html");
+            Resource rdf = model.getResource("http://chempound.example.com/repo/content/foo/index.rdf");
+            Resource n3 = model.getResource("http://chempound.example.com/repo/content/foo/index.n3");
+            Resource ttl = model.getResource("http://chempound.example.com/repo/content/foo/index.ttl");
 
             assertTrue(model.contains(item, ORE.isDescribedBy, html));
             assertTrue(model.contains(item, ORE.isDescribedBy, rdf));
 
         chempound.loadContent(request);
 
-        Model model = dataSet.getNamedModel("http://chempound.example.com/content/foo/");
-        Resource aggr = model.getResource("http://chempound.example.com/content/foo/");
-        Resource foo = model.getResource("http://chempound.example.com/content/foo/foo.txt");
-        Resource bar = model.getResource("http://chempound.example.com/content/foo/bar.txt");
+        Model model = dataSet.getNamedModel("http://chempound.example.com/repo/content/foo/");
+        Resource aggr = model.getResource("http://chempound.example.com/repo/content/foo/");
+        Resource foo = model.getResource("http://chempound.example.com/repo/content/foo/foo.txt");
+        Resource bar = model.getResource("http://chempound.example.com/repo/content/foo/bar.txt");
 
         assertTrue(aggr.hasProperty(ORE.aggregates, foo));
         assertTrue(aggr.hasProperty(ORE.aggregates, bar));

File chempound-webapp/src/main/resources/net/chempound/templates/default/resource.ftl

     <h3>Resources</h3>
 <#list aggregation.aggregatedResources as resource>
         <div class="resource<#if resource_index == 0> first</#if>">
-            <h2><a href="${resource.uri}">${resource.title!resource.path}</a></h2>
+            <h2><a href="${resource.uri}">${resource.title!resource.uri}</a></h2>
 <#if resource.format??>
     <p><b>MimeType:</b> ${resource.format}</p>
 </#if>