Integrated lite and full services and controllers in core.
Change-Id: I34914c89c2266fa02bee1a5b0522c46139b13966
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteJerseyTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteJerseyTest.java
new file mode 100644
index 0000000..a0ea0a3
--- /dev/null
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteJerseyTest.java
@@ -0,0 +1,54 @@
+package de.ids_mannheim.korap.web.service;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.concurrent.ThreadLocalRandom;
+
+import org.springframework.web.context.ContextLoaderListener;
+
+import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
+import com.sun.jersey.test.framework.AppDescriptor;
+import com.sun.jersey.test.framework.JerseyTest;
+import com.sun.jersey.test.framework.WebAppDescriptor;
+import com.sun.jersey.test.framework.spi.container.TestContainerException;
+import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
+import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+
+public class LiteJerseyTest extends JerseyTest{
+
+ public static final String API_VERSION = "v1.0";
+ private static String[] classPackages =
+ new String[] { "de.ids_mannheim.korap.web.controller",
+ "de.ids_mannheim.korap.web.filter",
+ "de.ids_mannheim.korap.web.utils" };
+ @Override
+ protected TestContainerFactory getTestContainerFactory ()
+ throws TestContainerException {
+ return new GrizzlyWebTestContainerFactory();
+ }
+
+ @Override
+ protected AppDescriptor configure () {
+ return new WebAppDescriptor.Builder(classPackages)
+ .servletClass(SpringServlet.class)
+ .contextListenerClass(ContextLoaderListener.class)
+ .contextParam("contextConfigLocation",
+ "classpath:test-config.xml")
+ .build();
+ }
+
+ @Override
+ protected int getPort (int defaultPort) {
+ int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
+ try {
+ ServerSocket socket = new ServerSocket(port);
+ socket.close();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ port = getPort(port);
+ }
+ return port;
+ }
+
+}
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
new file mode 100644
index 0000000..68088fc
--- /dev/null
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
@@ -0,0 +1,377 @@
+package de.ids_mannheim.korap.web.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Iterator;
+
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.jetty.http.HttpStatus;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.net.HttpHeaders;
+import com.sun.jersey.api.client.ClientResponse;
+
+import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.utils.JsonUtils;
+
+public class LiteSearchControllerTest extends LiteJerseyTest {
+
+ @Test
+ public void testGetJSONQuery () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("query")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
+ assertEquals("sentence", node.at("/meta/context").asText());
+ assertEquals("13", node.at("/meta/count").asText());
+ }
+
+ @Test
+ public void testbuildAndPostQuery () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("query")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+
+ response = resource().path(API_VERSION).path("search")
+ .post(ClientResponse.class, query);
+
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String matches = response.getEntity(String.class);
+ JsonNode match_node = JsonUtils.readTree(matches);
+ assertNotEquals(0, match_node.path("matches").size());
+ }
+
+ @Test
+ public void testQueryGet () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertEquals("base/s:s", node.at("/meta/context").asText());
+ assertEquals("13", node.at("/meta/count").asText());
+ assertNotEquals(0, node.at("/matches").size());
+ }
+
+ @Test
+ public void testQueryFailure () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=das").queryParam("ql", "poliqarp")
+ .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
+ .queryParam("count", "13").get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals(302, node.at("/errors/0/0").asInt());
+ assertEquals(302, node.at("/errors/1/0").asInt());
+ assertTrue(node.at("/errors/2").isMissingNode());
+ assertFalse(node.at("/collection").isMissingNode());
+ assertEquals(13, node.at("/meta/count").asInt());
+ }
+
+ @Test
+ public void testFoundryRewrite () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
+ }
+
+ @Test
+ public void testQueryPost () throws KustvaktException {
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[orth=das]", "poliqarp");
+
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .post(ClientResponse.class, s.toJSON());
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertNotEquals(0, node.at("/matches").size());
+ }
+
+ @Test
+ public void testParameterField () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("fields", "author, docSigle")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertNotEquals(0, node.at("/matches").size());
+ assertEquals("[\"author, docSigle\"]",
+ node.at("/meta/fields").toString());
+ }
+
+ @Test
+ public void testMatchInfoGetWithoutSpans () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION)
+ .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
+ .queryParam("foundry", "*").queryParam("spans", "false")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
+ assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
+ node.at("/matchID").asText());
+ assertEquals("Belagerung von Mainz", node.at("/title").asText());
+ };
+
+ @Test
+ public void testMatchInfoGetWithoutHighlights () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION)
+ .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
+ .queryParam("foundry", "xy").queryParam("spans", "false")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals(
+ "<span class=\"context-left\"></span><span class=\"match\">der alte freie Weg nach Mainz war gesperrt, ich mußte über die Schiffbrücke bei Rüsselsheim; in Ginsheim ward <mark>gefüttert; der Ort ist sehr zerschossen; dann über die Schiffbrücke</mark> auf die Nonnenaue, wo viele Bäume niedergehauen lagen, sofort auf dem zweiten Teil der Schiffbrücke über den größern Arm des Rheins.</span><span class=\"context-right\"></span>",
+ node.at("/snippet").asText());
+ assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
+ assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
+ node.at("/matchID").asText());
+ assertEquals("Belagerung von Mainz", node.at("/title").asText());
+ };
+
+ @Test
+ public void testMatchInfoGetWithHighlights () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION)
+ .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
+ .queryParam("foundry", "xy").queryParam("spans", "false")
+ .queryParam("hls", "true").get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
+ assertEquals(
+ "<span class=\"context-left\"></span><span class=\"match\">"
+ + "der alte freie Weg nach Mainz war gesperrt, ich mußte über die "
+ + "Schiffbrücke bei Rüsselsheim; in Ginsheim ward <mark>gefüttert; "
+ + "<mark class=\"class-5 level-0\">der <mark class=\"class-2 level-1\">"
+ + "Ort ist sehr zerschossen; dann</mark> über die Schiffbrücke</mark></mark> "
+ + "auf die Nonnenaue, wo viele Bäume niedergehauen lagen, sofort auf dem "
+ + "zweiten Teil der Schiffbrücke über den größern Arm des Rheins.</span>"
+ + "<span class=\"context-right\"></span>",
+ node.at("/snippet").asText());
+ assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
+ node.at("/matchID").asText());
+ assertEquals("Belagerung von Mainz", node.at("/title").asText());
+ };
+
+ @Test
+ public void testMatchInfoGet2 () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION)
+
+ .path("corpus/GOE/AGA/01784/p36-46/matchInfo")
+ .queryParam("foundry", "*").get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
+ assertEquals("Belagerung von Mainz", node.at("/title").asText());
+ };
+
+ @Test
+ public void testCollectionQueryParameter () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("query")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("fields", "author, docSigle")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .queryParam("cq", "textClass=Politik & corpus=WPD")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertEquals("Politik",
+ node.at("/collection/operands/0/value").asText());
+ assertEquals("WPD", node.at("/collection/operands/1/value").asText());
+
+ response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
+ .queryParam("fields", "author, docSigle")
+ .queryParam("context", "sentence").queryParam("count", "13")
+ .queryParam("cq", "textClass=Politik & corpus=WPD")
+ .get(ClientResponse.class);
+ // String version =
+ // LucenePackage.get().getImplementationVersion();;
+ // System.out.println("VERSION "+ version);
+ // System.out.println("RESPONSE "+ response);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ query = response.getEntity(String.class);
+ node = JsonUtils.readTree(query);
+ assertNotNull(node);
+ assertEquals("orth", node.at("/query/wrap/layer").asText());
+ assertEquals("Politik",
+ node.at("/collection/operands/0/value").asText());
+ assertEquals("WPD", node.at("/collection/operands/1/value").asText());
+ }
+
+ @Test
+ public void testMetaFields () throws KustvaktException {
+ ClientResponse response =
+ resource().path(API_VERSION).path("/corpus/GOE/AGA/01784")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String resp = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(resp);
+ // System.err.println(node.toString());
+
+ Iterator<JsonNode> fieldIter = node.at("/document/fields").elements();
+
+ int checkC = 0;
+ while (fieldIter.hasNext()) {
+ JsonNode field = (JsonNode) fieldIter.next();
+
+ String key = field.at("/key").asText();
+
+ assertEquals("koral:field", field.at("/@type").asText());
+
+ switch (key) {
+ case "textSigle":
+ assertEquals("type:string", field.at("/type").asText());
+ assertEquals("GOE/AGA/01784", field.at("/value").asText());
+ checkC++;
+ break;
+ case "author":
+ assertEquals("type:text", field.at("/type").asText());
+ assertEquals("Goethe, Johann Wolfgang von",
+ field.at("/value").asText());
+ checkC++;
+ break;
+ case "docSigle":
+ assertEquals("type:string", field.at("/type").asText());
+ assertEquals("GOE/AGA", field.at("/value").asText());
+ checkC++;
+ break;
+ case "docTitle":
+ assertEquals("type:text", field.at("/type").asText());
+ assertEquals(
+ "Goethe: Autobiographische Schriften II, (1817-1825, 1832)",
+ field.at("/value").asText());
+ checkC++;
+ break;
+ case "pubDate":
+ assertEquals("type:date", field.at("/type").asText());
+ assertEquals(1982, field.at("/value").asInt());
+ checkC++;
+ break;
+ };
+ };
+ assertEquals(5, checkC);
+ };
+
+ @Test
+ public void testSearchWithoutVersion () throws KustvaktException {
+ ClientResponse response = resource().path("api").path("search")
+ .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
+ .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
+ URI location = response.getLocation();
+ assertEquals("/api/v1.0/search", location.getPath());
+ }
+
+ @Test
+ public void testSearchWrongVersion () throws KustvaktException {
+ ClientResponse response = resource().path("api").path("v0.2")
+ .path("search").queryParam("q", "[orth=der]")
+ .queryParam("ql", "poliqarp").accept(MediaType.APPLICATION_JSON)
+ .get(ClientResponse.class);
+ assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
+ URI location = response.getLocation();
+ assertEquals("/api/v1.0/search", location.getPath());
+ }
+
+ @Test
+ public void testSearchWithIP () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+ .get(ClientResponse.class);
+
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String entity = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(entity);
+ assertTrue(node.at("/collection").isMissingNode());
+ }
+
+ @Test
+ public void testSearchWithAuthorizationHeader () throws KustvaktException {
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "Wasser").queryParam("ql", "poliqarp")
+ .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
+ .createBasicAuthorizationHeaderValue("test", "pwd"))
+ .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+ .get(ClientResponse.class);
+
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String entity = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(entity);
+ assertTrue(node.at("/collection").isMissingNode());
+ }
+}
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteServiceTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteServiceTest.java
deleted file mode 100644
index 3578b21..0000000
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteServiceTest.java
+++ /dev/null
@@ -1,453 +0,0 @@
-package de.ids_mannheim.korap.web.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.concurrent.ThreadLocalRandom;
-
-import javax.ws.rs.core.MediaType;
-
-import org.eclipse.jetty.http.HttpStatus;
-import org.junit.Test;
-import org.springframework.web.context.ContextLoaderListener;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerException;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.utils.JsonUtils;
-
-/**
- * Created by hanl on 29.04.16.
- *
- * @author margaretha, diewald
- * @date 08/03/2018
- *
- * Recent changes:
- * - removed test configuration using FastJerseyLightTest
- * - added metadata test
- * - updated field type:date
- */
-public class LiteServiceTest extends JerseyTest{
-
- public static final String API_VERSION = "v1.0";
- public static final String classPackage = "de.ids_mannheim.korap.web.service.lite";
-
- @Override
- protected TestContainerFactory getTestContainerFactory ()
- throws TestContainerException {
- return new GrizzlyWebTestContainerFactory();
- }
-
- @Override
- protected AppDescriptor configure () {
- return new WebAppDescriptor.Builder(classPackage)
- .servletClass(SpringServlet.class)
- .contextListenerClass(ContextLoaderListener.class)
- .contextParam("contextConfigLocation",
- "classpath:lite-config.xml")
- .build();
- }
-
- @Override
- protected int getPort (int defaultPort) {
- int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
- try {
- ServerSocket socket = new ServerSocket(port);
- socket.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- port = getPort(port);
- }
- return port;
- }
-
- @Test
- public void testStatistics () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("statistics")
- .queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertEquals(9, node.at("/documents").asInt());
- assertEquals(527662, node.at("/tokens").asInt());
- assertEquals(19387, node.at("/sentences").asInt());
- assertEquals(514, node.at("/paragraphs").asInt());
- }
-
- @Test
- public void testEmptyStatistics () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("statistics")
- .queryParam("corpusQuery", "")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertEquals(11, node.at("/documents").asInt());
- assertEquals(665842, node.at("/tokens").asInt());
- assertEquals(25074, node.at("/sentences").asInt());
- assertEquals(772, node.at("/paragraphs").asInt());
-
- response = resource().path(API_VERSION)
- .path("statistics")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- query = response.getEntity(String.class);
- node = JsonUtils.readTree(query);
- assertEquals(11, node.at("/documents").asInt());
- assertEquals(665842, node.at("/tokens").asInt());
- assertEquals(25074, node.at("/sentences").asInt());
- assertEquals(772, node.at("/paragraphs").asInt());
- }
-
-
- @Test
- public void testGetJSONQuery () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("query").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp").queryParam("context", "sentence")
- .queryParam("count", "13")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
-// System.out.println(query);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
- assertEquals("sentence", node.at("/meta/context").asText());
- assertEquals("13", node.at("/meta/count").asText());
- }
-
-
- @Test
- public void testbuildAndPostQuery () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("query").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp")
- .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
-
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
-
- response = resource().path(API_VERSION).path("search")
- .post(ClientResponse.class, query);
-
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String matches = response.getEntity(String.class);
- JsonNode match_node = JsonUtils.readTree(matches);
- assertNotEquals(0, match_node.path("matches").size());
- }
-
-
- @Test
- public void testQueryGet () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("search").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp").queryParam("context", "sentence")
- .queryParam("count", "13").get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertEquals("base/s:s", node.at("/meta/context").asText());
- assertEquals("13", node.at("/meta/count").asText());
- assertNotEquals(0, node.at("/matches").size());
- }
-
- @Test
- public void testQueryFailure () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("search").queryParam("q", "[orth=das")
- .queryParam("ql", "poliqarp")
- .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
- .queryParam("count", "13")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
-
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals(302, node.at("/errors/0/0").asInt());
- assertEquals(302, node.at("/errors/1/0").asInt());
- assertTrue(node.at("/errors/2").isMissingNode());
- assertFalse(node.at("/collection").isMissingNode());
- assertEquals(13, node.at("/meta/count").asInt());
- }
-
-
- @Test
- public void testFoundryRewrite () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("search").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp").queryParam("context", "sentence")
- .queryParam("count", "13").get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
- }
-
-
- @Test
- public void testQueryPost () throws KustvaktException{
- QuerySerializer s = new QuerySerializer();
- s.setQuery("[orth=das]", "poliqarp");
-
- ClientResponse response = resource().path(API_VERSION)
- .path("search").post(ClientResponse.class, s.toJSON());
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertNotEquals(0, node.at("/matches").size());
- }
-
-
- @Test
- public void testParameterField () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("search").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp")
- .queryParam("fields", "author, docSigle")
- .queryParam("context", "sentence").queryParam("count", "13")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertNotEquals(0, node.at("/matches").size());
- assertEquals("[\"author, docSigle\"]", node.at("/meta/fields")
- .toString());
- }
-
- @Test
- public void testMatchInfoGetWithoutSpans () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
- .queryParam("foundry", "*")
- .queryParam("spans", "false")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
- assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
- node.at("/matchID").asText());
- assertEquals("Belagerung von Mainz", node.at("/title").asText());
- };
-
- @Test
- public void testMatchInfoGetWithoutHighlights () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
- .queryParam("foundry", "xy")
- .queryParam("spans", "false")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertEquals("<span class=\"context-left\"></span><span class=\"match\">der alte freie Weg nach Mainz war gesperrt, ich mußte über die Schiffbrücke bei Rüsselsheim; in Ginsheim ward <mark>gefüttert; der Ort ist sehr zerschossen; dann über die Schiffbrücke</mark> auf die Nonnenaue, wo viele Bäume niedergehauen lagen, sofort auf dem zweiten Teil der Schiffbrücke über den größern Arm des Rheins.</span><span class=\"context-right\"></span>",
- node.at("/snippet").asText());
- assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
- assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
- node.at("/matchID").asText());
- assertEquals("Belagerung von Mainz", node.at("/title").asText());
- };
-
-
- @Test
- public void testMatchInfoGetWithHighlights () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
- .queryParam("foundry", "xy")
- .queryParam("spans", "false")
- .queryParam("hls", "true")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
- assertEquals("<span class=\"context-left\"></span><span class=\"match\">der alte freie Weg nach Mainz war gesperrt, ich mußte über die Schiffbrücke bei Rüsselsheim; in Ginsheim ward <mark>gefüttert; <mark class=\"class-5 level-0\">der <mark class=\"class-2 level-1\">Ort ist sehr zerschossen; dann</mark> über die Schiffbrücke</mark></mark> auf die Nonnenaue, wo viele Bäume niedergehauen lagen, sofort auf dem zweiten Teil der Schiffbrücke über den größern Arm des Rheins.</span><span class=\"context-right\"></span>",
- node.at("/snippet").asText());
- assertEquals("match-GOE/AGA/01784-p36-46(5)37-45(2)38-42",
- node.at("/matchID").asText());
- assertEquals("Belagerung von Mainz", node.at("/title").asText());
- };
-
-
- @Test
- public void testMatchInfoGet2 () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
-
- .path("corpus/GOE/AGA/01784/p36-46/matchInfo")
- .queryParam("foundry", "*")
- .get(ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
- assertEquals("Belagerung von Mainz", node.at("/title").asText());
- };
-
- @Test
- public void testCollectionQueryParameter () throws KustvaktException{
- ClientResponse response = resource().path(API_VERSION)
- .path("query").queryParam("q", "[orth=das]")
- .queryParam("ql", "poliqarp")
- .queryParam("fields", "author, docSigle")
- .queryParam("context", "sentence").queryParam("count", "13")
- .queryParam("cq", "textClass=Politik & corpus=WPD")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String query = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertEquals("Politik", node.at("/collection/operands/0/value")
- .asText());
- assertEquals("WPD", node.at("/collection/operands/1/value").asText());
-
- response = resource().path(API_VERSION).path("search")
- .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
- .queryParam("fields", "author, docSigle")
- .queryParam("context", "sentence").queryParam("count", "13")
- .queryParam("cq", "textClass=Politik & corpus=WPD")
- .get(ClientResponse.class);
-// String version = LucenePackage.get().getImplementationVersion();;
-// System.out.println("VERSION "+ version);
-// System.out.println("RESPONSE "+ response);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- query = response.getEntity(String.class);
- node = JsonUtils.readTree(query);
- assertNotNull(node);
- assertEquals("orth", node.at("/query/wrap/layer").asText());
- assertEquals("Politik", node.at("/collection/operands/0/value")
- .asText());
- assertEquals("WPD", node.at("/collection/operands/1/value").asText());
- }
-
- @Test
- public void testMetaFields () throws KustvaktException {
- ClientResponse response = resource().path(API_VERSION)
- .path("/corpus/GOE/AGA/01784")
- .method("GET", ClientResponse.class);
- assertEquals(ClientResponse.Status.OK.getStatusCode(),
- response.getStatus());
- String resp = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(resp);
-// System.err.println(node.toString());
-
- Iterator<JsonNode> fieldIter = node.at("/document/fields").elements();
-
- int checkC = 0;
- while (fieldIter.hasNext()) {
- JsonNode field = (JsonNode) fieldIter.next();
-
- String key = field.at("/key").asText();
-
- assertEquals("koral:field", field.at("/@type").asText());
-
- switch (key) {
- case "textSigle":
- assertEquals("type:string", field.at("/type").asText());
- assertEquals("GOE/AGA/01784", field.at("/value").asText());
- checkC++;
- break;
- case "author":
- assertEquals("type:text", field.at("/type").asText());
- assertEquals("Goethe, Johann Wolfgang von", field.at("/value").asText());
- checkC++;
- break;
- case "docSigle":
- assertEquals("type:string", field.at("/type").asText());
- assertEquals("GOE/AGA", field.at("/value").asText());
- checkC++;
- break;
- case "docTitle":
- assertEquals("type:text", field.at("/type").asText());
- assertEquals(
- "Goethe: Autobiographische Schriften II, (1817-1825, 1832)",
- field.at("/value").asText()
- );
- checkC++;
- break;
- case "pubDate":
- assertEquals("type:date", field.at("/type").asText());
- assertEquals(1982, field.at("/value").asInt());
- checkC++;
- break;
- };
- };
- assertEquals(5, checkC);
- };
-
- @Test
- public void testSearchWithoutVersion () throws KustvaktException {
- ClientResponse response = resource().path("api").path("search")
- .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
- assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
- URI location = response.getLocation();
- assertEquals("/api/v1.0/search", location.getPath());
- }
-
- @Test
- public void testSearchWrongVersion () throws KustvaktException {
- ClientResponse response = resource().path("api").path("v0.2")
- .path("search").queryParam("q", "[orth=der]")
- .queryParam("ql", "poliqarp").accept(MediaType.APPLICATION_JSON)
- .get(ClientResponse.class);
- assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
- URI location = response.getLocation();
- assertEquals("/api/v1.0/search", location.getPath());
- }
-}
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
new file mode 100644
index 0000000..0efc39e
--- /dev/null
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
@@ -0,0 +1,59 @@
+package de.ids_mannheim.korap.web.service;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.utils.JsonUtils;
+
+public class LiteStatisticControllerTest extends LiteJerseyTest{
+
+ @Test
+ public void testStatistics () throws KustvaktException{
+ ClientResponse response = resource().path(API_VERSION)
+ .path("statistics")
+ .queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertEquals(9, node.at("/documents").asInt());
+ assertEquals(527662, node.at("/tokens").asInt());
+ assertEquals(19387, node.at("/sentences").asInt());
+ assertEquals(514, node.at("/paragraphs").asInt());
+ }
+
+ @Test
+ public void testEmptyStatistics () throws KustvaktException{
+ ClientResponse response = resource().path(API_VERSION)
+ .path("statistics")
+ .queryParam("corpusQuery", "")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String query = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(query);
+ assertEquals(11, node.at("/documents").asInt());
+ assertEquals(665842, node.at("/tokens").asInt());
+ assertEquals(25074, node.at("/sentences").asInt());
+ assertEquals(772, node.at("/paragraphs").asInt());
+
+ response = resource().path(API_VERSION)
+ .path("statistics")
+ .method("GET", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ query = response.getEntity(String.class);
+ node = JsonUtils.readTree(query);
+ assertEquals(11, node.at("/documents").asInt());
+ assertEquals(665842, node.at("/tokens").asInt());
+ assertEquals(25074, node.at("/sentences").asInt());
+ assertEquals(772, node.at("/paragraphs").asInt());
+ }
+
+}
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/VCReferenceTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/VCReferenceTest.java
deleted file mode 100644
index 2a0bd0c..0000000
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/VCReferenceTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package de.ids_mannheim.korap.web.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.concurrent.ThreadLocalRandom;
-
-import org.junit.Test;
-import org.springframework.web.context.ContextLoaderListener;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerException;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.utils.JsonUtils;
-
-public class VCReferenceTest extends JerseyTest{
-
- public static final String API_VERSION = "v0.1";
- public static final String classPackage = "de.ids_mannheim.korap.web.service.lite";
-
- @Override
- protected TestContainerFactory getTestContainerFactory ()
- throws TestContainerException {
- return new GrizzlyWebTestContainerFactory();
- }
-
- @Override
- protected AppDescriptor configure () {
- return new WebAppDescriptor.Builder(classPackage)
- .servletClass(SpringServlet.class)
- .contextListenerClass(ContextLoaderListener.class)
- .contextParam("contextConfigLocation",
- "classpath:lite-config.xml")
- .build();
- }
-
- @Override
- protected int getPort (int defaultPort) {
- int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
- try {
- ServerSocket socket = new ServerSocket(port);
- socket.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- port = getPort(port);
- }
- return port;
- }
-
- @Test
- public void testSearchWithVCRef () throws KustvaktException {
- ClientResponse response = resource().path(API_VERSION).path("search")
- .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- .queryParam("cq", "referTo named-vc1")
- .get(ClientResponse.class);
-
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertTrue(node.at("/matches").size() > 0);
-
- }
-
- @Test
- public void testStatisticsWithVCReference () throws KustvaktException {
- String corpusQuery = "referTo named-vc1";
- ClientResponse response = resource().path(API_VERSION).path("statistics")
- .queryParam("corpusQuery", corpusQuery)
- .get(ClientResponse.class);
-
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertEquals(2, node.at("/documents").asInt());
- }
-}
diff --git a/lite/src/test/resources/test-config.xml b/lite/src/test/resources/test-config.xml
new file mode 100644
index 0000000..abfb505
--- /dev/null
+++ b/lite/src/test/resources/test-config.xml
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/tx
+ http://www.springframework.org/schema/tx/spring-tx.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+
+
+ <context:component-scan
+ base-package="de.ids_mannheim.korap.web.filter, de.ids_mannheim.korap.web.utils,
+ de.ids_mannheim.korap.authentication.http" />
+ <context:annotation-config />
+
+ <bean id="placeholders"
+ class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
+ <property name="ignoreResourceNotFound" value="true" />
+ <property name="locations">
+ <array>
+ <value>classpath:test-jdbc.properties</value>
+ <value>file:./test-jdbc.properties</value>
+ <value>classpath:hibernate.properties</value>
+ <value>classpath:kustvakt-lite.conf</value>
+ <value>file:./kustvakt-lite.conf</value>
+ </array>
+ </property>
+ </bean>
+
+ <bean id="properties"
+ class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="ignoreResourceNotFound" value="true" />
+ <property name="locations">
+ <array>
+ <value>classpath:kustvakt-lite.conf</value>
+ <value>file:./kustvakt-lite.conf</value>
+ </array>
+ </property>
+ </bean>
+
+ <bean id="config" class="de.ids_mannheim.korap.config.KustvaktConfiguration">
+ <constructor-arg index="0" name="properties" ref="properties" />
+ </bean>
+
+ <!-- Database -->
+
+ <bean id="sqliteDataSource"
+ class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
+ lazy-init="true">
+ <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="url" value="${jdbc.url}" />
+ <property name="username" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
+ <property name="connectionProperties">
+ <props>
+ <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop>
+ </props>
+ </property>
+
+ <!-- relevant for single connection datasource and sqlite -->
+ <property name="suppressClose">
+ <value>true</value>
+ </property>
+ <!--<property name="initialSize" value="2"/> -->
+ <!--<property name="poolPreparedStatements" value="true"/> -->
+ </bean>
+
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <property name="baselineOnMigrate" value="true" />
+ <!-- <property name="validateOnMigrate" value="false" /> -->
+ <!-- <property name="cleanOnValidationError" value="true" /> -->
+ <property name="locations" value="${jdbc.schemaPath}" />
+ <property name="dataSource" ref="sqliteDataSource" />
+ </bean>
+
+ <bean id="entityManagerFactory"
+ class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="dataSource" ref="sqliteDataSource" />
+
+ <property name="packagesToScan">
+ <array>
+ <value>de.ids_mannheim.korap.entity</value>
+ </array>
+ </property>
+ <property name="jpaVendorAdapter">
+ <bean id="jpaVendorAdapter"
+ class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="databasePlatform" value="${hibernate.dialect}" />
+ </bean>
+ </property>
+ <property name="jpaProperties">
+ <props>
+ <prop key="hibernate.dialect">${hibernate.dialect}</prop>
+ <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
+ <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
+ <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
+ <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
+ </prop>
+ <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop>
+ <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop>
+ <prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop>
+ </props>
+ </property>
+ </bean>
+ <tx:annotation-driven proxy-target-class="true"
+ transaction-manager="transactionManager" />
+
+ <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+
+ <bean id="transactionTemplate"
+ class="org.springframework.transaction.support.TransactionTemplate">
+ <constructor-arg ref="transactionManager" />
+ </bean>
+ <bean id="txManager"
+ class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+ <property name="dataSource" ref="sqliteDataSource" />
+ </bean>
+
+ <!-- Initialization -->
+ <bean id="initializator" class="de.ids_mannheim.de.init.LiteInitializatorImpl"
+ init-method="init">
+ </bean>
+ <bean id="annotationParser" class="de.ids_mannheim.korap.annotation.AnnotationParser"
+ scope="singleton" />
+
+ <!-- Krill -->
+ <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
+ <constructor-arg value="${krill.indexDir}" />
+ </bean>
+
+ <!-- Filters -->
+ <bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
+ scope="singleton" />
+
+ <!-- Authentication -->
+ <bean id="authenticationManager"
+ class="de.ids_mannheim.korap.authentication.DummyAuthenticationManager" />
+
+ <!-- Response handler -->
+ <bean id="kustvaktResponseHandler" class="de.ids_mannheim.korap.web.KustvaktResponseHandler">
+ <constructor-arg index="0" name="iface" ref="kustvakt_auditing" />
+ </bean>
+
+ <!-- Controllers -->
+ <bean id="annotationController"
+ class="de.ids_mannheim.korap.web.controller.AnnotationController" />
+ <bean id="searchController" class="de.ids_mannheim.korap.web.controller.SearchController" />
+ <bean id="statisticController"
+ class="de.ids_mannheim.korap.web.controller.StatisticController" />
+
+ <!-- Services -->
+ <bean id="annotationService" class="de.ids_mannheim.korap.service.AnnotationService"></bean>
+ <bean id="scopeService"
+ class="de.ids_mannheim.korap.oauth2.service.DummyOAuth2ScopeServiceImpl" />
+ <bean id="searchService" class="de.ids_mannheim.korap.service.SearchService"></bean>
+
+ <!-- DAO -->
+ <bean id="adminDao" class="de.ids_mannheim.korap.dao.DummyAdminDaoImpl" />
+ <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao" />
+
+ <!-- DTO Converter -->
+ <bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
+
+ <!-- Rewrite -->
+ <bean id="rewriteHandler" class="de.ids_mannheim.korap.resource.rewrite.RewriteHandler">
+ <constructor-arg ref="config" />
+ </bean>
+
+
+
+ <bean id="kustvakt_auditing"
+ class="de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing">
+ </bean>
+
+</beans>
\ No newline at end of file
diff --git a/lite/src/test/resources/test-jdbc.properties b/lite/src/test/resources/test-jdbc.properties
new file mode 100644
index 0000000..99e2e54
--- /dev/null
+++ b/lite/src/test/resources/test-jdbc.properties
@@ -0,0 +1,9 @@
+#-------------------------------------------------------------------------------
+# Sqlite Settings
+
+jdbc.database=sqlite
+jdbc.driverClassName=org.sqlite.JDBC
+jdbc.url=jdbc:sqlite:liteDB.sqlite
+jdbc.username=pc
+jdbc.password=pc
+jdbc.schemaPath=db
\ No newline at end of file