Updated tests and readme.
Change-Id: Ib7bad5b31f8843f88f4f60fd4ca93a664e771188
diff --git a/readme.md b/readme.md
index a512921..a5daf8d 100644
--- a/readme.md
+++ b/readme.md
@@ -30,6 +30,8 @@
* Tomcat 7
+* Kustvakt (currently unavailable for public)
+
## Installation
KorapSRU is built based on the FCSSimpleEndpoint library provided by CLARIN. KorapSRU 1.0.2-SNAPSHOT uses FCSSimpleEndpoint version 1.3.0 available from CLARIN Nexus repository. To allow Maven to download the library using JDK 1.7, an additional Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 is needed.
diff --git a/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java b/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
index 83b8d5d..0f57674 100644
--- a/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
+++ b/src/test/java/de/mannheim/ids/korap/test/KorapClientTest.java
@@ -1,5 +1,10 @@
package de.mannheim.ids.korap.test;
+import static org.junit.Assert.assertEquals;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
import org.apache.http.client.HttpResponseException;
import org.junit.Test;
@@ -10,29 +15,45 @@
import de.mannheim.ids.korap.sru.QueryLanguage;
+/**
+ * The tests are based on the sample corpus from the Goethe corpus.
+ * Skip the tests if Kustvakt does not have this corpus in the Krill
+ * index.
+ * The tests require a running KustvaktServer.
+ * Specify the Kustvakt service URI in the configuration file at
+ * src/main/resources/kustvakt.conf.
+ *
+ * @author margaretha
+ *
+ */
public class KorapClientTest {
+ private KorapClient c;
- @Test
- public void testKorapClient() throws Exception{
- KorapClient c = new KorapClient(25,50);
-
-// prox Kuh
- KorapResult result = c.query("Haus", QueryLanguage.CQL, "1.2", 1, 5,
- null);
- //System.out.println(result.getMatches().size());
-
- }
-
- @Test
- public void testResource() throws HttpResponseException, Exception {
- KorapClient c = new KorapClient(25,50);
- JsonNode resources = c.retrieveResources();
-
- for (JsonNode r : resources){
- System.out.println(r);
- System.out.println(r.get("name"));
- }
- }
-
+ public KorapClientTest () throws FileNotFoundException {
+ c = new KorapClient(25, 50);
+ }
+
+
+ @Test
+ public void testKorapClient () throws HttpResponseException, IOException {
+ KorapResult result = c.query("Haus", QueryLanguage.CQL, "1.2", 1, 25,
+ null);
+ assertEquals(25, result.getMatches().size());
+
+ result = c.query("(\"blaue\"|\"grüne\")", QueryLanguage.FCSQL, "2.0", 1,
+ 25, null);
+ assertEquals(25, result.getMatches().size());
+ }
+
+
+ @Test
+ public void testResource () throws HttpResponseException, Exception {
+ JsonNode resources = c.retrieveResources();
+
+ assertEquals(3, resources.size());
+ assertEquals("Weimarer Werke", resources.get(0).get("name"));
+ assertEquals("Aphorismen", resources.get(0).get("name"));
+ assertEquals("Werther", resources.get(0).get("name"));
+ }
}