Updated tests and made a temp hack to get resources from a json file.
Change-Id: I1ced40775ab5df788dd584554e9e67a7946f0e49
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
index f9f560f..71e67c3 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapClient.java
@@ -421,7 +421,7 @@
sb.append(resourceId);
sb.append("/");
sb.append(documentId);
- sb.append(".");
+ sb.append("/");
sb.append(textId);
sb.append("/");
sb.append(matchId);
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java b/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
index 1a7f219..0e29f1f 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapEndpointDescription.java
@@ -1,6 +1,7 @@
package de.mannheim.ids.korap.sru;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -13,6 +14,7 @@
import javax.servlet.ServletContext;
import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.clarin.sru.server.SRUConfigException;
import eu.clarin.sru.server.SRUConstants;
@@ -46,7 +48,8 @@
private Layer textLayer;
private List<AnnotationLayer> annotationLayers;
-
+ private ObjectMapper mapper = new ObjectMapper();
+
public KorapEndpointDescription (ServletContext context)
throws SRUConfigException {
try {
@@ -114,9 +117,12 @@
JsonNode resources;
try {
- resources = KorapSRU.korapClient.retrieveResources();
+ //resources = KorapSRU.korapClient.retrieveResources();
+ InputStream is = getClass().getClassLoader().getResourceAsStream("resources.json");
+ resources = mapper.readTree(is);
}
- catch (URISyntaxException | IOException e) {
+ catch ( //URISyntaxException |
+ IOException e) {
throw new SRUException(SRUConstants.SRU_GENERAL_SYSTEM_ERROR,
"Failed retrieving resources.");
}
diff --git a/src/main/resources/resources.json b/src/main/resources/resources.json
new file mode 100644
index 0000000..36c0ce1
--- /dev/null
+++ b/src/main/resources/resources.json
@@ -0,0 +1 @@
+[{"id":"WPD15","created":"2017-06-01T14:11:13.511+02:00","description":"German Wikipedia 2015","name":"Wikipedia 2015","data":{}}]
\ No newline at end of file