diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index aeb753f..8acd4fb 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -1,4 +1,5 @@
 import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.utils.CollectionQueryBuilder3;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import org.junit.Test;
@@ -12,7 +13,7 @@
     @Test
     public void testsimpleAdd() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "WPD");
+        b.addQuery("corpusID=WPD");
 
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
@@ -25,9 +26,7 @@
     @Test
     public void testSimpleConjunction() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "WPD").and()
-                .addSegment("textClass", CollectionQueryBuilder3.EQ.EQUAL,
-                        "freizeit");
+        b.addQuery("corpusID=WPD & textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
         assert node != null;
@@ -43,11 +42,12 @@
     @Test
     public void testSimpleDisjunction() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "WPD").or()
-                .addSegment("textClass", CollectionQueryBuilder3.EQ.EQUAL,
-                        "freizeit");
+        b.addQuery("corpusID=WPD | textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
+        System.out.println("_____________________________________________");
+        System.out.println(node);
+
         assert node != null;
         assert node.at("/collection/operation").asText().equals("operation:or");
         assert node.at("/collection/operands/0/key").asText()
@@ -59,11 +59,13 @@
     @Test
     public void testComplexSubQuery() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "ADF").or()
-                .addSub("textClass=freizeit & corpusID=WPD");
-
+        b.addQuery(
+                "(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
+        System.out.println(
+                "_____________________________________________ COMPLEX");
+        System.out.println(node);
         assert node != null;
         assert node.at("/collection/operation").asText().equals("operation:or");
         assert node.at("/collection/operands/0/key").asText()
@@ -76,13 +78,11 @@
     @Test
     public void testAddResourceQueryAfter() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "ADF").or()
-                .addSub("textClass=freizeit & corpusID=WPD");
+        b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
 
         CollectionQueryBuilder3 c = new CollectionQueryBuilder3();
         c.setBaseQuery(b.toJSON());
-        c.addSegment("textClass", CollectionQueryBuilder3.EQ.EQUAL,
-                "wissenschaft");
+        c.addQuery("textClass=wissenschaft");
 
         JsonNode node = JsonUtils.readTree(c.toJSON());
 
@@ -96,12 +96,11 @@
     @Test
     public void testAddComplexResourceQueryAfter() {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addSegment("corpusID", CollectionQueryBuilder3.EQ.EQUAL, "ADF").or()
-                .addSub("textClass=freizeit & corpusID=WPD");
+        b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
 
         CollectionQueryBuilder3 c = new CollectionQueryBuilder3();
         c.setBaseQuery(b.toJSON());
-        c.addSub("(textClass=politik & corpusID=AZPS)");
+        c.addQuery("(textClass=politik & corpusID=AZPS)");
 
         JsonNode node = JsonUtils.readTree(c.toJSON());
 
@@ -115,4 +114,21 @@
 
     }
 
+    @Test
+    public void buildQuery() {
+        String query = "[base=Haus]";
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery(query, "poliqarp");
+        CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
+        b.addQuery("corpusID=WPD");
+        s.setCollection("corpusID=WPD");
+
+        System.out.println("QUERY " + s.toJSON());
+    }
+
+    @Test
+    public void testBaseQueryBuild() {
+
+    }
+
 }
diff --git a/src/test/java/FileAuditingTest.java b/src/test/java/FileAuditingTest.java
index 5646590..23b589c 100644
--- a/src/test/java/FileAuditingTest.java
+++ b/src/test/java/FileAuditingTest.java
@@ -6,7 +6,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
 import java.util.Date;
 
 /**
@@ -24,8 +23,10 @@
     @AfterClass
     public static void finish() {
         BeanConfiguration.closeApplication();
-        File f = new File("logs/default_audit.log");
-        assert f.length() > 0;
+//        File f = new File("logs/default_audit.log");
+//        System.out.println("------------------------------------------------------");
+//        System.out.println("FILE LENGTH "+f.length());
+//        assert f.length() > 0;
     }
 
     @Test
diff --git a/src/test/java/IdRewriteTest.java b/src/test/java/IdRewriteTest.java
index 8415c2c..6c0b8c4 100644
--- a/src/test/java/IdRewriteTest.java
+++ b/src/test/java/IdRewriteTest.java
@@ -20,7 +20,7 @@
     }
 
     @AfterClass
-    public static void drop() {
+    public static void close() {
         BeanConfiguration.closeApplication();
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index d098502..4a2ca67 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -18,6 +18,12 @@
         BeanConfiguration.closeApplication();
     }
 
+
+    @Test
+    public void create() {
+        BeanConfiguration.loadClasspathContext("test-config.xml");
+    }
+
     @Test
     public void testServiceVersion() {
         String v = ServiceVersion.getAPIVersion();
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
deleted file mode 100644
index fb7eaa7..0000000
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package de.ids_mannheim.korap.config;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
-import de.ids_mannheim.korap.user.KorAPUser;
-import de.ids_mannheim.korap.user.User;
-import org.junit.Assert;
-
-import java.util.Arrays;
-
-/**
- * creates a test user that can be used to access protected functions
- *
- * @author hanl
- * @date 16/10/2015
- */
-public class TestHelper {
-
-    private static final String[] credentials = new String[] { "test1",
-            "testPass#2015" };
-
-    public static boolean setup() {
-        boolean r = BeanConfiguration.hasContext();
-        if (r) {
-            EntityHandlerIface dao = BeanConfiguration.getBeans()
-                    .getUserDBHandler();
-
-            KorAPUser user = User.UserFactory
-                    .getUser(credentials[0], credentials[1]);
-            try {
-                Assert.assertNotNull("userdatabase handler must not be null",
-                        dao);
-                dao.createAccount(user);
-            }catch (KustvaktException e) {
-                e.printStackTrace();
-                return false;
-            }
-        }
-        return r;
-    }
-
-    public static final String[] getCredentials() {
-        return Arrays.copyOf(credentials, 2);
-    }
-
-    private TestHelper() {
-    }
-
-}
diff --git a/src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java b/src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java
new file mode 100644
index 0000000..91bc3fe
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/config/UserTestHelper.java
@@ -0,0 +1,95 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.user.User;
+import org.junit.Assert;
+import org.springframework.jdbc.core.RowCallbackHandler;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.*;
+
+/**
+ * creates a test user that can be used to access protected functions
+ *
+ * @author hanl
+ * @date 16/10/2015
+ */
+public class UserTestHelper {
+
+    private static final String[] credentials = new String[] { "test1",
+            "testPass2015" };
+
+    public static boolean setup() {
+        boolean r = BeanConfiguration.hasContext();
+        if (r) {
+            EntityHandlerIface dao = BeanConfiguration.getBeans()
+                    .getUserDBHandler();
+            Map m = new HashMap<>();
+            m.put(Attributes.USERNAME, credentials[0]);
+            m.put(Attributes.PASSWORD, credentials[1]);
+
+            Assert.assertNotNull("userdatabase handler must not be null", dao);
+
+            try {
+                BeanConfiguration.getBeans().getAuthenticationManager()
+                        .createUserAccount(m, false);
+            }catch (KustvaktException e) {
+                // do nothing
+                return false;
+            }
+        }
+        return r;
+    }
+
+    public static boolean drop() {
+        boolean r = BeanConfiguration.hasContext();
+        if (r) {
+            EntityHandlerIface dao = BeanConfiguration.getBeans()
+                    .getUserDBHandler();
+            try {
+                User us = dao.getAccount(credentials[0]);
+                dao.deleteAccount(us.getId());
+            }catch (KustvaktException e) {
+                // do nothing
+            }
+        }
+        return r;
+    }
+
+    public static boolean truncateAll() {
+        boolean r = BeanConfiguration.hasContext();
+        if (r) {
+            String sql = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES";
+            final Set<String> queries = new HashSet<>();
+            PersistenceClient cl = BeanConfiguration.getBeans()
+                    .getPersistenceClient();
+            NamedParameterJdbcTemplate source = (NamedParameterJdbcTemplate) cl
+                    .getSource();
+
+            source.query(sql, new RowCallbackHandler() {
+                @Override
+                public void processRow(ResultSet rs) throws SQLException {
+                    queries.add(rs.getString(1));
+
+                }
+            });
+            System.out.println(queries);
+            for (String query : queries)
+                source.update(query, new HashMap<String, Object>());
+        }
+        return r;
+    }
+
+    public static final String[] getCredentials() {
+        return Arrays.copyOf(credentials, 2);
+    }
+
+    private UserTestHelper() {
+    }
+
+}
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
index 10d5855..af4ebdd 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/AuthServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/AuthServiceTest.java
@@ -10,4 +10,6 @@
 
 
 
+
+
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index ca2600b..c49b605 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -25,7 +25,7 @@
  */
 public abstract class FastJerseyTest {
 
-    protected static String API_VERSION = "v0.1";
+    private final static String API_VERSION = "v0.1";
 
     private static DefaultResourceConfig resourceConfig = new DefaultResourceConfig();
 
@@ -48,6 +48,10 @@
         resourceConfig.getSingletons().add(resourceSingleton);
     }
 
+    public String getAPIVersion() {
+        return API_VERSION;
+    }
+
     public static <T> void addProviderForContext(Class<T> contextClass,
             T contextObject) {
         addSingleton(
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
index d8bf7df..3e8c1a0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktCoreRestTest.java
@@ -3,6 +3,7 @@
 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 org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -32,21 +33,33 @@
         BeanConfiguration.closeApplication();
     }
 
-    @Test
+    //    @Test
     public void testFieldsInSearch() {
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .queryParam("q", "[base=Wort]").queryParam("ql", "poliqarp")
-                .get(ClientResponse.class);
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[base=Wort]")
+                .queryParam("ql", "poliqarp").get(ClientResponse.class);
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
-        System.out.println("RESPONSE IS " + response.getEntity(String.class));
     }
 
     @Test
     public void testQuery() {
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .queryParam("q", "Sonne prox/unit=word/distance<=5 Erde")
-                .queryParam("ql", "CQL").get(ClientResponse.class);
-        System.out.println(response);
+        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));
+        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+    }
+
+    @Test
+    public void testQueryRaw() {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[base=Wort]", "poliqarp");
+
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").post(ClientResponse.class, s.toJSON());
+        System.out.println("_______________________________________________ RAW");
+        System.out.println(response.getEntity(String.class));
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
@@ -54,34 +67,45 @@
     @Ignore
     @Test
     public void testGetMatchInfoThrowsNoException() {
-        ClientResponse response = resource().path(API_VERSION)
+        ClientResponse response = resource().path(getAPIVersion())
                 .get(ClientResponse.class);
     }
 
-    @Test
+    //    @Test
     public void testGetStatsThrowsNoException() {
         CollectionQueryProcessor pr = new CollectionQueryProcessor();
         pr.process("corpusID=WPD & textClass=Sport");
         Map map = new LinkedHashMap();
         map.put("collection", pr.getRequestMap());
-        ClientResponse response = resource().path(API_VERSION).path("stats")
+        ClientResponse response = resource().path(getAPIVersion()).path("stats")
                 .post(ClientResponse.class, JsonUtils.toJSON(map));
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
     @Test
+    public void testGetStats2ThrowsNoException() {
+        ClientResponse response = resource().path(getAPIVersion()).path("stats")
+                .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);
+    }
+
+    //    @Test
     public void testBuildQueryThrowsNoException() {
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .queryParam("q", "[base=Haus & surface=Hauses]")
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[base=Haus & surface=Hauses]")
                 .queryParam("ql", "poliqarp").queryParam("cutOff", "true")
                 .queryParam("page", "1").method("TRACE", ClientResponse.class);
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
-    @Test
+    //    @Test
     public void testQueryByNameThrowsNoException() {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
-                .path("WPD").path("search")
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus").path("WPD").path("search")
                 .queryParam("q", "[base=Haus & surface=Hauses]")
                 .queryParam("ql", "poliqarp").queryParam("cutOff", "true")
                 .queryParam("page", "1").get(ClientResponse.class);
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
new file mode 100644
index 0000000..6829064
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
@@ -0,0 +1,88 @@
+package de.ids_mannheim.korap.web.service;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.ClientResponse;
+import de.ids_mannheim.korap.config.BeanConfiguration;
+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.KustvaktBaseServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 14/01/2016
+ */
+public class KustvaktResourceServiceTest extends FastJerseyTest {
+
+    @BeforeClass
+    public static void configure() {
+        BeanConfiguration.loadClasspathContext("default-config.xml");
+        setPackages("de.ids_mannheim.korap.web.service.full",
+                "de.ids_mannheim.korap.web.filter",
+                "de.ids_mannheim.korap.web.utils");
+
+        KustvaktBaseServer.runPreStart();
+    }
+
+    @AfterClass
+    public static void close() {
+        BeanConfiguration.closeApplication();
+    }
+
+    @Test
+    public void testSearchSimple() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[base=Wort]")
+                .queryParam("ql", "poliqarp")
+                //                .queryParam("cq", "corpusID=GOE")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assert node.path("matches").size() > 0;
+    }
+
+    @Test
+    public void testCollectionGet() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("collection").header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assert node.size() > 0;
+    }
+
+    @Test
+    public void testStats() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("collection").header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        assert node != null;
+        String id = node.path(0).path("id").asText();
+
+        response = resource().path(getAPIVersion()).path("collection").path(id)
+                .path("stats").header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+                .get(ClientResponse.class);
+        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        node = JsonUtils.readTree(response.getEntity(String.class));
+        System.out.println("STATS RESULT: ");
+        System.out.println(node);
+    }
+
+    @Test
+    public void testResourceStore() {
+
+    }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
index 847b875..1d2f68a 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2EndpointTest.java
@@ -1,12 +1,14 @@
 package de.ids_mannheim.korap.web.service;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.ClientResponse;
 import de.ids_mannheim.korap.config.BeanConfiguration;
-import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.config.UserTestHelper;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.utils.JsonUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Test;
 
 /**
  * @author hanl
@@ -15,8 +17,11 @@
 // todo: needs servlet container test server!
 public class OAuth2EndpointTest extends FastJerseyTest {
 
+    private static String[] credentials;
+
     @AfterClass
     public static void close() {
+        UserTestHelper.drop();
         BeanConfiguration.closeApplication();
     }
 
@@ -27,24 +32,68 @@
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
 
-        TestHelper.setup();
-        String[] cred = TestHelper.getCredentials();
-
-        String header = BasicHttpAuth.encode(cred[0], cred[1]);
+        UserTestHelper.setup();
+        credentials = UserTestHelper.getCredentials();
     }
 
-    @Test
+//    @Test
     public void testAuthorizeClient() {
-        ClientResponse response = resource().path("v0.2").path("oauth2")
+        ClientResponse response = resource().path("v0.1").path("oauth2")
                 .path("register")
                 .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
                 .header("Host", "korap.ids-mannheim.de")
                 .post(ClientResponse.class);
-        System.out.println(response);
+        assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
     }
 
+//    @Test
     public void testRevokeClient() {
+        ClientResponse response = resource().path("v0.1").path("oauth2")
+                .path("register")
+                .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
+                .header("Host", "korap.ids-mannheim.de")
+                .post(ClientResponse.class);
+        assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
+        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
 
     }
 
+//    @Test
+    public void authenticate() {
+        String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
+        ClientResponse response = resource().path("v0.1").path("oauth2")
+                .path("register")
+                .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
+                .header("Host", "korap.ids-mannheim.de")
+                .header(Attributes.AUTHORIZATION, enc)
+                .post(ClientResponse.class);
+        assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
+        String e = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(e);
+
+        String cl_s = node.path("client_secret").asText();
+        String cl_id = node.path("client_id").asText();
+
+        response = resource().path("v0.1").path("oauth2").path("authorize")
+                .queryParam("client_id", cl_id)
+                .queryParam("client_secret", cl_s)
+                .queryParam("response_type", "code")
+                .queryParam("redirect_uri", "korap.ids-mannheim.de/redirect")
+//                .header(Attributes.AUTHORIZATION, enc)
+                .header("Content-Type", "application/x-www-form-urlencoded")
+                .post(ClientResponse.class);
+
+        e = response.getEntity(String.class);
+        assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
+        node = JsonUtils.readTree(e);
+
+        response = resource().path("v0.1").path("oauth2").path("authorize")
+                .queryParam("code", node.path("authorization_code").asText())
+                .queryParam("grant_type", "authorization_code")
+                .queryParam("client_id", cl_id)
+                .queryParam("client_secret", cl_s).post(ClientResponse.class);
+
+        assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
+    }
+
 }
