commit of tests
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java
new file mode 100644
index 0000000..8d826ee
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java
@@ -0,0 +1,37 @@
+package de.ids_mannheim.korap.config;
+
+import net.sf.ehcache.CacheManager;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+/**
+ * @author hanl
+ * @date 03/02/2016
+ */
+public class KustvaktCacheManager {
+
+ private static boolean loaded = false;
+
+ public static void init() {
+ if (!loaded) {
+ System.out.println("LOADING EHCACHE CONFIG FROM FILE");
+ InputStream in = null;
+ try {
+ in = new FileInputStream(new File("./ehcache.xml"));
+ }catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ if (in == null) {
+ System.out.println("LOADING EHCACHE FROM CLASSPATH");
+ in = KustvaktCacheManager.class
+ .getResourceAsStream("ehcache.xml");
+ }
+ CacheManager.newInstance(in);
+ loaded = true;
+ }
+ }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
new file mode 100644
index 0000000..603aa53
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
@@ -0,0 +1,112 @@
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.DocumentDao;
+import de.ids_mannheim.korap.resources.Document;
+import org.junit.*;
+
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 12/11/2015
+ */
+public class DocumentDaoTest {
+
+ private static DocumentDao dao;
+
+ @BeforeClass
+ public static void setup() {
+ BeanConfiguration.loadClasspathContext("default-config.xml");
+ dao = new DocumentDao(
+ BeanConfiguration.getBeans().getPersistenceClient());
+ }
+
+ @AfterClass
+ public static void close() {
+ BeanConfiguration.closeApplication();
+ }
+
+ @After
+ public void clear() {
+ try {
+ dao.deleteAll();
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testSet() throws KustvaktException {
+ Document doc = new Document("BRZ13_APR.00001");
+ doc.setDisabled(true);
+ dao.storeResource(doc, null);
+ }
+
+ @Test
+ public void testGet() {
+ Document doc = new Document("BRZ13_APR.00002");
+ doc.setDisabled(true);
+ try {
+ dao.storeResource(doc, null);
+ Document doc1 = dao.findbyId(doc.getPersistentID(), null);
+ assert doc1 != null && doc.isDisabled();
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testRemove() {
+ Document doc = new Document("BRZ13_APR.00003");
+ doc.setDisabled(true);
+ try {
+ dao.storeResource(doc, null);
+ Document doc1 = dao.findbyId(doc.getPersistentID(), null);
+ assert dao.deleteResource(doc.getPersistentID(), null) == 1;
+ doc1 = dao.findbyId(doc.getPersistentID(), null);
+ assert doc1 == null;
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+ @Test
+ public void testEmptyFind() {
+ List<String> dc = null;
+ try {
+ dc = dao.findbyCorpus("WPD", true);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ }
+
+ Assert.assertNotNull(dc);
+ Assert.assertEquals("should be empty", 0, dc.size());
+ }
+
+ @Test
+ public void testFind() {
+ int length = 10;
+ for (int i = 0; i < length; i++) {
+ Document doc = new Document("WPD_APR.0000" + i);
+ doc.setDisabled(true);
+ try {
+ dao.storeResource(doc, null);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+
+ List<String> dc = null;
+ try {
+ dc = dao.findbyCorpus("WPD", true);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ }
+
+ Assert.assertNotNull(dc);
+ Assert.assertNotSame("should not be empty", 0, dc.size());
+ Assert.assertEquals("not all found", length, dc.size());
+ }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
new file mode 100644
index 0000000..0b11863
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
@@ -0,0 +1,84 @@
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.ResourceDao;
+import de.ids_mannheim.korap.resources.KustvaktResource;
+import de.ids_mannheim.korap.resources.ResourceFactory;
+import de.ids_mannheim.korap.resources.VirtualCollection;
+import de.ids_mannheim.korap.user.User;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 26/01/2016
+ */
+public class ResourceDaoTest {
+
+ @BeforeClass
+ public static void init() {
+ BeanConfiguration.loadClasspathContext("default-config.xml");
+ TestHelper.setupAccount();
+ }
+
+ @AfterClass
+ public static void drop() {
+// TestHelper.dropUser();
+ BeanConfiguration.closeApplication();
+ }
+
+ @After
+ public void clear() throws KustvaktException {
+ new ResourceDao<>(BeanConfiguration.getBeans().getPersistenceClient())
+ .deleteAll();
+ }
+
+ @Test
+ public void createCollection() throws KustvaktException {
+ ResourceDao dao = new ResourceDao(
+ BeanConfiguration.getBeans().getPersistenceClient());
+ VirtualCollection c = ResourceFactory.createCollection("testColl", 1);
+ c.addField("key_1", "this is a test");
+ c.addField("key_2", 2);
+
+ User user = User.UserFactory
+ .getUser(TestHelper.getUserCredentials()[0]);
+
+ int id = dao.storeResource(c, user);
+
+ KustvaktResource r = dao.findbyId(id, user);
+ assert dao.size() > 0;
+ assert r != null;
+ assert r.getField("key_1") instanceof String;
+ assert r.getField("key_2") instanceof Integer;
+ }
+
+ @Test
+ public void ResourceDataUpdate() throws KustvaktException {
+ ResourceDao dao = new ResourceDao(
+ BeanConfiguration.getBeans().getPersistenceClient());
+ VirtualCollection c = ResourceFactory.createCollection("testColl", 1);
+ c.addField("key_1", "this is a test");
+ c.addField("key_2", 2);
+
+ User user = User.UserFactory
+ .getUser(TestHelper.getUserCredentials()[0]);
+
+ int id = dao.storeResource(c, user);
+
+ c.setId(id);
+ c.addField("key_3", -1);
+ int row_update = dao.updateResource(c, user);
+ assert row_update > 0;
+
+ KustvaktResource r = dao.findbyId(id, user);
+ assert dao.size() > 0;
+ assert r != null;
+ assert r.getField("key_1") instanceof String;
+ assert r.getField("key_2") instanceof Integer;
+ assert r.getField("key_3") instanceof Integer;
+
+ }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
new file mode 100644
index 0000000..94abd81
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
@@ -0,0 +1,95 @@
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
+import de.ids_mannheim.korap.user.*;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+;
+
+/**
+ * @author hanl
+ * @date 13/02/2015
+ */
+public class UserDaoTest {
+
+ @BeforeClass
+ public static void create() {
+ BeanConfiguration.loadClasspathContext("default-config.xml");
+ TestHelper.setupAccount();
+ TestHelper.runBootInterfaces();
+ }
+
+ @AfterClass
+ public static void close() {
+ assert TestHelper.dropUser();
+ BeanConfiguration.closeApplication();
+ }
+
+ @Test
+ public void userput() throws KustvaktException {
+ User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount(TestHelper.getUserCredentials()[0]);
+ Assert.assertEquals("user creation failed", true, user1.getId() != -1);
+ }
+
+ @Test
+ public void userget() throws KustvaktException {
+ User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount(TestHelper.getUserCredentials()[0]);
+ Assert.assertEquals("User Retrieval does not work",
+ TestHelper.getUserCredentials()[0], user1.getUsername());
+ }
+
+ // @Test
+ public void testUserdetailsGetNonExistent() throws KustvaktException {
+ TestHelper.setupSimpleAccount("userdbtest", "userdbTest");
+ User user = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount("userdbtest");
+ UserDataDbIface dao = UserdataFactory.getDaoInstance(UserDetails.class);
+ Userdata data = dao.get(user);
+ assert data == null;
+ TestHelper.dropUser("userdbtest");
+ }
+
+ // @Test
+ public void testUserSettingsGetNonExistent() throws KustvaktException {
+ TestHelper.setupSimpleAccount("userdbtest", "userdbTest");
+ User user = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount("userdbtest");
+ UserDataDbIface dao = UserdataFactory
+ .getDaoInstance(UserSettings.class);
+ Userdata data = dao.get(user);
+ assert data == null;
+ TestHelper.dropUser("userdbtest");
+
+ }
+
+ // username cannot currently be changed
+ // @Test
+ public void updateUsername() throws KustvaktException {
+ User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount(TestHelper.getUserCredentials()[0]);
+ user1.setUsername("new_user");
+ BeanConfiguration.getBeans().getUserDBHandler().updateAccount(user1);
+ User u2 = BeanConfiguration.getBeans().getUserDBHandler()
+ .getAccount("new_user");
+ Assert.assertEquals("not found", user1.getUsername(), u2.getUsername());
+ }
+
+ @Test
+ public void userupdate() throws KustvaktException {
+ EntityHandlerIface dao = BeanConfiguration.getBeans()
+ .getUserDBHandler();
+ User user1 = dao.getAccount(TestHelper.getUserCredentials()[0]);
+ user1.setAccountLocked(true);
+ dao.updateAccount(user1);
+ Assert.assertEquals("not valid", true,
+ dao.getAccount(user1.getUsername()).isAccountLocked());
+ }
+
+}
diff --git a/src/test/java/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
similarity index 100%
rename from src/test/java/CollectionRewriteTest.java
rename to src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
diff --git a/src/test/java/FoundryRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
similarity index 100%
rename from src/test/java/FoundryRewriteTest.java
rename to src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
diff --git a/src/test/java/IdRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
similarity index 100%
rename from src/test/java/IdRewriteTest.java
rename to src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
new file mode 100644
index 0000000..2771a06
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
@@ -0,0 +1,469 @@
+import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.DocumentDao;
+import de.ids_mannheim.korap.resource.rewrite.DocMatchRewrite;
+import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
+import de.ids_mannheim.korap.resources.Document;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import net.sf.ehcache.CacheManager;
+import org.junit.*;
+
+/**
+ * @author hanl
+ * @date 12/11/2015
+ */
+//fixme: tests only work with singleconnection data sources
+public class PostRewriteTest {
+
+ @BeforeClass
+ public static void setup() {
+ BeanConfiguration.loadClasspathContext("default-config.xml");
+ }
+
+ @AfterClass
+ public static void close() {
+ BeanConfiguration.closeApplication();
+ }
+
+ // otherwise cache will maintain values not relevant for other tests
+ @Before
+ public void before() {
+ CacheManager.getInstance().getCache("documents").removeAll();
+ }
+
+ @Test
+ public void testPostRewriteNothingToDo() {
+ RewriteHandler ha = new RewriteHandler(null);
+ Assert.assertEquals("Handler could not be added to rewriter instance!",
+ true, ha.add(DocMatchRewrite.class));
+
+ DocumentDao dao = new DocumentDao(
+ BeanConfiguration.getBeans().getPersistenceClient());
+ try {
+ Document d = dao.findbyId("BRZ13_APR.00014", null);
+ Assert.assertNull(d);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ }
+
+ String v = ha.postProcess(RESULT, null);
+ Assert.assertEquals("results do not match", JsonUtils.readTree(RESULT),
+ JsonUtils.readTree(v));
+ }
+
+ @Test
+ public void testPostRewriteRemoveDoc() {
+ DocumentDao dao = new DocumentDao(
+ BeanConfiguration.getBeans().getPersistenceClient());
+
+ Document doc = new Document("BRZ13_APR.00014");
+ doc.setDisabled(true);
+ try {
+ dao.storeResource(doc, null);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ RewriteHandler ha = new RewriteHandler(null);
+ Assert.assertEquals("Handler could not be added to rewriter instance!",
+ true, ha.add(DocMatchRewrite.class));
+
+ String v = ha.postProcess(RESULT, null);
+
+ JsonNode node = JsonUtils.readTree(v);
+
+ Assert.assertNotEquals("Wrong DocID", "BRZ13_APR.00014",
+ node.at("/matches/1/docID"));
+
+ try {
+ dao.deleteResource(doc.getPersistentID(), null);
+ Document d = dao.findbyId(doc.getPersistentID(), null);
+ if (d != null)
+ System.out.println("IS SUPPOSED TO BE NULL! " + d);
+ }catch (KustvaktException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ }
+
+ @Test
+ public void testPath() {
+ String v = "{\n" + " \"meta\": {\n" + " \"count\": 25,\n"
+ + " \"startIndex\": 0,\n"
+ + " \"timeout\": 120000,\n" + " \"context\": {\n"
+ + " \"left\": [\n" + " \"token\",\n"
+ + " 6\n" + " ],\n"
+ + " \"right\": [\n" + " \"token\",\n"
+ + " 6\n" + " ]\n" + " }}}";
+ JsonNode n = JsonUtils.readTree(v);
+
+ }
+
+ private static final String RESULT =
+ "{\n" + " \"meta\": {\n" + " \"count\": 25,\n"
+ + " \"startIndex\": 0,\n"
+ + " \"timeout\": 120000,\n"
+ + " \"context\": {\n" + " \"left\": [\n"
+ + " \"token\",\n" + " 6\n"
+ + " ],\n" + " \"right\": [\n"
+ + " \"token\",\n" + " 6\n"
+ + " ]\n" + " },\n"
+ + " \"fields\": [\n" + " \"textSigle\",\n"
+ + " \"author\",\n"
+ + " \"docSigle\",\n" + " \"title\",\n"
+ + " \"pubDate\",\n" + " \"UID\",\n"
+ + " \"corpusID\",\n"
+ + " \"textClass\",\n"
+ + " \"subTitle\",\n"
+ + " \"layerInfos\",\n" + " \"ID\",\n"
+ + " \"pubPlace\",\n"
+ + " \"corpusSigle\"\n" + " ],\n"
+ + " \"version\": \"unknown\",\n"
+ + " \"benchmark\": \"0.204314141 s\",\n"
+ + " \"totalResults\": 1755,\n"
+ + " \"serialQuery\": \"tokens:tt/l:Wort\",\n"
+ + " \"itemsPerPage\": 25\n" + " },\n"
+ + " \"query\": {\n"
+ + " \"@type\": \"koral:token\",\n"
+ + " \"wrap\": {\n"
+ + " \"@type\": \"koral:term\",\n"
+ + " \"key\": \"Wort\",\n"
+ + " \"layer\": \"lemma\",\n"
+ + " \"match\": \"match:eq\",\n"
+ + " \"foundry\": \"tt\",\n"
+ + " \"rewrites\": [\n" + " {\n"
+ + " \"@type\": \"koral:rewrite\",\n"
+ + " \"src\": \"Kustvakt\",\n"
+ + " \"operation\": \"operation:injection\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " },\n" + " \"matches\": [\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft familie-geschlecht\",\n"
+ + " \"title\": \"Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in ihrer Stimme schwingt bei diesem </span><mark>Wort</mark><span class=\\\"context-right\\\"> Sarkasmus mit. Bis man einen passenden<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00001-p454-455\",\n"
+ + " \"docID\": \"BRZ13_APR.00001\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Leben dick und prall\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der DLRG, ausgelassene Partys und markige </span><mark>Worte</mark><span class=\\\"context-right\\\"> des Dompredigers: „Ostern ist kein goethischer<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00014-p96-97\",\n"
+ + " \"docID\": \"BRZ13_APR.00014\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft biographien-interviews kultur musik\",\n"
+ + " \"title\": \"So wird es gemacht:\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>derfehlende Buchstabe.Gelingt es dir,das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vervollständigen? Tipp: Probiere auch mal rückwärts<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00055-p19-20\",\n"
+ + " \"docID\": \"BRZ13_APR.00055\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik ausland\",\n"
+ + " \"title\": \"Südkorea droht mit Angriffen – USA rüsten auf\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der Stunde. „Aus einem Krieg der </span><mark>Worte</mark><span class=\\\"context-right\\\"> darf kein echter Krieg werden“, sagte<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00076-p238-239\",\n"
+ + " \"docID\": \"BRZ13_APR.00076\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Dauercamper kämpfen für ihren Platz\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>„Initiative Campingplatz Räbke“. „Als ich das </span><mark>Wort</mark><span class=\\\"context-right\\\"> Schließung gelesen habe, war ich richtig<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00200-p255-256\",\n"
+ + " \"docID\": \"BRZ13_APR.00200\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Neue Aktionen lockten Besucher\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Jan Waldheim (CWG) unter den aufmunternden </span><mark>Worten</mark><span class=\\\"context-right\\\"> eines augenzwinkernden Axel Schnalke („Ein bisschen<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00210-p142-143\",\n"
+ + " \"docID\": \"BRZ13_APR.00210\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>trotzdem nicht. Selten wurden so viele </span><mark>Worte</mark><span class=\\\"context-right\\\">, die der Autor hier lieber verschweigt<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p166-167\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>zudem nicht immer nur bei den </span><mark>Worten</mark><span class=\\\"context-right\\\"> geblieben) und dabei gleichzeitig soviel Charme<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p191-192\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bedeutet Travestie sich zu verkleiden, das </span><mark>Wort</mark><span class=\\\"context-right\\\"> stammt aus dem Französischen. Traditionell belegten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p371-372\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"VfL kommt nicht vom Fleck\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>am internationalen Geschäft berechtigt. Mit anderen </span><mark>Worten</mark><span class=\\\"context-right\\\">: Die „Wölfe“ stecken im grauen Mittelmaß<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00260-p93-94\",\n"
+ + " \"docID\": \"BRZ13_APR.00260\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Mensch, Mayer! Super Tor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bekommst, ist das unbezahlbar – ein Bonus.“ </span><mark>Worte</mark><span class=\\\"context-right\\\">, die dem Torschützen weiteres Selbstvertrauen geben<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00275-p271-272\",\n"
+ + " \"docID\": \"BRZ13_APR.00275\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Nur Gerücht? KHL-Klub will „Dshuni“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und hakt das Thema ab.cb Kein </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Interesse aus Astana: Daniar Dshunussow.Foto<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00277-p163-164\",\n"
+ + " \"docID\": \"BRZ13_APR.00277\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft biographien-interviews\",\n"
+ + " \"title\": \"Das Leben ist nicht auf diese Erde beschränkt\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>1. Korinther 1,18 denken: Denn das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vom Kreuz ist eine Torheit denen<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00520-p32-33\",\n"
+ + " \"docID\": \"BRZ13_APR.00520\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Profis am Dienstag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> vom Führungsduo. Von Thorsten Grunow Wolfsburg<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p17-18\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Minuten setzte es am Dienstagnachmittag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> für die kickende Belegschaft, die durchaus<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p60-61\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Manager ist überzeugt, dass die klaren </span><mark>Worte</mark><span class=\\\"context-right\\\"> auf fruchtbaren Boden gefallen sind. „Ich<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p235-236\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland politik ausland\",\n"
+ + " \"title\": \"Zeitungsartikelzufällig deponiert?\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>erspart“, lautete die Schlagzeile – wobei das </span><mark>Wort</mark><span class=\\\"context-right\\\"> „erspart“ abgeschnitten war. Ein plumper Versuch<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07616-p31-32\",\n"
+ + " \"docID\": \"BRZ13_JAN.07616\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"„Philipp Rösler wackelt nicht“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Vizekanzler bei all dem Jubel zu </span><mark>Wort</mark><span class=\\\"context-right\\\"> kommt. „Ein großartiger Tag“, sagt er<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07617-p177-178\",\n"
+ + " \"docID\": \"BRZ13_JAN.07617\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Lanz gibt den charmanten, zurückhaltenden Gastgeber\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>er, als seine Assistentin ihm ins </span><mark>Wort</mark><span class=\\\"context-right\\\"> fiel. Dennoch holte das ungleiche Duo<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07621-p261-262\",\n"
+ + " \"docID\": \"BRZ13_JAN.07621\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Mundlos denkt über Rücktritt nach\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>räumte selbst ein, wie sarkastisch diese </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach einer solchen Wahlnacht klingen mussten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07694-p192-193\",\n"
+ + " \"docID\": \"BRZ13_JAN.07694\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Volksfreundhaus hört man kein schlechtes </span><mark>Wort</mark><span class=\\\"context-right\\\"> über den Kanzlerkandidaten Peer Steinbrück – und<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p169-170\",\n"
+ + " \"docID\": \"BRZ13_JAN.07695\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Volksfreundhaus merklich steigen. Hier hat das </span><mark>Wort</mark><span class=\\\"context-right\\\"> von der Wahlparty bei Bier, Bockwurst<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p266-267\",\n"
+ + " \"docID\": \"BRZ13_JAN.07695\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft kirche\",\n"
+ + " \"title\": \"Fernsehen überträgt Gottesdienst\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>schon mal von der Sendung „Das </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Sonntag“ gehört. Das sind Predigten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07840-p37-38\",\n"
+ + " \"docID\": \"BRZ13_JAN.07840\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Wahlkrimi im Ratssaal\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ihre Konkurrentin Glosemeyer hatte sie warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> übrig. „Für den ersten Anlauf eine<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07848-p147-148\",\n"
+ + " \"docID\": \"BRZ13_JAN.07848\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n" + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Warme Worte nach eiskaltem Wahlkampf\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\">Warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach eiskaltem Wahlkampf Die SPD feierte<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07850-p1-2\",\n"
+ + " \"docID\": \"BRZ13_JAN.07850\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " }\n" + " ]\n" + "}";
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
new file mode 100644
index 0000000..a46282c
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -0,0 +1,38 @@
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.resource.rewrite.*;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 21/10/2015
+ */
+public class RewriteHandlerTest {
+
+ @BeforeClass
+ public static void setup() {
+ BeanConfiguration.loadClasspathContext();
+ }
+
+ @Test
+ public void initHandler() {
+ RewriteHandler handler = new RewriteHandler(null);
+ handler.add(FoundryInject.class);
+ }
+
+ @Test
+ public void testRewriteTastAdd() {
+ RewriteHandler handler = new RewriteHandler(null);
+ handler.add(FoundryInject.class);
+ handler.add(DocMatchRewrite.class);
+ handler.add(CollectionCleanupFilter.class);
+ handler.add(IdWriter.class);
+ }
+
+ @AfterClass
+ public static void close() {
+ BeanConfiguration.closeApplication();
+ }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
new file mode 100644
index 0000000..efcf6c0
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
@@ -0,0 +1,106 @@
+package de.ids_mannheim.korap.security.auth;
+
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
+import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
+import de.ids_mannheim.korap.user.*;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 04/02/2016
+ */
+public class KustvaktAuthenticationManagerTest {
+
+ @BeforeClass
+ public static void create() {
+ BeanConfiguration.loadClasspathContext("default-config.xml");
+ assert TestHelper.setupAccount();
+ }
+
+ @AfterClass
+ public static void close() {
+ assert TestHelper.dropUser();
+ BeanConfiguration.closeApplication();
+ }
+
+ @After
+ public void after() throws KustvaktException {
+ User user = BeanConfiguration.getBeans().getAuthenticationManager()
+ .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
+ BeanConfiguration.getBeans().getAuthenticationManager()
+ .deleteAccount(user);
+ }
+
+ @Test
+ public void testCreateUser() throws KustvaktException {
+ User user = BeanConfiguration.getBeans().getAuthenticationManager()
+ .createUserAccount(KustvaktConfiguration.KUSTVAKT_USER, false);
+
+ EntityHandlerIface dao = BeanConfiguration.getBeans()
+ .getUserDBHandler();
+
+ assert dao.size() > 0;
+ User check = dao.getAccount(user.getUsername());
+ assert check != null;
+ }
+
+ @Test
+ public void testUserdetailsGet() throws KustvaktException {
+ testCreateUser();
+ AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+ .getAuthenticationManager();
+
+ User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
+
+ Userdata data = manager.getUserData(user, UserDetails.class);
+
+ assert data != null;
+ }
+
+ @Test
+ public void testUsersettingsGet() throws KustvaktException {
+ testCreateUser();
+ AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+ .getAuthenticationManager();
+
+ User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
+
+ Userdata data = manager.getUserData(user, UserSettings.class);
+ assert data != null;
+ }
+
+ @Test(expected = KustvaktException.class)
+ public void testUserDetailsGetNonExistent() throws KustvaktException {
+ testCreateUser();
+ AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+ .getAuthenticationManager();
+
+ User user = new KorAPUser(10, "random");
+
+ Userdata data = manager.getUserData(user, UserDetails.class);
+ assert data != null;
+ }
+
+ @Test(expected = KustvaktException.class)
+ public void testUserSettingsGetNonExistent() throws KustvaktException {
+ testCreateUser();
+ AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+ .getAuthenticationManager();
+
+ User user = new KorAPUser(10, "random");
+
+ Userdata data = manager.getUserData(user, UserSettings.class);
+ assert data != null;
+ }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/AuthServiceTest.java
deleted file mode 100644
index af4ebdd..0000000
--- a/src/test/java/de/ids_mannheim/korap/web/service/AuthServiceTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package de.ids_mannheim.korap.web.service;
-
-/**
- * @author hanl
- * @date 24/09/2015
- */
-public class AuthServiceTest extends FastJerseyTest {
-
- //todo: test basicauth via secure connection
-
-
-
-
-
-}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
new file mode 100644
index 0000000..2b3667a
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -0,0 +1,17 @@
+package de.ids_mannheim.korap.web.service.full;
+
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
+
+/**
+ * @author hanl
+ * @date 24/09/2015
+ */
+public class AuthServiceTest extends FastJerseyTest {
+
+ //todo: test basicauth via secure connection
+
+
+
+
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
similarity index 85%
rename from src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
rename to src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
index d42a446..f297953 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
@@ -1,10 +1,11 @@
-package de.ids_mannheim.korap.web.service;
+package de.ids_mannheim.korap.web.service.full;
import com.sun.jersey.api.client.ClientResponse;
import de.ids_mannheim.korap.config.BeanConfiguration;
import de.ids_mannheim.korap.query.serialize.CollectionQueryProcessor;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -22,7 +23,7 @@
@BeforeClass
public static void configure() {
BeanConfiguration.loadClasspathContext();
- setPackages("de.ids_mannheim.korap.web.service.light",
+ FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.light",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
}
@@ -45,8 +46,8 @@
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Wort]")
.queryParam("ql", "poliqarp").get(ClientResponse.class);
-// System.out.println("_______________________________________________");
-// System.out.println(response.getEntity(String.class));
+ // System.out.println("_______________________________________________");
+ // System.out.println(response.getEntity(String.class));
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
@@ -57,14 +58,14 @@
ClientResponse response = resource().path(getAPIVersion())
.path("search").post(ClientResponse.class, s.toJSON());
-// System.out.println("_______________________________________________ RAW");
-// System.out.println(response.getEntity(String.class));
+ // System.out.println("_______________________________________________ RAW");
+ // System.out.println(response.getEntity(String.class));
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
// in case no index is there, this will throw an error
- @Ignore
@Test
+ @Ignore
public void testGetMatchInfoThrowsNoException() {
ClientResponse response = resource().path(getAPIVersion())
.get(ClientResponse.class);
@@ -88,9 +89,9 @@
.post(ClientResponse.class, "creationDate in 1787");
String ent = response.getEntity(String.class);
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
-// System.out
-// .println("___________________________________________________");
-// System.out.println("STATS ENTITY " + ent);
+ // System.out
+ // .println("___________________________________________________");
+ // System.out.println("STATS ENTITY " + ent);
}
// @Test
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java
similarity index 94%
rename from src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
rename to src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java
index 4f27150..377b4e8 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.web.service;
+package de.ids_mannheim.korap.web.service.full;
import com.fasterxml.jackson.databind.JsonNode;
import com.sun.jersey.api.client.ClientResponse;
@@ -8,6 +8,7 @@
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -21,7 +22,7 @@
@BeforeClass
public static void configure() {
BeanConfiguration.loadClasspathContext("default-config.xml");
- setPackages("de.ids_mannheim.korap.web.service.full",
+ FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
TestHelper.runBootInterfaces();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
similarity index 95%
rename from src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
rename to src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
index e1dc167..b94be84 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.web.service;
+package de.ids_mannheim.korap.web.service.full;
import com.fasterxml.jackson.databind.JsonNode;
import com.sun.jersey.api.client.ClientResponse;
@@ -7,6 +7,7 @@
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -31,7 +32,7 @@
@BeforeClass
public static void configure() {
BeanConfiguration.loadClasspathContext("default-config.xml");
- setPackages("de.ids_mannheim.korap.web.service",
+ FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");