Added and improved tests, added collectionQuery to CollectionLoader.

Change-Id: I6a10f8b7d0397493417e2e9914895317b46fae78
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
index 1f4846d..73324ea 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -1,31 +1,9 @@
 package de.ids_mannheim.korap.config;
 
-import de.ids_mannheim.korap.exceptions.EmptyResultException;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.*;
-import de.ids_mannheim.korap.interfaces.AuthenticationIface;
-import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
-import de.ids_mannheim.korap.interfaces.EncryptionIface;
-import de.ids_mannheim.korap.interfaces.db.*;
-import de.ids_mannheim.korap.interfaces.defaults.KustvaktEncryption;
-import de.ids_mannheim.korap.resources.KustvaktResource;
-import de.ids_mannheim.korap.security.ac.PolicyDao;
-import de.ids_mannheim.korap.security.auth.*;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.TimeUtils;
-import de.ids_mannheim.korap.web.service.BootableBeanInterface;
-import org.apache.commons.collections.map.HashedMap;
-import org.apache.commons.dbcp2.BasicDataSource;
-import org.flywaydb.core.Flyway;
-import org.joda.time.DateTime;
-import org.junit.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.jdbc.core.RowCallbackHandler;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-import org.springframework.jdbc.datasource.SingleConnectionDataSource;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.io.File;
 import java.io.IOException;
@@ -34,9 +12,56 @@
 import java.security.NoSuchAlgorithmException;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
-import static org.junit.Assert.*;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.flywaydb.core.Flyway;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.jdbc.core.RowCallbackHandler;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.jdbc.datasource.SingleConnectionDataSource;
+
+import de.ids_mannheim.korap.exceptions.EmptyResultException;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.AdminDao;
+import de.ids_mannheim.korap.handlers.DocumentDao;
+import de.ids_mannheim.korap.handlers.EntityDao;
+import de.ids_mannheim.korap.handlers.JDBCAuditing;
+import de.ids_mannheim.korap.handlers.JDBCClient;
+import de.ids_mannheim.korap.handlers.ResourceDao;
+import de.ids_mannheim.korap.handlers.UserDetailsDao;
+import de.ids_mannheim.korap.handlers.UserSettingsDao;
+import de.ids_mannheim.korap.interfaces.AuthenticationIface;
+import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.interfaces.db.AdminHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.AuditingIface;
+import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.interfaces.db.PolicyHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
+import de.ids_mannheim.korap.interfaces.defaults.KustvaktEncryption;
+import de.ids_mannheim.korap.resources.KustvaktResource;
+import de.ids_mannheim.korap.security.ac.PolicyDao;
+import de.ids_mannheim.korap.security.auth.APIAuthentication;
+import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager;
+import de.ids_mannheim.korap.security.auth.OpenIDconnectAuthentication;
+import de.ids_mannheim.korap.security.auth.SessionAuthentication;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.utils.TimeUtils;
+import de.ids_mannheim.korap.web.service.BootableBeanInterface;
 
 /**
  * creates a test user that can be used to access protected functions
@@ -46,6 +71,7 @@
  */
 public class TestHelper {
 
+    private static String mainConfigurationFile = "kustvakt-test.conf";
     private static Logger jlog = LoggerFactory.getLogger(TestHelper.class);
     private static final Map<String, Object> data = new HashMap<>();
     static  {
@@ -424,7 +450,7 @@
         @Override
         public KustvaktConfiguration getConfig () {
             KustvaktConfiguration c = new KustvaktConfiguration();
-            InputStream s = ConfigLoader.loadConfigStream("kustvakt.conf");
+            InputStream s = ConfigLoader.loadConfigStream(mainConfigurationFile);
             if (s != null)
                 c.setPropertiesAsStream(s);
             else {
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java
new file mode 100644
index 0000000..ebd094d
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/QuerySerializationServiceTest.java
@@ -0,0 +1,252 @@
+package de.ids_mannheim.korap.web.service.full;
+/**
+ * @author hanl, margaretha
+ * @lastUpdate 19/04/2017
+ *
+ */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
+
+public class QuerySerializationServiceTest extends FastJerseyTest {
+
+    @Override
+    public void initMethod () throws KustvaktException {
+        helper().runBootInterfaces();
+    }
+
+
+    @BeforeClass
+    public static void configure () throws Exception {
+        FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
+                "de.ids_mannheim.korap.web.filter",
+                "de.ids_mannheim.korap.web.utils");
+    }
+    
+    @Test
+    public void testQuerySerializationFilteredPublic () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("corpus/WPD15/search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("context", "base/s:s")
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertEquals("corpusSigle", node.at("/collection/key").asText());
+        assertEquals("WPD15", node.at("/collection/value").asText());
+    }
+    
+    
+
+    @Test
+    public void testQuerySerializationUnexistingResource () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("corpus/ZUW19/search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("context", "base/s:s")
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertEquals(101, node.at("/errors/0/0").asInt());
+        assertEquals("[Cannot found public resources with ids: [ZUW19]]",
+                node.at("/errors/0/2").asText());
+    }
+    
+    @Test
+    public void testQuerySerializationWithNonPublicCorpus () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("corpus/BRZ10/search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("context", "base/s:s")
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertEquals(101, node.at("/errors/0/0").asInt());
+        assertEquals("[Cannot found public resources with ids: [BRZ10]]",
+                node.at("/errors/0/2").asText());
+    }
+
+    @Test
+    public void testQuerySerializationWithAuthentication () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("corpus/BRZ10/search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertEquals("koral:doc", node.at("/collection/@type").asText());
+        assertEquals("corpusSigle", node.at("/collection/key").asText());
+        assertEquals("BRZ10", node.at("/collection/value").asText());
+    }
+
+    @Test
+    public void testQuerySerializationWithNewCollection () {
+        // Add Virtual Collection
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("virtualcollection")
+                .queryParam("filter", "false")
+                .queryParam("name", "Weimarer Werke")
+                .queryParam("description", "Goethe-Werke in Weimar (seit 1775)")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .post(ClientResponse.class, "creationDate since 1775 & corpusSigle=GOE");
+        
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        
+        String ent = response.getEntity(String.class);
+        
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertTrue(node.isObject());
+        assertEquals("Weimarer Werke", node.path("name").asText());
+
+        // Get virtual collections
+        response = resource()
+                .path(getAPIVersion())
+                .path("collection")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        ent = response.getEntity(String.class);
+        node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+
+        Iterator<JsonNode> it = node.elements();
+        String id = null;
+        while (it.hasNext()) {
+            JsonNode next = (JsonNode) it.next();
+            if ("Weimarer Werke".equals(next.path("name").asText()))
+                id = next.path("id").asText();
+        }
+        assertNotNull(id);
+        assertFalse(id.isEmpty());
+
+        // query serialization service
+        response = resource()
+                .path(getAPIVersion())
+                .path("collection")
+                .path(id)
+                .path("search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("context", "base/s:s")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        ent = response.getEntity(String.class);
+        node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+                .asText());
+        assertEquals("creationDate", node.at("/collection/operands/0/key")
+                .asText());
+        assertEquals("1775", node.at("/collection/operands/0/value")
+                .asText());
+        assertEquals("type:date", node.at("/collection/operands/0/type")
+                .asText());
+        assertEquals("match:geq", node.at("/collection/operands/0/match")
+                .asText());
+        
+        assertEquals("koral:doc", node.at("/collection/operands/1/@type")
+                .asText());
+        assertEquals("corpusSigle", node.at("/collection/operands/1/key")
+                .asText());
+        assertEquals("GOE", node.at("/collection/operands/1/value")
+                .asText());
+        assertEquals("match:eq", node.at("/collection/operands/1/match")
+                .asText());
+    }
+    
+    @Test
+    public void testQuerySerializationOfVirtualCollection () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("collection/WPD15-VC/search")
+                .queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("context", "base/s:s")
+                .method("TRACE", ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+                .asText());
+        assertEquals("corpusSigle", node.at("/collection/operands/0/key").asText());
+        assertEquals("WPD15", node.at("/collection/operands/0/value").asText());
+        assertEquals("koral:doc", node.at("/collection/operands/1/@type")
+                .asText());
+        assertEquals("creationDate", node.at("/collection/operands/1/key").asText());
+        assertEquals("2014-04-01", node.at("/collection/operands/1/value").asText());
+
+    }
+    
+    @Test
+    public void testMetaQuerySerialization () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("search")
+                .queryParam("context", "sentence")
+                .queryParam("count", "20")
+                .queryParam("page", "5")
+                .queryParam("q", "[pos=ADJA]")
+                .queryParam("ql", "poliqarp")
+                .method("TRACE", ClientResponse.class);
+        assertEquals(response.getStatus(),
+                ClientResponse.Status.OK.getStatusCode());
+        
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        
+        assertEquals("sentence", node.at("/meta/context").asText());
+        assertEquals(20, node.at("/meta/count").asInt());
+        assertEquals(5, node.at("/meta/startPage").asInt());
+    }
+
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoTest.java
new file mode 100644
index 0000000..f7aaaaf
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceInfoTest.java
@@ -0,0 +1,188 @@
+package de.ids_mannheim.korap.web.service.full;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
+/**
+ * @author hanl, margaretha
+ * @lastUpdate 19/04/2017
+ *
+ */
+public class ResourceInfoTest extends FastJerseyTest {
+
+    @Override
+    public void initMethod () throws KustvaktException {
+        helper().runBootInterfaces();
+    }
+
+
+    @BeforeClass
+    public static void configure () throws Exception {
+        FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
+                "de.ids_mannheim.korap.web.filter",
+                "de.ids_mannheim.korap.web.utils");
+    }
+
+
+    @Test
+    public void testGetPublicVirtualCollections () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("collection").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals(1, node.size());
+    }
+
+
+    @Test
+    public void testGetVirtualCollectionsWithAuthentication () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("collection")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertTrue(node.isArray());
+        assertEquals(2, node.size());
+    }
+
+
+    @Test
+    public void testGetVirtualCollectionById () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("collection").path("WPD15-VC").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.size());
+        assertEquals("Wikipedia Virtual Collection",
+                node.path("name").asText());
+        assertEquals("German Wikipedia 2015",
+                node.path("description").asText());
+    }
+
+
+    @Test
+    public void testGetPublicCorpora () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertTrue(node.isArray());
+        assertEquals(2, node.size());
+    }
+
+
+    @Test
+    public void testGetCorpusById () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").path("WPD15").get(ClientResponse.class);
+        String ent = response.getEntity(String.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertTrue(node.isObject());
+        assertEquals("WPD15", node.path("id").asText());
+    }
+
+
+    @Test
+    public void testGetCorpusById2 () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").path("GOE").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertTrue(node.isObject());
+        assertEquals("GOE", node.path("id").asText());
+    }
+
+
+    @Test
+    public void testGetPublicFoundries () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("foundry").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertTrue(node.isArray());
+        assertEquals(10, node.size());
+    }
+
+
+    @Test
+    public void testGetFoundryById () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("foundry").path("tt").get(ClientResponse.class);
+        String ent = response.getEntity(String.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.size());
+    }
+
+
+    @Test
+    public void testGetUnexistingCorpus () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").path("ZUW19").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode error = JsonUtils.readTree(ent).get("errors").get(0);
+        assertEquals(101, error.get(0).asInt());
+        assertEquals("[Cannot found public resources with ids: [ZUW19]]",
+                error.get(2).asText());
+    }
+
+
+    // EM: queries for an unauthorized corpus get the same responses / treatment as 
+    // asking for an unexisting corpus. Does it need a specific exception instead?
+    @Test
+    public void testGetUnauthorizedCorpus () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").path("BRZ10").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode error = JsonUtils.readTree(ent).get("errors").get(0);
+        assertEquals(101, error.get(0).asInt());
+        assertEquals("[Cannot found public resources with ids: [BRZ10]]",
+                error.get(2).asText());
+    }
+
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index 544c790..cb642da 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -42,181 +42,8 @@
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
-        
-        //containerURI = "https://localhost/";
     }
 
-
-    @Test
-    public void testSearchSimpleAuthorized () {
-        ClientResponse response = resource()
-                .path(getAPIVersion())
-                .path("search")
-                .queryParam("q", "[orth=die]")
-                .queryParam("ql", "poliqarp")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assertNotNull(node);
-        assertNotEquals(0, node.path("matches").size());
-    }
-
-
-    @Test
-    public void testSearchSimpleWithCQAuthorized () {
-        ClientResponse response = resource()
-                .path(getAPIVersion())
-                .path("search")
-                .queryParam("q", "[orth=das]")
-                .queryParam("ql", "poliqarp")
-                .queryParam("cq", "textClass=politik & corpusSigle=WPD")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assertNotNull(node);
-        assertEquals(2, node.at("/collection/operands").size());
-        assertEquals("textClass", node.at("/collection/operands/0/key")
-                .asText());
-        assertEquals("corpusSigle", node.at("/collection/operands/1/key")
-                .asText());
-        assertEquals("koral:token", node.at("/query/@type").asText());
-    }
-
-
-    @Test
-    public void testSearchSimpleDemo () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.path("matches").size());
-    }
-
-
-    @Test
-    public void testSearchSentenceMeta () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.path("matches").size());
-        assertEquals("base/s:s", node.at("/meta/context").asText());
-        assertNotEquals("${project.version}", "/meta/version");
-    }
-
-
-    @Test
-    public void testSearchSimpleCQL () {
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery("(der) or (das)", "CQL");
-
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.path("matches").size());
-    }
-
-
-    @Test
-    public void testSearchRawQuery () {
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery("[orth=der]", "poliqarp");
-        //        s.setCollection("corpusSigle=WPD");
-
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-
-
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.path("matches").size());
-    }
-
-
-    @Test
-    public void testCollectionsGetPublic () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assertNotNull(node);
-        assertNotEquals(0, node.size());
-    }
-
-
-    @Test
-    public void testCollectionsGet () {
-        ClientResponse response = resource()
-                .path(getAPIVersion())
-                .path("collection")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assertNotNull(node);
-        assertTrue(node.isArray());
-        assertNotEquals(0, node.size());
-    }
-
-
-    @Test
-    public void testCorporaGet () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isArray());
-        assertNotEquals(0, node.size());
-    }
-
-
-    @Test
-    public void testFoundriesGet () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("foundry").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isArray());
-        assertNotEquals(0, node.size());
-    }
-
-
     // create a simple test collection for user kustvakt, otherwise test fails
     @Test
     @Ignore
@@ -254,23 +81,14 @@
         assertTrue(docs < 15);
     }
 
+    
 
-    // todo:
+    // EM: The test covers multiple operations because it deals with 
+    // the same resource and needs an order to operate (store followed by
+    // update followed by delete).
     @Test
-    @Ignore
-    public void testCollecionGet () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").path("id").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.size());
-    }
-
-    @Test
-    public void testResourceStore() throws KustvaktException, JsonProcessingException, IOException {
+    public void testVirtualCollectionStoreUpdateDelete() throws KustvaktException, 
+        JsonProcessingException, IOException {
     	// resource store service
         ClientResponse response = resource()
                 .path(getAPIVersion())
@@ -307,7 +125,7 @@
         assertNotNull(res);
         Assert.assertEquals("Goethe",res.getName().toString());
         
-//         no update resource service
+        // no update resource service
         response = resource()
                 .path(getAPIVersion())
                 .path("virtualcollection")
@@ -366,206 +184,7 @@
     }
 
 
-    @Test
-    public void testCorpusGet () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("WPD15").get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isObject());
-        assertEquals("WPD15", node.path("id").asText());
-    }
-
-    @Test
-    public void testCorpusGet2 () {
-    	ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("GOE").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isObject());
-        assertEquals("GOE", node.path("id").asText());
-    }
     
-    
-    @Test
-    @Ignore
-    public void testCorpusGetUnauthorized () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("BRZ20").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isObject());
-        assertNotNull(node);
-    }
-
-    @Test
-    public void testFoundryGet () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("foundry").path("tt").get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertNotEquals(0, node.size());
-    }
-
-
-    
-
-    @Test
-    public void testSerializationQueryWithCorpusThroughFilteredPublic () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus/WPD15/search").queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
-                .method("TRACE", ClientResponse.class);
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        //String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-        assertEquals("WPD15", node.at("/collection/value").asText());
-    }
-
-
-    @Test
-    public void testSerializationQueryWithCorpus () {
-        ClientResponse response = resource()
-                .path(getAPIVersion())
-                .path("corpus/WPD15/search")
-                .queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .method("TRACE", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        String ent = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertEquals("koral:doc", node.at("/collection/@type").asText());
-        assertEquals("corpusSigle", node.at("/collection/key").asText());
-    }
-
-    @Test
-    public void testSerializationQueryWithCollection () {
-    	// Add Virtual Collection
-    	ClientResponse response = resource()
-                .path(getAPIVersion())
-                .path("virtualcollection")
-                .queryParam("filter", "false")
-                .queryParam("name", "Weimarer Werke")
-                .queryParam("description", "Goethe-Werke in Weimar (seit 1775)")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .post(ClientResponse.class, "creationDate since 1775 & corpusSigle=GOE");
-        
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        
-        String ent = response.getEntity(String.class);
-        
-        JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertTrue(node.isObject());
-        assertEquals("Weimarer Werke", node.path("name").asText());
-
-        // Get virtual collections
-        response = resource()
-                .path(getAPIVersion())
-                .path("collection")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        ent = response.getEntity(String.class);
-        node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-
-        Iterator it = node.elements();
-        String id = null;
-        while (it.hasNext()) {
-            JsonNode next = (JsonNode) it.next();
-            if ("Weimarer Werke".equals(next.path("name").asText()))
-                id = next.path("id").asText();
-        }
-        assertNotNull(id);
-        assertFalse(id.isEmpty());
-
-        response = resource()
-                .path(getAPIVersion())
-                .path("collection")
-                .path(id)
-                .path("search")
-                .queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp")
-                .queryParam("context", "base/s:s")
-                .header(Attributes.AUTHORIZATION,
-                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
-                .method("TRACE", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
-                response.getStatus());
-        ent = response.getEntity(String.class);
-        node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-
-        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
-        assertEquals("koral:doc", node.at("/collection/operands/0/@type")
-                .asText());
-        assertEquals("koral:doc", node.at("/collection/operands/1/@type")
-                .asText());
-        assertEquals("creationDate", node.at("/collection/operands/0/key")
-                .asText());
-        assertEquals("corpusSigle", node.at("/collection/operands/1/key")
-                .asText());
-
-    }
-
-
-    @Test
-    public void testSearchQueryPublicCorpora () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=der]")
-                .queryParam("ql", "poliqarp").get(ClientResponse.class);
-        assertEquals(response.getStatus(),
-                ClientResponse.Status.OK.getStatusCode());
-        String ent = response.getEntity(String.class);
-		JsonNode node = JsonUtils.readTree(ent);
-        assertNotNull(node);
-        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
-        assertEquals("operation:or", node.at("/collection/operation").asText());
-        assertNotEquals(0, node.at("/collection/operands").size());
-    }
-
-
-    // use trace for this
-    @Test
-    @Ignore
-    public void testSerializationMeta () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("context", "sentence")
-                .queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
-
-                .method("TRACE", ClientResponse.class);
-        assertEquals(response.getStatus(),
-                ClientResponse.Status.OK.getStatusCode());
-    }
-
-
     @Test
     public void testMatchInfoGet () {
     }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
new file mode 100644
index 0000000..e77647a
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
@@ -0,0 +1,172 @@
+package de.ids_mannheim.korap.web.service.full;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+
+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.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.web.service.FastJerseyTest;
+
+/**
+ * @author hanl, margaretha
+ * @lastUpdate 19/04/2017
+ *
+ */
+public class SearchServiceTest extends FastJerseyTest {
+
+    @Override
+    public void initMethod () throws KustvaktException {
+        helper().runBootInterfaces();
+    }
+
+
+    @BeforeClass
+    public static void configure () throws Exception {
+        FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
+                "de.ids_mannheim.korap.web.filter",
+                "de.ids_mannheim.korap.web.utils");
+    }
+
+
+    @Test
+    public void testSearchQueryPublicCorpora () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp").get(ClientResponse.class);
+        assertEquals(response.getStatus(),
+                ClientResponse.Status.OK.getStatusCode());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:or", node.at("/collection/operation").asText());
+        assertNotEquals(0, node.at("/collection/operands").size());
+        assertEquals("corpusSigle([GOE, WPD15])",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+
+
+    @Test
+    public void testSearchSimpleAuthorized () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=die]")
+                .queryParam("ql", "poliqarp")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
+        assertEquals("corpusSigle([BRZ10, GOE, WPD15])",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+
+
+    @Test
+    public void testSearchSimpleWithCQAuthorized () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp")
+                .queryParam("cq", "textClass=politik & corpusSigle=BRZ10")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assertNotNull(node);
+        assertEquals(2, node.at("/collection/operands").size());
+        assertEquals("textClass",
+                node.at("/collection/operands/0/key").asText());
+        assertEquals("corpusSigle",
+                node.at("/collection/operands/1/key").asText());
+        assertEquals("koral:token", node.at("/query/@type").asText());
+    }
+
+
+    @Test
+    public void testSearchSimpleDemo () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp").get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
+        assertEquals("corpusSigle([GOE, WPD15])",
+                node.at("/collection/rewrites/0/scope").asText());
+    }
+
+
+
+    @Test
+    public void testSearchSentenceMeta () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[orth=der]")
+                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
+                .get(ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
+        assertEquals("base/s:s", node.at("/meta/context").asText());
+        assertNotEquals("${project.version}", "/meta/version");
+    }
+
+
+    @Test
+    public void testSearchSimpleCQL () {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("(der) or (das)", "CQL");
+
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").post(ClientResponse.class, s.toJSON());
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
+        assertEquals(17027, node.at("/meta/totalResults").asInt());
+    }
+
+
+    @Test
+    public void testSearchRawQuery () {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[orth=der]", "poliqarp");
+        s.setCollection("corpusSigle=GOE");
+
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").post(ClientResponse.class, s.toJSON());
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String ent = response.getEntity(String.class);
+
+
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
+        assertEquals(10993, node.at("/meta/totalResults").asInt());
+    }
+
+}
diff --git a/src/test/resources/policy-test.conf b/src/test/resources/policy-test.conf
new file mode 100644
index 0000000..4156a76
--- /dev/null
+++ b/src/test/resources/policy-test.conf
@@ -0,0 +1,57 @@
+# type	id	name	description	condition	permissions	collectionQuery
+
+virtualcollection	WPD15-VC	Wikipedia Virtual Collection	German Wikipedia 2015	public	read	corpusSigle=WPD15 & creationDate since 2014-04-01	
+virtualcollection	BRZ10-PC	Braunschweiger Collection	Selected Braunschweiger Zeitung	ids	read	corpusSigle=BRZ10 & foundries ~ Connexor
+corpus	WPD15	Wikipedia	German Wikipedia 2015	public	read
+corpus	GOE	Goethe	Goethe corpus	public	read
+corpus	BRZ10	Braunschweiger	Braunschweiger Zeitung 2010	ids	read
+type	id	name	description	condition	permissions
+foundry	base	base	Base foundry	public	read
+foundry	dereko	dereko	DeReKo foundry	public	read
+foundry	corenlp	corenlp	CoreNLP parser	public	read
+foundry	opennlp	opennlp	OpenNLP parser	public	read
+foundry	malt	malt	MALT parser	public	read
+foundry	mdp	mdp	MD parser	public	read
+foundry	tt	tt	Tree Tagger parser	public	read
+foundry	sgbr	sgbr	Schreibgebrauch	ids	read
+foundry	cnx	cnx	Connexor parser	ids	read
+foundry	drukola	drukola	DruKoLa parser	drukola	read
+foundry	glemm	glemm	Glemm	public	read
+foundry	marmot	marmot	MarMoT parser	public	read
+foundry	mate	mate	Mate parser	public	read
+foundry	xip	xip	Xerox Incremental Parser	ids	read
+layer	cnx/c	cnx/c	Connexor constituency layer	ids	read
+layer	cnx/syn	cnx/syn	Connexor syntax	ids	read
+layer	cnx/p	cnx/p	Connexor part of speech	ids	read
+layer	cnx/l	cnx/l	Connexor lemma	ids	read
+layer	cnx/m	cnx/m	Connexor morphology	ids	read
+layer	corenlp/c	corenlp/c	CoreNLP constituency	public	read
+layer	corenlp/p	corenlp/p	CoreNLP part of speech	public	read
+layer	corenlp/s	corenlp/s	CoreNLP structure	public	read
+layer	corenlp/ne	corenlp/ne	CoreNLP named entities	public	read
+layer	dereko/s	dereko/s	DeReKo structure	public	read
+layer	drukola/l	drukola/l	Drukola lemma	drukola	read
+layer	drukola/p	drukola/p	Drukola part of speech	drukola	read
+layer	drukola/m	drukola/m	Drukola morphology	drukola	read
+layer	glemm/l	glemm/l	GLEMM lemma	public	read
+layer	malt/d	malt/d	MALT dependency	public	read
+layer	marmot/p	marmot/p	Marmot part of speech	public	read
+layer	marmot/m	marmot/m	Marmot morphology	public	read
+layer	mate/d	mate/d	MATE dependency	public	read
+layer	mate/l	mate/l	MATE lemma	public	read
+layer	mate/p	mate/p	MATE part of speech	public	read
+layer	mate/m	mate/m	MATE morphology	public	read
+layer	mdp/d	mdp/d	MDP dependency	public	read
+layer	opennlp/p	opennlp/p	OpenNLP part of speech	public	read
+layer	opennlp/s	opennlp/s	OpenNLP part of speech	public	read
+layer	sgbr/p	sgbr/p	Schreibgebrauchp part of peech	ids	read
+layer	sgbr/l	sgbr/l	Schreibgebrauch lemma	ids	read
+layer	sgbr/lv	sgbr/lv	Schreibgebrauch lemmav ariant	ids	read
+layer	tt/p	tt/p	Tree Tagger part of speech	public	read
+layer	tt/l	tt/l	Tree Tagger lemma	public	read
+layer	tt/s	tt/s	Tree Tagger structure	public	read
+layer	xip/c	xip/c	XIP constituency	ids	read
+layer	xip/d	xip/d	XIP dependency	ids	read
+layer	xip/l	xip/l	XIP lemma	ids	read
+layer	xip/p	xip/p	XIP part of speech	ids	read
+layer	xip/s	xip/s	XIP structure	ids	read
diff --git a/src/test/resources/test-default-config.xml b/src/test/resources/test-default-config.xml
index 48e97a8..19f7e89 100644
--- a/src/test/resources/test-default-config.xml
+++ b/src/test/resources/test-default-config.xml
@@ -23,8 +23,8 @@
 		<property name="ignoreResourceNotFound" value="true" />
 		<property name="locations">
 			<array>
-				<value>classpath:kustvakt.conf</value>
-				<value>file:./kustvakt.conf</value>
+				<value>classpath:kustvakt-test.conf</value>
+				<value>file:./kustvakt-test.conf</value>
 			</array>
 		</property>
 	</bean>