Updated light services and fixed the tests.

Change-Id: Ia2744ae1d7f76d2af27d030546f4eeb5119b3d5e
diff --git a/core/pom.xml b/core/pom.xml
index 77c03a8..e47a2e9 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -8,7 +8,7 @@
 	<properties>
 		<java.version>1.7</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring-framework.version>4.3.7.RELEASE</spring-framework.version>
+		<spring-framework.version>4.3.11.RELEASE</spring-framework.version>
 		<jersey.version>1.19.4</jersey.version>
 	</properties>
 	<build>
@@ -225,7 +225,7 @@
 		<dependency>
 			<groupId>org.xerial</groupId>
 			<artifactId>sqlite-jdbc</artifactId>
-			<version>3.8.10.1</version>
+			<version>3.20.1</version>
 		</dependency>
 
 		<dependency>
diff --git a/full/pom.xml b/full/pom.xml
index 6feb320..6422a7d 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -7,7 +7,7 @@
 	<properties>
 		<java.version>1.7</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring-framework.version>4.3.7.RELEASE</spring-framework.version>
+		<spring-framework.version>4.3.11.RELEASE</spring-framework.version>
 		<jersey.version>1.19.4</jersey.version>
 	</properties>
 	<build>
@@ -196,14 +196,6 @@
 		</dependency>
 
 		<!-- Spring -->
-<!-- 		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-test</artifactId>
-			<version>${spring-framework.version}</version>
-			<scope>compile</scope>
-		</dependency>
- -->
-<!-- copied from extension -->
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-jdbc</artifactId>
diff --git a/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java b/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
index 2d9e984..1479564 100644
--- a/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
+++ b/full/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
@@ -1,20 +1,22 @@
 package de.ids_mannheim.korap.handlers;
 
-import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.utils.BooleanUtils;
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Setter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.SQLException;
+import java.util.HashMap;
+
+import javax.sql.DataSource;
+
 import org.springframework.core.io.InputStreamResource;
 import org.springframework.core.io.Resource;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
 
-import javax.sql.DataSource;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.SQLException;
-import java.util.HashMap;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.utils.BooleanUtils;
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.Setter;
 
 /**
  * @author hanl
@@ -25,8 +27,7 @@
 
     @Setter(AccessLevel.NONE)
     private DataSource dataSource;
-
-
+    
     public JDBCClient (DataSource datasource) {
         NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(
                 datasource);
diff --git a/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java b/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
index 890beb7..f3a79a8 100644
--- a/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/security/ResourcesTest.java
@@ -135,7 +135,6 @@
     public void initMethod () throws KustvaktException {
         helper().setupAccount();
         c1 = new Corpus("WPD_test");
-//        helper().runBootInterfaces();
         helper().setupResource(c1);
     }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index 5ba2749..f5ddb0d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -1,7 +1,6 @@
 package de.ids_mannheim.korap.web.service;
 
 import org.junit.Before;
-import org.springframework.beans.factory.annotation.Autowired;
 
 import de.ids_mannheim.korap.config.ContextHolder;
 import de.ids_mannheim.korap.config.TestHelper;
@@ -13,13 +12,6 @@
                     "de.ids_mannheim.korap.web.filter",
                     "de.ids_mannheim.korap.web.utils" };
 
-
-    @Override
-    public void close () {
-        super.close();
-        
-    }
-    
     protected TestHelper helper () {
         try {
             return TestHelper.newInstance(this.context);
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index de4cfe2..593d38e 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -36,8 +36,6 @@
 			<array>
 				<value>classpath:test-jdbc.properties</value>
 				<value>classpath:hibernate.properties</value>
-				<!-- <value>file:./jdbc.properties</value> -->
-				<!-- <value>file:./kustvakt-test.conf</value> -->
 				<value>classpath:kustvakt-test.conf</value>
 			</array>
 		</property>
@@ -55,43 +53,49 @@
 		<constructor-arg name="properties" ref="props" />
 	</bean>
 
-	<!--class="org.apache.commons.dbcp2.BasicDataSource" -->
-	<!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
 	<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
 		lazy-init="true">
 		<property name="driverClassName" value="${jdbc.driverClassName}" />
 		<property name="url" value="${jdbc.url}" />
 		<property name="username" value="${jdbc.username}" />
 		<property name="password" value="${jdbc.password}" />
-		<!-- relevant for single connection datasource and sqlite -->
-		<!-- <property name="suppressClose"> <value>true</value> </property> -->
-		<!--<property name="initialSize" value="2"/> -->
-		<property name="maxTotal" value="4" />
-		<property name="maxIdle" value="2" />
+		<property name="maxTotal" value="1" />
+		<property name="maxIdle" value="1" />
 		<property name="minIdle" value="1" />
 		<property name="maxWaitMillis" value="15000" />
 		<!--<property name="poolPreparedStatements" value="true"/> -->
 	</bean>
 
+	<!-- use SingleConnection only for testing! -->
 	<bean id="sqliteDataSource"
 		class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
-		lazy-init="true">
-		<property name="driverClassName" value="${jdbc.driverClassName}" />
+		lazy-init="true" destroy-method="destroy">
+		<!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> -->
 		<property name="url" value="${jdbc.url}" />
 		<property name="username" value="${jdbc.username}" />
 		<property name="password" value="${jdbc.password}" />
-		<!-- relevant for single connection datasource and sqlite -->
+		<!-- Sqlite can only have a single connection -->
 		<property name="suppressClose">
 			<value>true</value>
 		</property>
-		<!--<property name="initialSize" value="2"/> -->
-		<!--<property name="poolPreparedStatements" value="true"/> -->
+	</bean>
+	
+	<bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
+	    destroy-method="close">
+	    <property name="driverClass" value="${jdbc.driverClassName}" />
+		<property name="jdbcUrl" value="${jdbc.url}" />
+		<property name="user" value="${jdbc.username}" />
+		<property name="password" value="${jdbc.password}" />
+	    <property name="maxPoolSize" value="1" />
+	    <property name="minPoolSize" value="1" />
+	    <property name="maxStatements" value="1" />
+	    <property name="testConnectionOnCheckout" value="true" />
 	</bean>
 
 	<!-- to configure database for sqlite, mysql, etc. migrations -->
 	<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
-		<property name="baselineOnMigrate" value="true" />
-		<property name="locations" value="classpath:db.sqlite" />
+		<property name="baselineOnMigrate" value="false" />
+		<property name="locations" value="${jdbc.schemaPath}" />
 		<property name="dataSource" ref="sqliteDataSource" />
 	</bean>
 
diff --git a/lite/pom.xml b/lite/pom.xml
index 02fe1af..fc394fb 100644
--- a/lite/pom.xml
+++ b/lite/pom.xml
@@ -7,7 +7,7 @@
 	<properties>
 		<java.version>1.7</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring-framework.version>4.3.7.RELEASE</spring-framework.version>
+		<spring-framework.version>4.3.11.RELEASE</spring-framework.version>
 		<jersey.version>1.19.4</jersey.version>
 	</properties>
 
diff --git a/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index 476b6bf..e86279d 100644
--- a/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -4,12 +4,14 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -33,7 +35,6 @@
 import de.ids_mannheim.korap.utils.KustvaktLogger;
 import de.ids_mannheim.korap.web.ClientsHandler;
 import de.ids_mannheim.korap.web.SearchKrill;
-import de.ids_mannheim.korap.web.TRACE;
 import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
 
 /**
@@ -41,7 +42,14 @@
  * @date 29/01/2014
  * 
  * @author margaretha
- * @date 21/09/2017
+ * @update 10/10/2017
+ * 
+ * <pre>
+ * Recent changes:
+ * - removed version from service paths
+ * - altered service with path /search and method trace to path
+ * /query and method get
+ * </pre>
  */
 @Controller
 @Path("/")
@@ -90,15 +98,16 @@
     }
 
 
-    @TRACE
-    @Path("search")
+    @GET
+    @Path("query")
     public Response buildQuery (@QueryParam("q") String q,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String context,
             @QueryParam("cutoff") Boolean cutoff,
             @QueryParam("count") Integer pageLength,
             @QueryParam("offset") Integer pageIndex,
-            @QueryParam("page") Integer startPage, @QueryParam("cq") String cq) {
+            @QueryParam("page") Integer startPage,
+            @QueryParam("cq") String cq) {
         QuerySerializer ss = new QuerySerializer().setQuery(q, ql, v);
 
         MetaQueryBuilder meta = new MetaQueryBuilder();
@@ -109,8 +118,7 @@
         meta.setSpanContext(context);
         meta.addEntry("cutOff", cutoff);
         ss.setMeta(meta.raw());
-        if (cq != null)
-            ss.setCollection(cq);
+        if (cq != null) ss.setCollection(cq);
 
         String query;
         try {
@@ -125,7 +133,8 @@
 
     @POST
     @Path("search")
-    public Response queryRaw (@QueryParam("engine") String engine, String jsonld) {
+    public Response queryRaw (@QueryParam("engine") String engine,
+            String jsonld) {
         try {
             jsonld = processor.processQuery(jsonld, null);
         }
@@ -136,10 +145,10 @@
         jlog.info("Serialized search: {}", jsonld);
         try {
             String result = searchKrill.search(jsonld);
-            KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
+            jlog.debug("The result set: {}", result);
             return Response.ok(result).build();
-        } catch(Exception e) {
-            System.out.println("_____________________________________" );
+        }
+        catch (Exception e) {
             e.printStackTrace();
         }
         return Response.ok().build();
@@ -167,8 +176,7 @@
         if (fields != null && !fields.isEmpty())
             meta.addEntry("fields", fields);
         serializer.setMeta(meta.raw());
-        if (cq != null)
-            serializer.setCollection(cq);
+        if (cq != null) serializer.setCollection(cq);
 
         String query;
         try {
@@ -225,8 +233,9 @@
      * @return
      */
     //fixme: search in collection /collection/collection-id/search
+    @Deprecated
     @GET
-    @Path("/{type}/{id}/search")
+    //    @Path("/{type}/{id}/search")
     public Response searchbyName (@PathParam("id") String id,
             @PathParam("type") String type, @QueryParam("q") String query,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
@@ -257,10 +266,9 @@
         String result;
         try {
             if (eng.equals(KustvaktConfiguration.BACKENDS.NEO4J)) {
-                if (raw)
-                    throw KustvaktResponseHandler.throwit(
-                            StatusCodes.ILLEGAL_ARGUMENT, "raw not supported!",
-                            null);
+                if (raw) throw KustvaktResponseHandler.throwit(
+                        StatusCodes.ILLEGAL_ARGUMENT, "raw not supported!",
+                        null);
                 MultivaluedMap map = new MultivaluedMapImpl();
                 map.add("q", query);
                 map.add("count", String.valueOf(pageLength));
@@ -284,55 +292,44 @@
     }
 
 
-//    //todo: switch to new serialization
-//    @POST
-//    @Path("stats")
-//    public Response getStats (String json) {
-//        KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
-//        builder.with(json);
-//
-//        // todo: policy override in extension!
-//        String stats = searchKrill.getStatistics(builder.toJSON());
-//        if (stats.contains("-1"))
-//            throw KustvaktResponseHandler.throwit(StatusCodes.NO_VALUE_FOUND);
-//
-//        return Response.ok(stats).build();
-//    }
-    
     @GET
     @Path("statistics")
-    public Response getStatistics (@QueryParam("collectionQuery") 
-            String collectionQuery) {
-        
+    public Response getStatistics (
+            @QueryParam("collectionQuery") String collectionQuery) {
+
         KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
         builder.with(collectionQuery);
         String json = builder.toJSON();
-        
+
         String stats = searchKrill.getStatistics(json);
         if (stats.contains("-1"))
             throw KustvaktResponseHandler.throwit(StatusCodes.NO_VALUE_FOUND);
-        jlog.debug("Stats: "+stats);
+        jlog.debug("Stats: " + stats);
         return Response.ok(stats).build();
     }
 
 
 
-	/*
-	 * TODO: The problem here is, that the matchinfo path makes no
-	 * distinction between docs and texts - unlike DeReKo, the backend
-	 * and the frontend. Luckily there is a convenient method
-	 * "getMatchID()" for a workaround, but this should be fixed.
-	 */
+    /*
+     * TODO: The problem here is, that the matchinfo path makes no
+     * distinction between docs and texts - unlike DeReKo, the backend
+     * and the frontend. Luckily there is a convenient method
+     * "getMatchID()" for a workaround, but this should be fixed.
+     */
     @GET
     @Path("/corpus/{corpusId}/{docId}/{textId}/{matchId}/matchInfo")
     public Response getMatchInfo (@PathParam("corpusId") String corpusId,
             @PathParam("docId") String docId,
-            @PathParam("textId") String textId, 
+            @PathParam("textId") String textId,
             @PathParam("matchId") String matchId,
             @QueryParam("foundry") Set<String> foundries,
             @QueryParam("layer") Set<String> layers,
-            @QueryParam("spans") Boolean spans) throws KustvaktException {
-        String matchid = searchKrill.getMatchId(corpusId, docId, textId, matchId);
+            @QueryParam("spans") Boolean spans,
+            @Context HttpServletRequest request) throws KustvaktException {
+
+        String matchid =
+                searchKrill.getMatchId(corpusId, docId, textId, matchId);
+        
         List<String> f_list = null;
         List<String> l_list = null;
         if (layers != null && !layers.isEmpty())
@@ -343,14 +340,14 @@
             f_list = new ArrayList<>(foundries);
 
         spans = spans != null ? spans : false;
-		
+
         boolean match_only = foundries == null || foundries.isEmpty();
         String results;
         if (match_only)
-            results = searchKrill.getMatch(matchid,null);
+            results = searchKrill.getMatch(matchid, null);
         else
             results = searchKrill.getMatch(matchid, f_list, l_list, spans,
-                    false, true,null);
+                    false, true, null);
 
         return Response.ok(results).build();
     }
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyLightTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyLightTest.java
index 8d87265..81ae635 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyLightTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyLightTest.java
@@ -23,7 +23,7 @@
     }
 
     @Before
-    public static void startServerBeforeFirstTestRun () {
+    public void startServerBeforeFirstTestRun () {
         if (testContainer == null) {
             initServer(PORT, classPackages);
             startServer();
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
index 17c7df6..e0ecf31 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
@@ -5,8 +5,6 @@
 import static org.junit.Assert.assertNotNull;
 
 import org.apache.lucene.LucenePackage;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
@@ -17,28 +15,48 @@
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 /**
- * EM: FIX ME: Database restructure
- * 
  * Created by hanl on 29.04.16.
+ * 
+ * @author margaretha
+ * @date 10/10/2017
+ * 
+ * Recent changes:
+ * - updated the service paths and methods of query serialization tests
+ * - added statistic service test
  */
-@Ignore
 public class LightServiceTest extends FastJerseyLightTest {
 
     @Override
     public void initMethod () throws KustvaktException {}
 
-
     @Test
-    public void testQueryTrace () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=das]")
-                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
-                .queryParam("count", "13")
-                .method("TRACE", ClientResponse.class);
+    public void testStatistics () {
+        ClientResponse response = resource()
+                .path("statistics")
+                .queryParam("collectionQuery", "textType=Autobiographie & corpusSigle=GOE")
+                .method("GET", ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
         String query = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
+        assertEquals(9, node.at("/documents").asInt());
+        assertEquals(527662, node.at("/tokens").asInt());
+        assertEquals(19387, node.at("/sentences").asInt());
+        assertEquals(514, node.at("/paragraphs").asInt());
+    }
+
+    @Test
+    public void testGetJSONQuery () {
+        ClientResponse response = resource()
+                .path("query").queryParam("q", "[orth=das]")
+                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
+                .queryParam("count", "13")
+                .method("GET", ClientResponse.class);
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
+        String query = response.getEntity(String.class);
+        System.out.println(query);
+        JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
         assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
@@ -49,11 +67,11 @@
 
     @Test
     public void testbuildAndPostQuery () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=das]")
+        ClientResponse response = resource()
+                .path("query").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
                 .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
-                .method("TRACE", ClientResponse.class);
+                .method("GET", ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
 
@@ -61,7 +79,7 @@
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
 
-        response = resource().path(getAPIVersion()).path("search")
+        response = resource().path("search")
                 .post(ClientResponse.class, query);
 
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -74,7 +92,7 @@
 
     @Test
     public void testQueryGet () {
-        ClientResponse response = resource().path(getAPIVersion())
+        ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp").queryParam("context", "sentence")
                 .queryParam("count", "13").get(ClientResponse.class);
@@ -92,7 +110,7 @@
 
     @Test
     public void testFoundryRewrite () {
-        ClientResponse response = resource().path(getAPIVersion())
+        ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp").queryParam("context", "sentence")
                 .queryParam("count", "13").get(ClientResponse.class);
@@ -111,7 +129,7 @@
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[orth=das]", "poliqarp");
 
-        ClientResponse response = resource().path(getAPIVersion())
+        ClientResponse response = resource()
                 .path("search").post(ClientResponse.class, s.toJSON());
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
@@ -125,7 +143,7 @@
 
     @Test
     public void testParameterField () {
-        ClientResponse response = resource().path(getAPIVersion())
+        ClientResponse response = resource()
                 .path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
                 .queryParam("fields", "author, docSigle")
@@ -145,7 +163,7 @@
 	@Test
 	public void testMatchInfoGetWithoutSpans () {
         ClientResponse response = resource()
-			.path(getAPIVersion())
+			
 			.path("corpus/GOE/AGA/01784/p36-46/matchInfo")
 			.queryParam("foundry", "*")
 			.queryParam("spans", "false")
@@ -162,7 +180,7 @@
 	@Test
 	public void testMatchInfoGet2 () {
         ClientResponse response = resource()
-			.path(getAPIVersion())
+			
 			.path("corpus/GOE/AGA/01784/p36-46/matchInfo")
 			.queryParam("foundry", "*")
 			.get(ClientResponse.class);
@@ -176,14 +194,14 @@
 	};
 
     @Test
-    public void testCQParameter () {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=das]")
+    public void testCollectionQueryParameter () {
+        ClientResponse response = resource()
+                .path("query").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
                 .queryParam("fields", "author, docSigle")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .queryParam("cq", "textClass=Politik & corpus=WPD")
-                .method("TRACE", ClientResponse.class);
+                .method("GET", ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
         String query = response.getEntity(String.class);
@@ -194,15 +212,15 @@
                 .asText());
         assertEquals("WPD", node.at("/collection/operands/1/value").asText());
 
-        response = resource().path(getAPIVersion()).path("search")
+        response = resource().path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author, docSigle")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .queryParam("cq", "textClass=Politik & corpus=WPD")
                 .get(ClientResponse.class);
         String version = LucenePackage.get().getImplementationVersion();;
-        System.out.println("VERSION "+ version);
-        System.out.println("RESPONSE "+ response);
+//        System.out.println("VERSION "+ version);
+//        System.out.println("RESPONSE "+ response);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
         query = response.getEntity(String.class);