diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index 8acd4fb..ab9706a 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -2,8 +2,12 @@
 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.Assert;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * @author hanl
  * @date 12/08/2015
@@ -17,10 +21,9 @@
 
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:doc");
-        assert node.at("/collection/key").asText().equals("corpusID");
-
+        assertNotNull(node);
+        assertEquals("koral:doc",node.at("/collection/@type").asText());
+        assertEquals("corpusID",node.at("/collection/key").asText());
     }
 
     @Test
@@ -29,14 +32,12 @@
         b.addQuery("corpusID=WPD & textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:docGroup");
-        assert node.at("/collection/operation").asText()
-                .equals("operation:and");
-        assert node.at("/collection/operands/0/key").asText()
-                .equals("corpusID");
-        assert node.at("/collection/operands/1/key").asText()
-                .equals("textClass");
+        assertNotNull(node);
+        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
+        assertEquals("operation:and",node.at("/collection/operation").asText());
+
+        assertEquals("corpusID",node.at("/collection/operands/0/key").asText());
+        assertEquals("textClass",node.at("/collection/operands/1/key").asText());
     }
 
     @Test
diff --git a/src/test/java/FileAuditingTest.java b/src/test/java/FileAuditingTest.java
index 0e62e12..fecc338 100644
--- a/src/test/java/FileAuditingTest.java
+++ b/src/test/java/FileAuditingTest.java
@@ -1,9 +1,8 @@
 import de.ids_mannheim.korap.auditing.AuditRecord;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import org.joda.time.LocalDate;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.util.Date;
@@ -13,16 +12,11 @@
  * @date 27/07/2015
  */
 //todo: test audit commit in thread and that no concurrency issue arrises
-public class FileAuditingTest {
+public class FileAuditingTest extends BeanConfigTest {
 
-    @BeforeClass
-    public static void init() {
-        BeanConfiguration.loadClasspathContext();
-    }
+    @Override
+    public void initMethod() throws KustvaktException {
 
-    @AfterClass
-    public static void finish() {
-        BeanConfiguration.closeApplication();
     }
 
     @Test
@@ -31,13 +25,13 @@
             AuditRecord record = AuditRecord
                     .serviceRecord("MichaelHanl", StatusCodes.ILLEGAL_ARGUMENT,
                             String.valueOf(i), "string value");
-            BeanConfiguration.getBeans().getAuditingProvider().audit(record);
+            helper().getContext().getAuditingProvider().audit(record);
         }
     }
 
     @Test(expected = UnsupportedOperationException.class)
     public void testRetrieval() {
-        BeanConfiguration.getBeans().getAuditingProvider()
+        helper().getContext().getAuditingProvider()
                 .retrieveRecords(new LocalDate(new Date().getTime()), 10);
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
index edee50d..b40b8c7 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
@@ -1,52 +1,45 @@
 package de.ids_mannheim.korap.config;
 
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.JDBCAuditing;
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
 import de.ids_mannheim.korap.interfaces.db.AuditingIface;
-import de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing;
-import org.junit.After;
-import org.junit.Assert;
+import de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager;
 import org.junit.Test;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 /**
  * @author hanl
  * @date 27/07/2015
  */
-public class ClassLoaderTest {
-
-    @After
-    public void close() {
-        BeanConfiguration.closeApplication();
-    }    
-
-    @Test
-    public void testBeanConfigurationLoaderThrowsNoException() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        assert BeanConfiguration.hasContext();
-    }
+public class ClassLoaderTest extends BeanConfigTest {
 
     @Test
     public void testDefaultCreationThrowsNoException() {
         DefaultHandler pl = new DefaultHandler();
-        Object o = pl.getDefault(BeanConfiguration.KUSTVAKT_AUDITING);
-        assert o != null;
-        assert o instanceof AuditingIface;
+        Object o = pl.getDefault(ContextHolder.KUSTVAKT_AUDITING);
+        assertNotNull(o);
+        assertTrue(o instanceof AuditingIface);
     }
 
     @Test
-    public void testDefaultCreationThrowsException() {
-        BeanConfiguration.loadClasspathContext();
-        AuthenticationManagerIface iface = BeanConfiguration.getBeans()
+    public void testDefaultCreation2ThrowsNoException() {
+        AuthenticationManagerIface iface = helper().getContext()
                 .getAuthenticationManager();
-        Assert.assertNull("default should be null", iface);
+        assertNotNull(iface);
+        assertTrue(iface instanceof KustvaktAuthenticationManager);
     }
 
     @Test
     public void testDefaultInterfaceMatchThrowsNoException() {
-        BeanConfiguration.loadClasspathContext();
-        AuditingIface iface = BeanConfiguration.getBeans()
-                .getAuditingProvider();
-        assert iface != null;
-        assert iface instanceof DefaultAuditing;
+        AuditingIface iface = helper().getContext().getAuditingProvider();
+        assertNotNull(iface);
+        assertTrue(iface instanceof JDBCAuditing);
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
index 1b3a4ea..d3bffd4 100644
--- a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
@@ -4,43 +4,35 @@
 import de.ids_mannheim.korap.handlers.ResourceDao;
 import de.ids_mannheim.korap.web.service.CollectionLoader;
 import de.ids_mannheim.korap.web.service.UserLoader;
-import org.junit.AfterClass;
 import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  * @author hanl
  * @date 11/02/2016
  */
-public class CollectionLoaderTest {
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
-    @BeforeClass
-    public static void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
+public class CollectionLoaderTest extends BeanConfigTest {
 
     @Test
     public void testCollectionLoader() {
         ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
 
         boolean error = false;
         UserLoader u = new UserLoader();
         CollectionLoader l = new CollectionLoader();
         try {
-            u.load();
-            l.load();
+            u.load(helper().getContext());
+            l.load(helper().getContext());
         }catch (KustvaktException e) {
             error = true;
         }
-        assert !error;
+        Assert.assertFalse(error);
         Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
+    }
+
+    @Override
+    public void initMethod() throws KustvaktException {
 
     }
 }
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 fddacb2..d9e28e3 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -2,78 +2,98 @@
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.utils.ServiceVersion;
+import de.ids_mannheim.korap.utils.ServiceInfo;
 import de.ids_mannheim.korap.utils.TimeUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
+import de.ids_mannheim.korap.web.service.BootableBeanInterface;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
 /**
  * @author hanl
  * @date 02/09/2015
  */
-public class ConfigTest {
-
-    @After
-    public void close() {
-        BeanConfiguration.closeApplication();
-    }
-
-    @Before
-    public void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
+public class ConfigTest extends BeanConfigTest {
 
     @Test
-    public void testServiceVersion() {
-        String v = ServiceVersion.getAPIVersion();
-        Assert.assertNotEquals("wrong version", "UNKNOWN", v);
+    public void testServiceInfo() {
+        String version = ServiceInfo.getInfo().getVersion();
+        String name = ServiceInfo.getInfo().getName();
+        assertNotEquals("wrong version", "UNKNOWN", version);
+        assertNotEquals("wrong name", "UNKNOWN", name);
     }
 
     @Test
     public void testProperties() {
-        BeanConfiguration.loadClasspathContext();
-
-        Assert.assertEquals("token layer does not match", "opennlp",
-                BeanConfiguration.getBeans().getConfiguration()
-                        .getDefault_token());
-        Assert.assertEquals("token expiration does not match",
+        assertEquals("token layer does not match", "opennlp",
+                helper().getContext().getConfiguration().getDefault_token());
+        assertEquals("token expiration does not match",
                 TimeUtils.convertTimeToSeconds("1D"),
-                BeanConfiguration.getBeans().getConfiguration()
-                        .getLongTokenTTL());
+                helper().getContext().getConfiguration().getLongTokenTTL());
     }
 
     @Test(expected = KustvaktException.class)
     public void testBeanOverrideInjection() throws KustvaktException {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-
-        BeanConfiguration.getBeans().getConfiguration().setPropertiesAsStream(
+        helper().getContext().getConfiguration().setPropertiesAsStream(
                 ConfigTest.class.getClassLoader()
                         .getResourceAsStream("kustvakt.conf"));
 
         String v = "testmail_&234@ids-mannheim.de";
-        BeanConfiguration.getBeans().getEncryption()
+        helper().getContext().getEncryption()
                 .validateEntry(v, Attributes.EMAIL);
     }
 
-    //    @Test
-    //    public void testArgLoader() {
-    //        String[] args = new String[] { "--port", "8080", "--config",
-    //                "local.conf", "--init" };
-    //        Set<Arg> s = Arg.loadArgs(args);
-    //        assert s.size() == 3;
-    //
-    //        for (Arg arg : s) {
-    //            if (arg instanceof Arg.PortArg)
-    //                assert ((Arg.PortArg) arg).getValue() == 8080;
-    //            if (arg instanceof Arg.ConfigArg)
-    //                assert ((Arg.ConfigArg) arg).getValue().equals("local.conf");
-    //            if (arg instanceof Arg.InitArg)
-    //                assert ((Arg.InitArg) arg).getValue();
-    //        }
-    //    }
+    @Test
+    public void testBootConfigRun() {
+        helper().runBootInterfaces();
+        helper().setupAccount();
+        assertNotNull(helper().getUser());
 
+        Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
+                .loadSubTypes(BootableBeanInterface.class);
+
+        int check = set.size();
+        List<String> tracker = new ArrayList<>();
+        List<BootableBeanInterface> list = new ArrayList<>(set.size());
+        for (Class cl : set) {
+            BootableBeanInterface iface;
+            try {
+                iface = (BootableBeanInterface) cl.newInstance();
+                list.add(iface);
+            }catch (InstantiationException | IllegalAccessException e) {
+                // do nothing
+            }
+        }
+
+        while (!set.isEmpty()) {
+            out_loop:
+            for (BootableBeanInterface iface : new ArrayList<>(list)) {
+                for (Class cl : iface.getDependencies()) {
+                    if (set.contains(cl))
+                        continue out_loop;
+                }
+                tracker.add(iface.getClass().getSimpleName());
+                set.remove(iface.getClass());
+                list.remove(iface);
+            }
+        }
+        assertEquals(check, tracker.size());
+    }
+
+    @Test
+    public void testBootConfigDependencyOrder() {
+        // todo:
+
+    }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+
+    }
 }
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
index b9ea3be..a9270d2 100644
--- a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
@@ -5,26 +5,16 @@
 import de.ids_mannheim.korap.web.service.CollectionLoader;
 import de.ids_mannheim.korap.web.service.PolicyLoader;
 import de.ids_mannheim.korap.web.service.UserLoader;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+
 /**
  * @author hanl
  * @date 11/02/2016
  */
-public class PolicyLoaderTest {
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
-    @BeforeClass
-    public static void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
+public class PolicyLoaderTest extends BeanConfigTest {
 
     @Test
     public void testPolicyLoader() {
@@ -33,16 +23,20 @@
         CollectionLoader c = new CollectionLoader();
         PolicyLoader l = new PolicyLoader();
         try {
-            u.load();
-            c.load();
-            l.load();
+            u.load(helper().getContext());
+            c.load(helper().getContext());
+            l.load(helper().getContext());
         }catch (KustvaktException e) {
+            e.printStackTrace();
             error = true;
         }
-        assert !error;
+        assertFalse(error);
+        PolicyDao dao = new PolicyDao(helper().getContext().getPersistenceClient());
+        assertNotEquals("Is not supposed to be zero", 0, dao.size());
+    }
 
-        PolicyDao dao = new PolicyDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
+    @Override
+    public void initMethod() throws KustvaktException {
+
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestBeans.java b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
new file mode 100644
index 0000000..6961289
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
@@ -0,0 +1,38 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.interfaces.db.*;
+import org.springframework.context.annotation.Bean;
+
+import java.util.List;
+
+/**
+ * @author hanl
+ * @date 20/02/2016
+ */
+public abstract class TestBeans {
+
+    protected PersistenceClient dataSource;
+
+    public abstract PolicyHandlerIface getPolicyDao();
+
+    public abstract KustvaktConfiguration getConfig();
+
+    public abstract EntityHandlerIface getUserDao();
+
+    public abstract AuditingIface getAuditingDao();
+
+    public abstract List<ResourceOperationIface> getResourceDaos();
+
+    public abstract List<UserDataDbIface> getUserdataDaos();
+
+    public abstract EncryptionIface getCrypto();
+
+    public abstract AuthenticationManagerIface getAuthManager();
+
+    @Bean(name = "kustvakt_db")
+    public PersistenceClient getDataSource() {
+        return this.dataSource;
+    }
+}
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 ae35e02..607cc71 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -1,23 +1,42 @@
 package de.ids_mannheim.korap.config;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.ResourceDao;
-import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
-import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+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.APIAuthentication;
+import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
+import de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.web.service.BootupInterface;
+import de.ids_mannheim.korap.web.service.BootableBeanInterface;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.flywaydb.core.Flyway;
+import org.joda.time.DateTime;
 import org.junit.Assert;
+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 java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.security.NoSuchAlgorithmException;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.*;
 
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * creates a test user that can be used to access protected functions
  *
@@ -28,163 +47,173 @@
 
     private static final String[] credentials = new String[] { "test1",
             "testPass2015" };
+    private static Class clazz = null;
 
-    public static boolean setupAccount() {
-        boolean r = BeanConfiguration.hasContext();
-        if (r && ((KustvaktBaseDaoInterface) BeanConfiguration.getBeans()
-                .getUserDBHandler()).size() == 0) {
-            EntityHandlerIface dao = BeanConfiguration.getBeans()
-                    .getUserDBHandler();
-            Map m = new HashMap<>();
-            m.put(Attributes.ID, 2);
-            m.put(Attributes.USERNAME, credentials[0]);
-            m.put(Attributes.PASSWORD, credentials[1]);
-            m.put(Attributes.FIRSTNAME, "test");
-            m.put(Attributes.LASTNAME, "user");
-            m.put(Attributes.EMAIL, "test@ids-mannheim.de");
-            m.put(Attributes.ADDRESS, "Mannheim");
-            m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, "test_l");
-            m.put(Attributes.DEFAULT_POS_FOUNDRY, "test_p");
-            m.put(Attributes.DEFAULT_CONST_FOUNDRY, "test_const");
+    private ContextHolder beansHolder;
 
-            Assert.assertNotNull("userdatabase handler must not be null", dao);
-
-            try {
-                BeanConfiguration.getBeans().getAuthenticationManager()
-                        .createUserAccount(m, false);
-            }catch (KustvaktException e) {
-                // do nothing
-                e.printStackTrace();
-                Assert.assertNull("Test user could not be set up", true);
-                return false;
-            }
-        }
-        return r;
+    public static TestHelper newInstance(ApplicationContext ctx)
+            throws Exception {
+        TestHelper b = new TestHelper();
+        b.beansHolder = new ContextHolder(ctx) {
+        };
+        return b;
     }
 
-    public static boolean setupSimpleAccount(String username, String password) {
-        boolean r = BeanConfiguration.hasContext();
-        if (r && ((KustvaktBaseDaoInterface) BeanConfiguration.getBeans()
-                .getUserDBHandler()).size() == 0) {
-            EntityHandlerIface dao = BeanConfiguration.getBeans()
-                    .getUserDBHandler();
+    public <T> T getBean(Class<T> type) {
+        return this.beansHolder.getBean(type);
+    }
+
+    public ContextHolder getContext() {
+        return this.beansHolder;
+    }
+
+    public <T> T getBean(String name) {
+        return (T) this.beansHolder.getBean(name);
+    }
+
+    public TestHelper setupAccount() {
+        KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
+
+        KustvaktAuthenticationManager manager = getBean(
+                ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER);
+
+        try {
+            getUser();
+            System.out.println("found user, skipping setup ...");
+            return this;
+        }catch (RuntimeException e) {
+            // do nothing and continue
+        }
+
+        Map m = new HashMap<>();
+        m.put(Attributes.ID, 2);
+        m.put(Attributes.USERNAME, credentials[0]);
+        m.put(Attributes.PASSWORD, credentials[1]);
+        m.put(Attributes.FIRSTNAME, "test");
+        m.put(Attributes.LASTNAME, "user");
+        m.put(Attributes.EMAIL, "test@ids-mannheim.de");
+        m.put(Attributes.ADDRESS, "Mannheim");
+        m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, "test_l");
+        m.put(Attributes.DEFAULT_POS_FOUNDRY, "test_p");
+        m.put(Attributes.DEFAULT_CONST_FOUNDRY, "test_const");
+
+        assertNotNull("userdatabase handler must not be null", dao);
+
+        try {
+            manager.createUserAccount(m, false);
+        }catch (KustvaktException e) {
+            // do nothing
+            e.printStackTrace();
+            assertNotNull("Test user could not be set up", null);
+        }
+        assertNotEquals(0, dao.size());
+        return this;
+    }
+
+    public TestHelper setupSimpleAccount(String username, String password) {
+        KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
+
+        if (dao.size() == 0) {
             Map m = new HashMap<>();
             m.put(Attributes.USERNAME, username);
 
             try {
-                String hash = BeanConfiguration.getBeans().getEncryption()
+                String hash = ((EncryptionIface) getBean(
+                        ContextHolder.KUSTVAKT_ENCRYPTION))
                         .produceSecureHash(password);
                 m.put(Attributes.PASSWORD, hash);
             }catch (NoSuchAlgorithmException | UnsupportedEncodingException | KustvaktException e) {
-
+                // do nohting
+                assertNotNull("Exception thrown", null);
             }
-            Assert.assertNotNull("userdatabase handler must not be null", dao);
+            assertNotNull("userdatabase handler must not be null", dao);
 
             try {
-                int i = dao.createAccount(User.UserFactory.toKorAPUser(m));
-                assert BeanConfiguration.getBeans().getUserDBHandler()
+                EntityHandlerIface edao = (EntityHandlerIface) dao;
+                int i = edao.createAccount(User.UserFactory.toKorAPUser(m));
+                assert BeansFactory.getKustvaktContext().getUserDBHandler()
                         .getAccount(credentials[0]) != null;
                 assert i == 1;
             }catch (KustvaktException e) {
                 // do nothing
                 Assert.assertNull("Test user could not be set up", true);
-                return false;
             }
         }
-        return r;
+        return this;
     }
 
-    public static User getUser() {
-        if (BeanConfiguration.hasContext()) {
-            try {
-                return BeanConfiguration.getBeans().getUserDBHandler()
-                        .getAccount(credentials[0]);
-            }catch (KustvaktException e) {
-                e.printStackTrace();
-            }
+    public User getUser() {
+        try {
+            return ((EntityHandlerIface) getBean(ContextHolder.KUSTVAKT_USERDB))
+                    .getAccount(credentials[0]);
+        }catch (KustvaktException e) {
+            // do nothing
         }
         throw new RuntimeException("User could not be retrieved!");
     }
 
-    public static boolean dropUser(String... usernames) {
-        if (usernames == null || usernames.length == 0)
-            usernames = new String[] { credentials[0] };
-        if (BeanConfiguration.hasContext()) {
-            for (String name : usernames)
-                remove(name);
+    public TestHelper dropUser(String... usernames) throws KustvaktException {
+        if (usernames == null || usernames.length == 0) {
+            KustvaktBaseDaoInterface dao = getBean(
+                    ContextHolder.KUSTVAKT_USERDB);
+            dao.truncate();
         }
-        return BeanConfiguration.hasContext();
+        for (String name : Arrays.asList(usernames)) {
+            if (remove(name))
+                break;
+        }
+        return this;
     }
 
-    private static void remove(String username) {
-        EntityHandlerIface dao = BeanConfiguration.getBeans()
-                .getUserDBHandler();
-        try {
-            User us = dao.getAccount(username);
-            dao.deleteAccount(us.getId());
-        }catch (KustvaktException e) {
-            // do nothing
-        }
+    private boolean remove(String username) throws KustvaktException {
+        EntityHandlerIface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
+        User us = dao.getAccount(username);
+        dao.deleteAccount(us.getId());
+        return true;
     }
 
-    public static void drop() {
-        if (BeanConfiguration.hasContext()) {
-            PersistenceClient cl = BeanConfiguration.getBeans()
-                    .getPersistenceClient();
-            String sql = "drop database " + cl.getDatabase() + ";";
-            NamedParameterJdbcTemplate jdbc = (NamedParameterJdbcTemplate) cl
-                    .getSource();
-            jdbc.update(sql, new HashMap<String, Object>());
-        }
-    }
+    public TestHelper truncateAll() {
+        String sql = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES";
+        final Set<String> queries = new HashSet<>();
+        PersistenceClient cl = getBean(ContextHolder.KUSTVAKT_POLICIES);
+        NamedParameterJdbcTemplate source = (NamedParameterJdbcTemplate) cl
+                .getSource();
 
-    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));
 
-            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;
+            }
+        });
+        System.out.println(queries);
+        for (String query : queries)
+            source.update(query, new HashMap<String, Object>());
+        return this;
     }
 
     public static final String[] getUserCredentials() {
         return Arrays.copyOf(credentials, 2);
     }
 
-    public static void runBootInterfaces() {
-        Set<Class<? extends BootupInterface>> set = KustvaktClassLoader
-                .loadSubTypes(BootupInterface.class);
+    public TestHelper runBootInterfaces() {
+        Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
+                .loadSubTypes(BootableBeanInterface.class);
 
-        List<BootupInterface> list = new ArrayList<>(set.size());
+        List<BootableBeanInterface> list = new ArrayList<>(set.size());
         for (Class cl : set) {
-            BootupInterface iface;
+            BootableBeanInterface iface;
             try {
-                iface = (BootupInterface) cl.newInstance();
+                iface = (BootableBeanInterface) cl.newInstance();
                 list.add(iface);
             }catch (InstantiationException | IllegalAccessException e) {
                 // do nothing
             }
         }
         System.out.println("Found boot loading interfaces: " + list);
-        int i = 0;
         while (!set.isEmpty()) {
             out_loop:
-            for (BootupInterface iface : new ArrayList<>(list)) {
+            for (BootableBeanInterface iface : new ArrayList<>(list)) {
                 try {
                     System.out.println(
                             "Running boot instructions from class " + iface
@@ -193,47 +222,224 @@
                         if (set.contains(cl))
                             continue out_loop;
                     }
-                    iface.load();
                     set.remove(iface.getClass());
                     list.remove(iface);
+                    iface.load(beansHolder);
                 }catch (KustvaktException e) {
                     // don't do anything!
                     System.out.println(
                             "An error occurred in class " + iface.getClass()
                                     .getSimpleName() + "!\n" + e);
+                    throw new RuntimeException(
+                            "Boot loading interface failed ...");
                 }
             }
-            i++;
-            if (i == set.size() * 2) {
-                System.out.println(
-                        "Could not run startup scripts. Exiting programme!");
-                System.exit(-1);
-            }
         }
+        return this;
     }
 
-    public static void setupResource(KustvaktResource resource, User user)
+    public int setupResource(KustvaktResource resource)
             throws KustvaktException {
         ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        dao.storeResource(resource, user);
+                (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
+        return dao.storeResource(resource, getUser());
     }
 
-    public static KustvaktResource getResource(String name)
-            throws KustvaktException {
+    public KustvaktResource getResource(String name) throws KustvaktException {
         ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        return dao.findbyId(name, getUser());
+                (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
+        KustvaktResource res = dao.findbyId(name, getUser());
+        if (res == null)
+            throw new RuntimeException(
+                    "resource with name " + name + " not found ...");
+        return res;
     }
 
-    public static void dropResource(String name) throws KustvaktException {
+    public TestHelper dropResource(String... names) throws KustvaktException {
         ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        dao.deleteResource(name, null);
+                (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
+        if (names == null || names.length == 0)
+            dao.truncate();
+        for (String name : names)
+            dao.deleteResource(name, null);
+        return this;
+    }
 
+    public void close() {
+        BeansFactory.closeApplication();
     }
 
     private TestHelper() {
+
+    }
+
+    private static PersistenceClient mysql_db() throws IOException {
+        BasicDataSource dataSource = new BasicDataSource();
+        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
+        dataSource.setUrl("jdbc:mysql://localhost:3306/kustvakt_test");
+        dataSource.setUsername("mhanl");
+        dataSource.setPassword("password");
+        JDBCClient client = new JDBCClient(dataSource);
+        client.setDatabase("mariadb");
+
+        Flyway fl = new Flyway();
+        fl.setDataSource(dataSource);
+        fl.setLocations("db.mysql");
+        fl.migrate();
+
+        return client;
+    }
+
+    private static PersistenceClient sqlite_db(Class testclass, boolean memory)
+            throws InterruptedException {
+        SingleConnectionDataSource dataSource = new SingleConnectionDataSource();
+        dataSource.setDriverClassName("org.sqlite.JDBC");
+        DateTime t = new DateTime();
+        String name = testclass != null ? testclass.getSimpleName() + "_" : "";
+
+        if (memory)
+            dataSource.setUrl("jdbc:sqlite::memory:");
+        else {
+            File tmp = new File("tmp");
+            if (!tmp.exists())
+                tmp.mkdirs();
+            dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + name +
+                    t.getMillis() + ".sqlite");
+        }
+        dataSource.setSuppressClose(true);
+
+        Flyway fl = new Flyway();
+        fl.setDataSource(dataSource);
+        fl.setLocations("db.sqlite");
+        fl.migrate();
+
+        JDBCClient client = new JDBCClient(dataSource);
+        client.setDatabase("sqlite");
+        return client;
+    }
+
+    public static PersistenceClient sqlite_db_norm(boolean memory) {
+        BasicDataSource dataSource = new BasicDataSource();
+        dataSource.setDriverClassName("org.sqlite.JDBC");
+        dataSource.setMaxTotal(1);
+        dataSource.setInitialSize(1);
+        dataSource.setMaxIdle(1);
+        dataSource.addConnectionProperty("lazy-init", "true");
+        DateTime t = new DateTime();
+        if (memory)
+            dataSource.setUrl("jdbc:sqlite::memory:");
+        else {
+            File tmp = new File("tmp");
+            if (!tmp.exists())
+                tmp.mkdirs();
+            dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + t.toString());
+        }
+
+        Flyway fl = new Flyway();
+        fl.setDataSource(dataSource);
+        fl.setLocations("db.sqlite");
+        fl.migrate();
+
+        JDBCClient client = new JDBCClient(dataSource);
+        client.setDatabase("sqlite");
+        return client;
+    }
+
+    public static PersistenceClient h2_emb() throws SQLException {
+        BasicDataSource dataSource = new BasicDataSource();
+        dataSource.setUrl("jdbc:h2:mem:");
+        dataSource.getConnection().nativeSQL("SET MODE MySQL;");
+        dataSource.getConnection().commit();
+        dataSource.setUsername("sa");
+        dataSource.setPassword("");
+        dataSource.setDriverClassName("org.h2.Driver");
+
+        Flyway fl = new Flyway();
+        fl.setDataSource(dataSource);
+        fl.setLocations("db.mysql");
+        fl.migrate();
+        JDBCClient client = new JDBCClient(dataSource);
+        client.setDatabase("h2");
+        return client;
+    }
+
+    public static class AppTestConfig extends TestBeans {
+
+        public AppTestConfig() throws InterruptedException, IOException {
+            this.dataSource = TestHelper.sqlite_db(TestHelper.clazz, false);
+            //this.dataSource = TestHelper.mysql_db();
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_POLICIES)
+        @Override
+        public PolicyHandlerIface getPolicyDao() {
+            return new PolicyDao(this.dataSource);
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_USERDB)
+        @Override
+        public EntityHandlerIface getUserDao() {
+            return new EntityDao(this.dataSource);
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_CONFIG)
+        @Override
+        public KustvaktConfiguration getConfig() {
+            KustvaktConfiguration c = new KustvaktConfiguration();
+            InputStream s = TestHelper.class.getClassLoader()
+                    .getResourceAsStream("kustvakt.conf");
+            if (s != null)
+                c.setPropertiesAsStream(s);
+            else {
+                System.out.println("No properties found!");
+                System.exit(-1);
+            }
+            return c;
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_AUDITING)
+        @Override
+        public AuditingIface getAuditingDao() {
+            return new JDBCAuditing(this.dataSource);
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_RESOURCES)
+        @Override
+        public List<ResourceOperationIface> getResourceDaos() {
+            List<ResourceOperationIface> res = new ArrayList<>();
+            res.add(new ResourceDao(getDataSource()));
+            res.add(new DocumentDao(getDataSource()));
+            return res;
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_USERDATA)
+        @Override
+        public List<UserDataDbIface> getUserdataDaos() {
+            List<UserDataDbIface> ud = new ArrayList<>();
+            ud.add(new UserSettingsDao(getDataSource()));
+            ud.add(new UserDetailsDao(getDataSource()));
+            return ud;
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_ENCRYPTION)
+        @Override
+        public EncryptionIface getCrypto() {
+            return new KustvaktEncryption(getConfig());
+        }
+
+        @Bean(name = ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER)
+        @Override
+        public AuthenticationManagerIface getAuthManager() {
+            AuthenticationManagerIface manager = new KustvaktAuthenticationManager(
+                    getUserDao(), getCrypto(), getConfig(), getAuditingDao(),
+                    getUserdataDaos());
+            Set<AuthenticationIface> pro = new HashSet<>();
+            pro.add(new BasicHttpAuth());
+            pro.add(new APIAuthentication(getConfig()));
+            manager.setProviders(pro);
+            return manager;
+        }
+
     }
 
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
index c9c4b17..4e28c4d 100644
--- a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
@@ -3,41 +3,33 @@
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.handlers.EntityDao;
 import de.ids_mannheim.korap.web.service.UserLoader;
-import org.junit.AfterClass;
 import org.junit.Assert;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  * @author hanl
  * @date 11/02/2016
  */
-public class UserLoaderTest {
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
-    @BeforeClass
-    public static void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
+public class UserLoaderTest extends BeanConfigTest {
 
     @Test
     public void testUserLoader() {
-        EntityDao dao = new EntityDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+        EntityDao dao = new EntityDao(helper().getContext().getPersistenceClient());
 
         boolean error = false;
         UserLoader l = new UserLoader();
         try {
-            l.load();
+            l.load(helper().getContext());
         }catch (KustvaktException e) {
             e.printStackTrace();
             error = true;
         }
-        assert !error;
+        Assert.assertFalse(error);
         Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
     }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
index 603aa53..9a13eb4 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
@@ -1,8 +1,11 @@
-import de.ids_mannheim.korap.config.BeanConfiguration;
+package de.ids_mannheim.korap.handlers;
+
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.handlers.DocumentDao;
 import de.ids_mannheim.korap.resources.Document;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.List;
 
@@ -10,29 +13,13 @@
  * @author hanl
  * @date 12/11/2015
  */
-public class DocumentDaoTest {
+public class DocumentDaoTest extends BeanConfigTest {
 
     private static DocumentDao dao;
 
-    @BeforeClass
-    public static void setup() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        dao = new DocumentDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-    }
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
     @After
     public void clear() {
-        try {
-            dao.deleteAll();
-        }catch (KustvaktException e) {
-            e.printStackTrace();
-        }
+        dao.truncate();
     }
 
     @Test
@@ -109,4 +96,9 @@
         Assert.assertNotSame("should not be empty", 0, dc.size());
         Assert.assertEquals("not all found", length, dc.size());
     }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        dao = new DocumentDao(helper().getContext().getPersistenceClient());
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
index 83d6de7..20825a7 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
@@ -1,45 +1,81 @@
 package de.ids_mannheim.korap.handlers;
 
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.KustvaktClassLoader;
 import de.ids_mannheim.korap.config.TestHelper;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.resources.KustvaktResource;
 import de.ids_mannheim.korap.resources.VirtualCollection;
 import de.ids_mannheim.korap.user.User;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotEquals;
+
 /**
  * @author hanl
  * @date 26/01/2016
  */
-public class ResourceDaoTest {
+public class ResourceDaoTest extends BeanConfigTest {
 
-    @BeforeClass
-    public static void init() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        TestHelper.setupAccount();
+    private static List<Integer> ids = new ArrayList<>();
+
+    @Override
+    public void initMethod() {
+        helper().setupAccount();
+
+        List classes = new ArrayList<>(
+                KustvaktClassLoader.loadSubTypes(KustvaktResource.class));
+        int size = classes.size();
+        for (int i = 0; i < size; i++) {
+            Class s = (Class) classes.get(i < classes.size() ? i : 0);
+            try {
+                KustvaktResource r = (KustvaktResource) s.newInstance();
+                r.setName("resource_" + i);
+                r.setPersistentID(r.getName());
+                int id = helper().setupResource(r);
+                ids.add(id);
+                assertNotEquals(0,
+                        new ResourceDao<>(helper().getContext().getPersistenceClient())
+                                .size());
+            }catch (InstantiationException e) {
+                if (i < classes.size())
+                    classes.remove(i);
+            }catch (KustvaktException | IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
     }
 
-    @AfterClass
-    public static void drop() {
-        //        TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
+    @Test
+    public void testBatchGetResources() throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+        assertNotEquals(0, dao.size());
+        Collection res = dao.getResources(ids, User.UserFactory.getDemoUser());
+        assertEquals(ids.size(), res.size());
     }
 
-    @After
-    public void clear() throws KustvaktException {
-        new ResourceDao<>(BeanConfiguration.getBeans().getPersistenceClient())
-                .deleteAll();
+    @Test
+    public void testGetResource() throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+        assertEquals("sqlite",
+                helper().getContext().getPersistenceClient().getDatabase());
+
+        assertNotEquals(0, dao.size());
+        KustvaktResource res = dao
+                .findbyId(ids.get(0), User.UserFactory.getDemoUser());
+        assertNotNull(res);
     }
 
     @Test
     public void createCollection() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        VirtualCollection c = new VirtualCollection("testColl");
+        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+        VirtualCollection c = new VirtualCollection("testColl1");
         c.addField("key_1", "this is a test");
         c.addField("key_2", 2);
 
@@ -49,17 +85,16 @@
         int id = dao.storeResource(c, user);
 
         KustvaktResource r = dao.findbyId(id, user);
-        assert dao.size() > 0;
-        assert r != null;
-        assert r.getField("key_1") instanceof String;
-        assert r.getField("key_2") instanceof Integer;
+        assertNotEquals(dao.size(),0);
+        assertNotNull(r);
+        assertEquals(r.getField("key_1") instanceof String,true);
+        assertEquals(r.getField("key_2") instanceof Integer,true);
     }
 
     @Test
     public void ResourceDataUpdate() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        VirtualCollection c = new VirtualCollection("testColl");
+        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+        VirtualCollection c = new VirtualCollection("testColl2");
         c.addField("key_1", "this is a test");
         c.addField("key_2", 2);
 
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
index 94abd81..0c9be7c 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
@@ -1,95 +1,98 @@
-import de.ids_mannheim.korap.config.BeanConfiguration;
+package de.ids_mannheim.korap.handlers;
+
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.BeansFactory;
 import de.ids_mannheim.korap.config.TestHelper;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
 import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
-import de.ids_mannheim.korap.user.*;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.UserDetails;
+import de.ids_mannheim.korap.user.UserSettings;
+import de.ids_mannheim.korap.user.Userdata;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 ;
 
 /**
  * @author hanl
  * @date 13/02/2015
  */
-public class UserDaoTest {
-
-    @BeforeClass
-    public static void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        TestHelper.setupAccount();
-        TestHelper.runBootInterfaces();
-    }
-
-    @AfterClass
-    public static void close() {
-        assert TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
-    }
+public class UserDaoTest extends BeanConfigTest {
 
     @Test
     public void userput() throws KustvaktException {
-        User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+        User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
-        Assert.assertEquals("user creation failed", true, user1.getId() != -1);
+        assertEquals("user creation failed", true, user1.getId() != -1);
+    }
+
+    @Test
+    public void userputBatch() {
+        //todo:
     }
 
     @Test
     public void userget() throws KustvaktException {
-        User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+        User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
-        Assert.assertEquals("User Retrieval does not work",
+        assertEquals("User Retrieval does not work",
                 TestHelper.getUserCredentials()[0], user1.getUsername());
     }
 
     //    @Test
     public void testUserdetailsGetNonExistent() throws KustvaktException {
-        TestHelper.setupSimpleAccount("userdbtest", "userdbTest");
-        User user = BeanConfiguration.getBeans().getUserDBHandler()
+        helper().setupSimpleAccount("userdbtest", "userdbTest");
+        User user = helper().getContext().getUserDBHandler()
                 .getAccount("userdbtest");
-        UserDataDbIface dao = UserdataFactory.getDaoInstance(UserDetails.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
+                .getContext().getUserDataDaos(), UserDetails.class);
         Userdata data = dao.get(user);
-        assert data == null;
-        TestHelper.dropUser("userdbtest");
+        assertNull(data);
+        helper().dropUser("userdbtest");
     }
 
     //    @Test
     public void testUserSettingsGetNonExistent() throws KustvaktException {
-        TestHelper.setupSimpleAccount("userdbtest", "userdbTest");
-        User user = BeanConfiguration.getBeans().getUserDBHandler()
+        helper().setupSimpleAccount("userdbtest", "userdbTest");
+        User user = helper().getContext().getUserDBHandler()
                 .getAccount("userdbtest");
-        UserDataDbIface dao = UserdataFactory
-                .getDaoInstance(UserSettings.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
+                .getContext().getUserDataDaos(), UserSettings.class);
         Userdata data = dao.get(user);
-        assert data == null;
-        TestHelper.dropUser("userdbtest");
+        assertNull(data);
+        helper().dropUser("userdbtest");
 
     }
 
     // username cannot currently be changed
     //    @Test
     public void updateUsername() throws KustvaktException {
-        User user1 = BeanConfiguration.getBeans().getUserDBHandler()
+        User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
         user1.setUsername("new_user");
-        BeanConfiguration.getBeans().getUserDBHandler().updateAccount(user1);
-        User u2 = BeanConfiguration.getBeans().getUserDBHandler()
+        helper().getContext().getUserDBHandler().updateAccount(user1);
+        User u2 = helper().getContext().getUserDBHandler()
                 .getAccount("new_user");
-        Assert.assertEquals("not found", user1.getUsername(), u2.getUsername());
+        assertEquals("not found", user1.getUsername(), u2.getUsername());
     }
 
     @Test
     public void userupdate() throws KustvaktException {
-        EntityHandlerIface dao = BeanConfiguration.getBeans()
-                .getUserDBHandler();
+        EntityHandlerIface dao = helper().getContext().getUserDBHandler();
         User user1 = dao.getAccount(TestHelper.getUserCredentials()[0]);
         user1.setAccountLocked(true);
         dao.updateAccount(user1);
-        Assert.assertEquals("not valid", true,
+        assertEquals("not valid", true,
                 dao.getAccount(user1.getUsername()).isAccountLocked());
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+        helper().runBootInterfaces();
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index 2db2838..6574d09 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -1,39 +1,34 @@
+package de.ids_mannheim.korap.resource.rewrite;
+
 import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.resource.rewrite.CollectionCleanupFilter;
-import de.ids_mannheim.korap.resource.rewrite.CollectionConstraint;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Assert;
 import org.junit.Test;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * @author hanl
  * @date 03/09/2015
  */
-// todo: 20.10.15
-public class CollectionRewriteTest {
+public class CollectionRewriteTest extends BeanConfigTest {
 
     private static String simple_add_query = "[pos=ADJA]";
 
     private static KustvaktConfiguration config;
 
-    @BeforeClass
-    public static void init() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        config = BeanConfiguration.getBeans().getConfiguration();
-    }
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
+    @Override
+    public void initMethod() throws KustvaktException {
+        config = helper().getContext().getConfiguration();
     }
 
     @Deprecated
@@ -50,7 +45,8 @@
 
     @Test
     public void testCollectionNodeRemoveCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
@@ -58,13 +54,14 @@
         String result = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
-        assert node != null;
-        assert node.at("/collection/operands").size() == 1;
+        assertNotNull(node);
+        assertEquals(1, node.at("/collection/operands").size());
     }
 
     @Test
     public void testCollectionNodeRemoveAllCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
@@ -73,13 +70,14 @@
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
         //        System.out.println("RESULTING REWR NODE " + node);
-        assert node != null;
-        assert node.at("/collection/operands").size() == 0;
+        assertNotNull(node);
+        assertEquals(0, node.at("/collection/operands").size());
     }
 
     @Test
     public void testCollectionNodeRemoveGroupedCorpusIdNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
@@ -89,17 +87,16 @@
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
-        assert node != null;
-        assert node.at("/collection/operands/0/@type").asText()
-                .equals("koral:docGroup");
-        assert node.at("/collection/operands/0/operands/0/key").asText()
-                .equals("textClass");
+        assertNotNull(node);
+        assertEquals("koral:docGroup",node.at("/collection/operands/0/@type").asText());
+        assertEquals("textClass",node.at("/collection/operands/0/operands/0/key").asText());
     }
 
     //fixme: will probably fail when one doc groups are being refactored
     @Test
     public void testCollectionCleanEmptyDocGroupNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
@@ -110,18 +107,18 @@
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:docGroup");
-        assert node.at("/collection/operands").size() == 2;
-        assert node.at("/collection/operands/0/key").asText()
-                .equals("textClass");
-        assert node.at("/collection/operands/1/key").asText()
-                .equals("textClass");
+        assertNotNull(node);
+        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
+        assertEquals(2,node.at("/collection/operands").size());
+
+        assertEquals("textClass",node.at("/collection/operands/0/key").asText());
+        assertEquals("textClass",node.at("/collection/operands/1/key").asText());
     }
 
     @Test
     public void testCollectionCleanMoveOneDocFromGroupUpNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
@@ -130,13 +127,14 @@
         String result = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:doc");
+        assertNotNull(node);
+        assertEquals("koral:doc",node.at("/collection/@type").asText());
     }
 
     @Test
     public void testCollectionCleanEmptyGroupAndMoveOneFromGroupUpNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
@@ -147,30 +145,31 @@
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:doc");
-        assert node.at("/collection/key").asText().equals("textClass");
+        assertNotNull(node);
+        assertEquals("koral:doc",node.at("/collection/@type").asText());
+        assertEquals("textClass",node.at("/collection/key").asText());
     }
 
     @Test
     public void testCollectionRemoveAndMoveOneFromGroupUpNoErrors() {
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
         s.setCollection(
                 "(docID=random & textClass=Wissenschaft) & corpusID=WPD");
-        String result = s.toJSON();
-        JsonNode node = JsonUtils.readTree(handler.preProcess(result,
+        String org = s.toJSON();
+        JsonNode node = JsonUtils.readTree(handler.preProcess(org,
                 User.UserFactory.getUser("test_user")));
-        System.out.println("original node " + result);
-        System.out.println("result node " + node);
-        assert node != null;
-        assert node.at("/collection/@type").asText().equals("koral:docGroup");
-        assert node.at("/collection/operands").size() == 2;
-        assert node.at("/collection/operands/0/@type").asText()
-                .equals("koral:doc");
+
+        assertNotNull(node);
+        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
+        assertEquals(2, node.at("/collection/operands").size());
+        assertEquals("koral:doc",node.at("/collection/operands/0/@type").asText());
     }
 
+
+
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
index 1a477d9..0cbd369 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
@@ -1,21 +1,28 @@
+package de.ids_mannheim.korap.resource.rewrite;
+
 import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.BeansFactory;
+import de.ids_mannheim.korap.config.ContextHolder;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.resource.LayerMapper;
-import de.ids_mannheim.korap.resource.rewrite.FoundryInject;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
+import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.UserSettings;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 /**
  * @author hanl
  * @date 18/06/2015
  */
 //todo: refactor and structure tests
-public class FoundryRewriteTest {
+public class FoundryRewriteTest extends BeanConfigTest {
 
     private static String simple_add_query = "[pos=ADJA]";
     private static String simple_rewrite_query = "[base=Haus]";
@@ -25,96 +32,174 @@
 
     private static KustvaktConfiguration config;
 
-    @BeforeClass
-    public static void init() {
-        BeanConfiguration.loadClasspathContext();
-        config = BeanConfiguration.getBeans().getConfiguration();
-    }
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
-    @Test
-    public void testSimpleFoundryAddThrowsNoError() {
-        RewriteHandler processor = new RewriteHandler(config);
-        processor.add(FoundryInject.class);
-        QuerySerializer s = new QuerySerializer();
-        s.setQuery(simple_add_query, "poliqarp");
-        String result = processor.preProcess(s.toJSON(), null);
-        JsonNode node = JsonUtils.readTree(result);
-
-        assert node != null;
-        assert !node.at("/query/wrap/foundry").isMissingNode();
+    @Override
+    public void initMethod() throws KustvaktException {
+        config = helper().getContext().getConfiguration();
+        helper().setupAccount();
     }
 
     @Test
     public void testDefaultLayerMapperThrowsNoException() {
         LayerMapper m = new LayerMapper(config);
 
-        assert m.findFoundry("lemma").equals(config.getDefault_lemma());
-        assert m.findFoundry("pos").equals(config.getDefault_pos());
-        assert m.findFoundry("surface").equals(config.getDefault_token());
-        assert m.findFoundry("d").equals(config.getDefault_dep());
-        assert m.findFoundry("c").equals(config.getDefault_const());
+        assertEquals(config.getDefault_lemma(), m.findFoundry("lemma"));
+        assertEquals(config.getDefault_pos(), m.findFoundry("pos"));
+        assertEquals(config.getDefault_token(), m.findFoundry("surface"));
+        assertEquals(config.getDefault_dep(), m.findFoundry("d"));
+        assertEquals(config.getDefault_const(), m.findFoundry("c"));
     }
 
     @Test
-    public void testFoundryInjectPosNoErrors() {
+    public void testDefaultFoundryInjectLemmaThrowsNoError() {
+
+        KustvaktConfiguration c = helper()
+                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+
+        RewriteHandler processor = new RewriteHandler();
+        processor.insertBeans(helper().getContext());
+        processor.add(FoundryInject.class);
         QuerySerializer s = new QuerySerializer();
-        RewriteHandler handler = new RewriteHandler(config);
+        s.setQuery("[base=Haus]", "poliqarp");
+        String result = processor.preProcess(s.toJSON(), null);
+        JsonNode node = JsonUtils.readTree(result);
+
+        assertNotNull(node);
+        assertFalse(node.at("/query/wrap/foundry").isMissingNode());
+        assertEquals(c.getDefault_lemma(),
+                node.at("/query/wrap/foundry").asText());
+        assertEquals("lemma", node.at("/query/wrap/layer").asText());
+        assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
+        assertEquals("koral:rewrite",
+                node.at("/query/wrap/rewrites/0/@type").asText());
+    }
+
+    @Test
+    public void testDefaultFoundryInjectPOSNoErrors() {
+
+        KustvaktConfiguration c = helper()
+                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+
+        QuerySerializer s = new QuerySerializer();
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         s.setQuery("[pos=ADJA]", "poliqarp");
-        assert handler.add(FoundryInject.class);
+        assertTrue(handler.add(FoundryInject.class));
         String result = handler.preProcess(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
 
-        assert node != null;
-        assert !node.at("/query/wrap/foundry").isMissingNode();
-        assert !node.at("/query/wrap/rewrites").isMissingNode();
-        assert node.at("/query/wrap/rewrites/0/@type").asText()
-                .equals("koral:rewrite");
+        assertNotNull(node);
+        assertFalse(node.at("/query/wrap/foundry").isMissingNode());
+        assertEquals(c.getDefault_pos(),
+                node.at("/query/wrap/foundry").asText());
+        assertEquals("pos", node.at("/query/wrap/layer").asText());
+        assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
+        assertEquals("koral:rewrite",
+                node.at("/query/wrap/rewrites/0/@type").asText());
+
+    }
+
+    @Test
+    public void testRewriteFoundryInjectPOSThrowsNoError()
+            throws KustvaktException {
+        User user = helper().getUser();
+
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        handler.add(FoundryInject.class);
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[pos=ADJA]", "poliqarp");
+        String result = handler.preProcess(s.toJSON(), user);
+        JsonNode node = JsonUtils.readTree(result);
+
+        UserDataDbIface dao = BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(),
+                        UserSettings.class);
+        UserSettings settings = (UserSettings) dao.get(user);
+        assertTrue(settings.isValid());
+        String pos = (String) settings.get(Attributes.DEFAULT_POS_FOUNDRY);
+
+        assertNotNull(node);
+        assertEquals("pos", node.at("/query/wrap/layer").asText());
+        assertEquals(pos, node.at("/query/wrap/foundry").asText());
+        assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
+        assertEquals("koral:rewrite",
+                node.at("/query/wrap/rewrites/0/@type").asText());
+    }
+
+    @Test
+    public void testRewriteFoundryInjectLemmaThrowsNoError()
+            throws KustvaktException {
+        KustvaktConfiguration c = helper()
+                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+        User user = helper().getUser();
+
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        handler.add(FoundryInject.class);
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[base=Haus]", "poliqarp");
+        String result = handler.preProcess(s.toJSON(), user);
+        JsonNode node = JsonUtils.readTree(result);
+
+        UserDataDbIface dao = BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(),
+                        UserSettings.class);
+        UserSettings settings = (UserSettings) dao.get(user);
+        assertTrue(settings.isValid());
+        String lemma = (String) settings.get(Attributes.DEFAULT_LEMMA_FOUNDRY);
+
+        assertNotNull(node);
+        assertEquals("lemma", node.at("/query/wrap/layer").asText());
+        assertEquals(lemma, node.at("/query/wrap/foundry").asText());
+        assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
+        assertEquals("koral:rewrite",
+                node.at("/query/wrap/rewrites/0/@type").asText());
     }
 
     @Test
     public void testFoundryInjectJoinedQueryNoErrors() {
+        KustvaktConfiguration c = helper()
+                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+
         QuerySerializer s = new QuerySerializer();
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         s.setQuery("[orth=laufe/i & base!=Lauf]", "poliqarp");
-        assert handler.add(FoundryInject.class);
+        assertTrue(handler.add(FoundryInject.class));
         String result = handler.preProcess(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
 
-        assert node != null;
-        assert node.at("/query/wrap/@type").asText().equals("koral:termGroup");
-        assert !node.at("/query/wrap/operands/0/foundry").isMissingNode();
-        assert !node.at("/query/wrap/operands/0/rewrites").isMissingNode();
-        assert !node.at("/query/wrap/operands/1/foundry").isMissingNode();
-        assert !node.at("/query/wrap/operands/1/rewrites").isMissingNode();
+        assertNotNull(node);
+        assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
+        assertFalse(node.at("/query/wrap/operands/0/foundry").isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/0/rewrites").isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/1/foundry").isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
     }
 
     @Test
     public void testFoundryInjectGroupedQueryNoErrors() {
         QuerySerializer s = new QuerySerializer();
-        RewriteHandler handler = new RewriteHandler(config);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
-        assert handler.add(FoundryInject.class);
+        assertTrue(handler.add(FoundryInject.class));
         String result = handler.preProcess(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
 
-        assert node != null;
-        assert node.at("/query/wrap/@type").asText().equals("koral:termGroup");
-        assert !node.at("/query/wrap/operands/0/operands/0/foundry")
-                .isMissingNode();
-        assert !node.at("/query/wrap/operands/0/operands/0/rewrites")
-                .isMissingNode();
-        assert !node.at("/query/wrap/operands/0/operands/1/foundry")
-                .isMissingNode();
-        assert !node.at("/query/wrap/operands/0/operands/1/rewrites")
-                .isMissingNode();
+        assertNotNull(node);
+        assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
+        assertFalse(node.at("/query/wrap/operands/0/operands/0/foundry")
+                .isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/0/operands/0/rewrites")
+                .isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/0/operands/1/foundry")
+                .isMissingNode());
+        assertFalse(node.at("/query/wrap/operands/0/operands/1/rewrites")
+                .isMissingNode());
 
-        assert !node.at("/query/wrap/operands/1/foundry").isMissingNode();
-        assert node.at("/query/wrap/operands/1/rewrites").isMissingNode();
+        assertFalse(node.at("/query/wrap/operands/1/foundry").isMissingNode());
+        assertTrue(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
     }
 
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
index 6c0b8c4..09be840 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
@@ -1,34 +1,25 @@
+package de.ids_mannheim.korap.resource.rewrite;
+
 import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.resource.rewrite.IdWriter;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 /**
  * @author hanl
  * @date 21/10/2015
  */
-public class IdRewriteTest {
-
-    @BeforeClass
-    public static void setup() {
-        BeanConfiguration.loadClasspathContext();
-    }
-
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
+public class IdRewriteTest extends BeanConfigTest {
 
     @Test
     public void insertTokenId() {
-        RewriteHandler handler = new RewriteHandler(
-                BeanConfiguration.getBeans().getConfiguration());
-        assert handler.add(IdWriter.class);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        assertTrue(handler.add(IdWriter.class));
 
         String query = "[surface=Wort]";
         QuerySerializer s = new QuerySerializer();
@@ -37,9 +28,27 @@
         String value = handler.preProcess(s.toJSON(), null);
         JsonNode result = JsonUtils.readTree(value);
 
-        assert result != null;
-        assert result.path("query").has("idn");
-
+        assertNotNull(result);
+        assertTrue(result.path("query").has("idn"));
     }
 
+    @Test
+    public void testIdWriterTest() {
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        assertTrue(handler.add(IdWriter.class));
+
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[base=Haus]", "poliqarp");
+        String result = handler.preProcess(s.toJSON(), null);
+        JsonNode node = JsonUtils.readTree(result);
+        assertNotNull(node);
+        assertFalse(node.at("/query/wrap").isMissingNode());
+        assertFalse(node.at("/query/idn").isMissingNode());
+    }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
index 2771a06..a3b19a0 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
@@ -1,80 +1,82 @@
+package de.ids_mannheim.korap.resource.rewrite;
+
 import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.handlers.DocumentDao;
-import de.ids_mannheim.korap.resource.rewrite.DocMatchRewrite;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.resources.Document;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import net.sf.ehcache.CacheManager;
-import org.junit.*;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * @author hanl
  * @date 12/11/2015
  */
 //fixme: tests only work with singleconnection data sources
-public class PostRewriteTest {
+// todo: logging!
+public class PostRewriteTest extends BeanConfigTest {
 
-    @BeforeClass
-    public static void setup() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
+    @Override
+    public void initMethod() throws KustvaktException {
 
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
     }
 
     // otherwise cache will maintain values not relevant for other tests
     @Before
     public void before() {
         CacheManager.getInstance().getCache("documents").removeAll();
+        DocumentDao dao = new DocumentDao(
+                helper().getContext().getPersistenceClient());
+        dao.truncate();
     }
 
     @Test
-    public void testPostRewriteNothingToDo() {
-        RewriteHandler ha = new RewriteHandler(null);
-        Assert.assertEquals("Handler could not be added to rewriter instance!",
-                true, ha.add(DocMatchRewrite.class));
+    public void testPostRewriteNothingToDo() throws KustvaktException {
+        RewriteHandler ha = new RewriteHandler();
+        ha.insertBeans(helper().getContext());
+        assertEquals("Handler could not be added to rewriter instance!", true,
+                ha.add(DocMatchRewrite.class));
 
         DocumentDao dao = new DocumentDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
         try {
             Document d = dao.findbyId("BRZ13_APR.00014", null);
-            Assert.assertNull(d);
-        }catch (KustvaktException e) {
+            assertNull(d);
+            String v = ha.postProcess(RESULT, null);
+            assertEquals("results do not match", JsonUtils.readTree(RESULT),
+                    JsonUtils.readTree(v));
+        }catch (Exception e) {
             e.printStackTrace();
         }
-
-        String v = ha.postProcess(RESULT, null);
-        Assert.assertEquals("results do not match", JsonUtils.readTree(RESULT),
-                JsonUtils.readTree(v));
     }
 
     @Test
     public void testPostRewriteRemoveDoc() {
         DocumentDao dao = new DocumentDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
 
         Document doc = new Document("BRZ13_APR.00014");
         doc.setDisabled(true);
         try {
             dao.storeResource(doc, null);
         }catch (KustvaktException e) {
-            e.printStackTrace();
             return;
         }
 
-        RewriteHandler ha = new RewriteHandler(null);
-        Assert.assertEquals("Handler could not be added to rewriter instance!",
-                true, ha.add(DocMatchRewrite.class));
+        RewriteHandler ha = new RewriteHandler();
+        ha.insertBeans(helper().getContext());
+        assertEquals("Handler could not be added to rewriter instance!", true,
+                ha.add(DocMatchRewrite.class));
 
         String v = ha.postProcess(RESULT, null);
 
         JsonNode node = JsonUtils.readTree(v);
 
-        Assert.assertNotEquals("Wrong DocID", "BRZ13_APR.00014",
+        assertNotEquals("Wrong DocID", "BRZ13_APR.00014",
                 node.at("/matches/1/docID"));
 
         try {
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
index 059329c..d41a3a2 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -1,76 +1,107 @@
 package de.ids_mannheim.korap.resource.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import de.ids_mannheim.korap.config.BeanConfiguration;
-import de.ids_mannheim.korap.config.KustvaktConfiguration;
-import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.BeansFactory;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.user.UserSettings;
 import de.ids_mannheim.korap.utils.JsonUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 /**
  * @author hanl
  * @date 21/10/2015
  */
-public class RewriteHandlerTest {
-
-    @BeforeClass
-    public static void setup() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        TestHelper.setupAccount();
-    }
-
-    @AfterClass
-    public static void close() {
-        TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
-    }
+public class RewriteHandlerTest extends BeanConfigTest {
 
     @Test
     public void initHandler() {
-        RewriteHandler handler = new RewriteHandler(null);
-        assert handler.add(FoundryInject.class);
+        try {
+            RewriteHandler handler = new RewriteHandler();
+            handler.insertBeans(helper().getContext());
+            assertTrue(handler.add(FoundryInject.class));
+        }catch (Exception e) {
+            e.printStackTrace();
+
+        }
     }
 
     @Test
     public void testRewriteTaskAdd() {
-        RewriteHandler handler = new RewriteHandler(null);
-        assert handler.add(FoundryInject.class);
-        assert handler.add(DocMatchRewrite.class);
-        assert handler.add(CollectionCleanupFilter.class);
-        assert handler.add(IdWriter.class);
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        assertTrue(handler.add(FoundryInject.class));
+        assertTrue(handler.add(DocMatchRewrite.class));
+        assertTrue(handler.add(CollectionCleanupFilter.class));
+        assertTrue(handler.add(IdWriter.class));
+    }
+
+    // throws exception cause of missing configuration
+    @Test(expected = RuntimeException.class)
+    public void testRewriteConfigThrowsException() {
+        RewriteHandler handler = new RewriteHandler();
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
+        assertTrue(handler.add(FoundryInject.class));
+        handler.preProcess(s.toJSON(), null);
     }
 
     @Test
-    public void testRewriteFoundryInjectLemma() {
-        KustvaktConfiguration c = BeanConfiguration.getBeans()
-                .getConfiguration();
-        RewriteHandler handler = new RewriteHandler(c);
-        handler.add(FoundryInject.class);
+    public void testRewriteNoBeanInject() {
+        RewriteHandler handler = new RewriteHandler(helper().getContext().getConfiguration());
         QuerySerializer s = new QuerySerializer();
-        s.setQuery("[base=Haus]", "poliqarp");
-        String result = handler.preProcess(s.toJSON(), TestHelper.getUser());
-        JsonNode node = JsonUtils.readTree(result);
-        assert node != null;
-        assert node.at("/query/wrap/layer").asText().equals("lemma");
-        assert node.at("/query/wrap/foundry").asText().equals("test_l");
+        s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
+        assertTrue(handler.add(FoundryInject.class));
+        String res = handler.preProcess(s.toJSON(), null);
+        assertNotNull(res);
     }
 
     @Test
-    public void testRewriteFoundryInjectPOS() {
-        KustvaktConfiguration c = BeanConfiguration.getBeans()
-                .getConfiguration();
-        RewriteHandler handler = new RewriteHandler(c);
-        handler.add(FoundryInject.class);
+    public void testRewriteBeanInject() {
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
         QuerySerializer s = new QuerySerializer();
-        s.setQuery("[pos=ADJA]", "poliqarp");
-        String result = handler.preProcess(s.toJSON(), TestHelper.getUser());
-        JsonNode node = JsonUtils.readTree(result);
-        assert node != null;
-        assert node.at("/query/wrap/layer").asText().equals("pos");
-        assert node.at("/query/wrap/foundry").asText().equals("test_p");
+        s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
+        assertTrue(handler.add(FoundryInject.class));
+        String res = handler.preProcess(s.toJSON(), null);
+        JsonNode node = JsonUtils.readTree(res);
+        assertNotNull(node);
+
+        assertEquals("tt", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
+        assertEquals("tt", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+        assertEquals("tt", node.at("/query/wrap/operands/1/foundry").asText());
     }
 
+    @Test
+    public void testRewriteUserSpecific() {
+        RewriteHandler handler = new RewriteHandler();
+        handler.insertBeans(helper().getContext());
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
+        assertTrue(handler.add(FoundryInject.class));
+        String res = handler.preProcess(s.toJSON(), helper().getUser());
+        JsonNode node = JsonUtils.readTree(res);
+        assertNotNull(node);
+        assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
+        assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+        assertNotEquals("tt_test", node.at("/query/wrap/operands/1/foundry").asText());
+    }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+        UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(),UserSettings.class);
+        UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
+        s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
+        settingsdao.update(s);
+    }
+
+
+
 }
diff --git a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
new file mode 100644
index 0000000..cc3afda
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
@@ -0,0 +1,232 @@
+package de.ids_mannheim.korap.security;
+
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.db.PolicyHandlerIface;
+import de.ids_mannheim.korap.resources.Corpus;
+import de.ids_mannheim.korap.resources.KustvaktResource;
+import de.ids_mannheim.korap.resources.Permissions;
+import de.ids_mannheim.korap.resources.VirtualCollection;
+import de.ids_mannheim.korap.security.ac.PolicyBuilder;
+import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.user.User;
+import edu.emory.mathcs.backport.java.util.Arrays;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author hanl
+ * @date 09/02/2016
+ */
+public class PolicyDaoTest extends BeanConfigTest {
+
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+        helper().runBootInterfaces();
+        helper().setupResource(new Corpus("WPD_1"));
+    }
+
+    @Test
+    public void testPoliciesGet() throws KustvaktException {
+        User user = helper().getUser();
+        SecurityPolicy policy = new SecurityPolicy();
+        policy.addNewCondition(new PolicyCondition("test_1"));
+        policy.setCreator(user.getId());
+        policy.setTarget(new Corpus("WPD_1"));
+        policy.addPermission(Permissions.Permission.READ);
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+        assertTrue(dao.createPolicy(policy, user) > 0);
+        dao.getPolicies("WPD_1", user, Permissions.Permission.READ.toByte());
+    }
+
+    @Test
+    public void testPolicyCreate() throws KustvaktException {
+        User user = helper().getUser();
+        SecurityPolicy policy = new SecurityPolicy();
+        policy.addNewCondition(new PolicyCondition("test_1"));
+        policy.setCreator(user.getId());
+        policy.setTarget(new Corpus("WPD_1"));
+        policy.addPermission(Permissions.Permission.READ);
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+
+        assertTrue(dao.createPolicy(policy, user) > 0);
+        assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
+    }
+
+    @Test
+    public void testMappingConditions() {
+
+    }
+
+    @Test
+    public void failAddToConditionEqual() throws KustvaktException {
+        User user = helper().getUser();
+        SecurityPolicy policy = new SecurityPolicy();
+        policy.addNewCondition(new PolicyCondition("test_1"));
+        policy.setCreator(user.getId());
+        policy.setTarget(new Corpus("WPD_1"));
+        policy.addPermission(Permissions.Permission.READ);
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+
+        assertTrue(dao.createPolicy(policy, user) > 0);
+
+        dao.addToCondition(user.getUsername(), new PolicyCondition("test_1"),
+                true);
+        assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
+
+    }
+
+    @Test
+    public void failAddToConditionUnEqual() throws KustvaktException {
+        User user = helper().getUser();
+        SecurityPolicy policy = new SecurityPolicy();
+        policy.addNewCondition(new PolicyCondition("test_1"));
+        policy.setCreator(user.getId());
+        policy.setTarget(new Corpus("WPD_1"));
+        policy.addPermission(Permissions.Permission.READ);
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+        assertTrue(dao.createPolicy(policy, user) > 0);
+
+        dao.addToCondition(user.getUsername(), new PolicyCondition("test_1"),
+                false);
+
+        assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
+
+    }
+
+    @Test
+    public void removeUserFromCondition() throws KustvaktException {
+        User user = helper().getUser();
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+
+        SecurityPolicy policy = new SecurityPolicy();
+        policy.addNewCondition(new PolicyCondition("test_1"));
+        policy.setCreator(user.getId());
+        policy.setTarget(new Corpus("WPD_1"));
+        policy.addPermission(Permissions.Permission.READ);
+
+        assertTrue(dao.createPolicy(policy, user) > 0);
+        dao.removeFromCondition(
+                Arrays.asList(new String[] { user.getUsername() }),
+                new PolicyCondition("test_1"));
+        assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
+    }
+
+    @Test
+    public void testPolicyHierarchySelfSameType() throws KustvaktException {
+        String res = "WPD_child";
+        User user = helper().getUser();
+        Corpus c = new Corpus(res);
+        c.setParentID("WPD_1");
+        helper().setupResource(c);
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+
+        List[] pol = dao.getPolicies("WPD_child", user,
+                Permissions.Permission.READ.toByte());
+        assertNotNull(pol);
+        assertNotNull(pol[0]);
+        assertTrue(pol[0].get(0) instanceof SecurityPolicy.OwnerPolicy);
+        assertTrue(pol[1].get(0) instanceof SecurityPolicy.OwnerPolicy);
+
+        helper().dropResource(res);
+    }
+
+    @Test
+    @Ignore
+    public void testPolicyHierarchySelfDifferentType()
+            throws KustvaktException {
+        String res = "WPD_child";
+        User user = helper().getUser();
+        VirtualCollection c = new VirtualCollection(res);
+        c.setParentID(helper().getResource("WPD_1").getPersistentID());
+        helper().setupResource(c);
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+
+        List[] pol = dao.getPolicies("WPD_child", user,
+                Permissions.Permission.READ.toByte());
+        assertNotNull(pol);
+        assertNotNull(pol[0]);
+        assertTrue(pol[0].get(0) instanceof SecurityPolicy.OwnerPolicy);
+        assertTrue(pol[1].get(0) instanceof SecurityPolicy.OwnerPolicy);
+        helper().dropResource(res);
+    }
+
+    @Test
+    public void testPolicyHierarchyPublic() {
+
+    }
+
+    @Test
+    public void testPoliciesPublic() {
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+        Collection<SecurityPolicy> policies = dao
+                .getPolicies(new PolicyCondition("public"), Corpus.class,
+                        Permissions.Permission.READ.toByte());
+        assertNotEquals(0, policies.size());
+    }
+
+    @Test
+    @Ignore
+    public void testPoliciesPublicGeneric() {
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+        Collection<SecurityPolicy> policies = dao
+                .getPolicies(new PolicyCondition("public"),
+                        KustvaktResource.class,
+                        Permissions.Permission.READ.toByte());
+        assertNotEquals(0, policies.size());
+    }
+
+    @Test
+    public void searchResourcePoliciesPublic() throws KustvaktException {
+        User user = helper().getUser();
+        new PolicyBuilder(user).setConditions(new PolicyCondition("public"))
+                .setPermissions(Permissions.Permission.READ)
+                .setResources(new VirtualCollection("new_corpus")).create();
+
+        PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
+        List<SecurityPolicy> list = dao
+                .getPolicies(new PolicyCondition(Attributes.PUBLIC_GROUP),
+                        VirtualCollection.class,
+                        Permissions.Permission.READ.toByte());
+        assertNotEquals(0, list.size());
+        Set<String> ids = new HashSet<>();
+        for (SecurityPolicy p : list)
+            ids.add(p.getTarget());
+        assertNotEquals(0, ids.size());
+    }
+
+    @Test
+    public void testPolicyHierarchyRestricted() {
+
+    }
+
+    @Test
+    public void testSelfPolicies() {
+
+    }
+
+    @Test
+    public void testPublicPolicies() {
+
+    }
+
+    @Test
+    public void testConditions() {
+
+    }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
index 0c2adc1..681c197 100644
--- a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
@@ -1,107 +1,111 @@
 package de.ids_mannheim.korap.security.auth;
 
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.config.KustvaktBaseDaoInterface;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
-import de.ids_mannheim.korap.config.TestHelper;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
 import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
 import de.ids_mannheim.korap.user.*;
 import org.junit.After;
 import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Assert;
 import org.junit.Test;
 
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * @author hanl
  * @date 04/02/2016
  */
-public class KustvaktAuthenticationManagerTest {
-
-    @BeforeClass
-    public static void create() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        assert TestHelper.setupAccount();
-    }
-
-    @AfterClass
-    public static void close() {
-        assert TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
-    }
+public class KustvaktAuthenticationManagerTest extends BeanConfigTest {
 
     @After
-    public void after() throws KustvaktException {
-        User user = BeanConfiguration.getBeans().getAuthenticationManager()
-                .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
-                        .get(Attributes.USERNAME));
-        BeanConfiguration.getBeans().getAuthenticationManager()
-                .deleteAccount(user);
+    public void after() {
+        try {
+            User user = helper().getContext().getAuthenticationManager().getUser(
+                    (String) KustvaktConfiguration.KUSTVAKT_USER
+                            .get(Attributes.USERNAME));
+            helper().getContext().getAuthenticationManager().deleteAccount(user);
+        } catch (KustvaktException e) {
+        }
     }
 
     @Test
     public void testCreateUser() throws KustvaktException {
-        User user = BeanConfiguration.getBeans().getAuthenticationManager()
+        User user = helper().getContext().getAuthenticationManager()
                 .createUserAccount(KustvaktConfiguration.KUSTVAKT_USER, false);
 
-        EntityHandlerIface dao = BeanConfiguration.getBeans()
-                .getUserDBHandler();
-
-        assert ((KustvaktBaseDaoInterface) dao).size() > 0;
+        EntityHandlerIface dao = helper().getContext().getUserDBHandler();
+        assertNotEquals(0, ((KustvaktBaseDaoInterface) dao).size());
         User check = dao.getAccount(user.getUsername());
-        assert check != null;
+        assertNotNull(check);
+    }
+
+    @Test
+    public void testBatchStore() {
+        int i = 6;
+
+        AuthenticationManagerIface manager = helper().getContext()
+                .getAuthenticationManager();
+        for (int ix = 0; ix < i; ix++) {
+        }
+
     }
 
     @Test
     public void testUserdetailsGet() throws KustvaktException {
         testCreateUser();
-        AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+        AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
         User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
                 .get(Attributes.USERNAME));
 
         Userdata data = manager.getUserData(user, UserDetails.class);
-
-        assert data != null;
+        assertNotNull(data);
     }
 
     @Test
     public void testUsersettingsGet() throws KustvaktException {
         testCreateUser();
-        AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+        AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
         User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
                 .get(Attributes.USERNAME));
 
         Userdata data = manager.getUserData(user, UserSettings.class);
-        assert data != null;
+        assertNotNull(data);
     }
 
     @Test(expected = KustvaktException.class)
     public void testUserDetailsGetNonExistent() throws KustvaktException {
         testCreateUser();
-        AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+        AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
         User user = new KorAPUser(10, "random");
 
         Userdata data = manager.getUserData(user, UserDetails.class);
-        assert data != null;
+        assertNotNull(data);
     }
 
     @Test(expected = KustvaktException.class)
     public void testUserSettingsGetNonExistent() throws KustvaktException {
         testCreateUser();
-        AuthenticationManagerIface manager = BeanConfiguration.getBeans()
+        AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
         User user = new KorAPUser(10, "random");
 
         Userdata data = manager.getUserData(user, UserSettings.class);
-        assert data != null;
+        assertNotNull(data);
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
new file mode 100644
index 0000000..d569aa9
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
@@ -0,0 +1,20 @@
+package de.ids_mannheim.korap.suites;
+
+import de.ids_mannheim.korap.handlers.ResourceDaoTest;
+import de.ids_mannheim.korap.handlers.UserDaoTest;
+import de.ids_mannheim.korap.security.PolicyDaoTest;
+import de.ids_mannheim.korap.user.UserdataTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author hanl
+ * @date 26/02/2016
+ */
+
+@Deprecated
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ PolicyDaoTest.class, UserdataTest.class,
+        UserDaoTest.class, ResourceDaoTest.class })
+public class DaoTestSuite {
+}
diff --git a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
index e6da9e5..de082af 100644
--- a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
+++ b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
@@ -1,115 +1,120 @@
 package de.ids_mannheim.korap.user;
 
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.BeansFactory;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.dbException;
 import de.ids_mannheim.korap.handlers.UserDetailsDao;
 import de.ids_mannheim.korap.handlers.UserSettingsDao;
 import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
-import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 /**
  * @author hanl
  * @date 27/01/2016
  */
-public class UserdataTest {
-
-    @BeforeClass
-    public static void init() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-    }
-
-    @AfterClass
-    public static void drop() {
-        BeanConfiguration.closeApplication();
-    }
+public class UserdataTest extends BeanConfigTest {
 
     @Before
     public void clear() {
         UserDetailsDao dao = new UserDetailsDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
         UserSettingsDao sdao = new UserSettingsDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        assert dao.deleteAll() != -1;
-        assert sdao.deleteAll() != -1;
+                helper().getContext().getPersistenceClient());
+        assertNotEquals(-1, dao.deleteAll());
+        assertNotEquals(-1, sdao.deleteAll());
     }
 
     @Test
     public void testDataStore() {
+        String val = "value1;value_data";
         User user = new KorAPUser();
         user.setId(1);
         UserDetailsDao dao = new UserDetailsDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
         UserDetails d = new UserDetails(1);
-        d.addField("key_1", "value is a value");
-        assert dao.store(d) != -1;
+        d.setField("key_1", val);
+        assertNotEquals(-1, dao.store(d));
     }
 
     @Test
     public void testDataGet() throws dbException {
+        String val = "value1;value_data";
         User user = new KorAPUser();
         user.setId(1);
         UserDetailsDao dao = new UserDetailsDao(
-                BeanConfiguration.getBeans().getPersistenceClient());
+                helper().getContext().getPersistenceClient());
         UserDetails d = new UserDetails(1);
-        d.addField("key_1", "value is a value");
-        assert dao.store(d) != -1;
+        d.setField("key_1", val);
+        assertNotEquals(-1, dao.store(d));
 
         d = dao.get(d.getId());
-        assert d != null;
-        assert "value is a value".equals(d.get("key_1"));
+        assertNotNull(d);
+        assertEquals(val, d.get("key_1"));
 
         d = dao.get(user);
-        assert d != null;
-        assert "value is a value".equals(d.get("key_1"));
+        assertNotNull(d);
+        assertEquals(val, d.get("key_1"));
     }
 
     @Test
     public void testDataValidation() {
         Userdata data = new UserDetails(1);
-        data.addField(Attributes.COUNTRY, "Germany");
+        data.setField(Attributes.COUNTRY, "Germany");
 
         String[] req = data.requiredFields();
         String[] r = data.missing();
-        assert r.length > 0;
-        assert r.length == req.length;
-        assert !data.isValid();
+        assertNotEquals(0, r.length);
+        assertEquals(req.length, r.length);
+        assertFalse(data.isValid());
     }
 
     @Test
     public void testSettingsValidation() {
         Userdata data = new UserSettings(1);
-        data.addField(Attributes.FILE_FORMAT_FOR_EXPORT, "export");
+        data.setField(Attributes.FILE_FORMAT_FOR_EXPORT, "export");
 
         String[] req = data.requiredFields();
         String[] r = data.missing();
-        assert r.length == 0;
-        assert r.length == req.length;
-        assert data.isValid();
+        assertEquals(0, r.length);
+        assertEquals(req.length, r.length);
+        assertTrue(data.isValid());
     }
 
     @Test
     public void testUserdatafactory() throws KustvaktException {
-        UserDataDbIface dao = UserdataFactory.getDaoInstance(UserDetails.class);
-        assert UserDetailsDao.class.equals(dao.getClass());
+        UserDataDbIface dao = BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(), UserDetails.class);
+        assertNotNull(dao);
+        assertEquals(UserDetailsDao.class, dao.getClass());
+
+        dao = BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(), UserSettings.class);
+        assertNotNull(dao);
+        assertEquals(UserSettingsDao.class, dao.getClass());
+
     }
 
-    @Test(expected = KustvaktException.class)
+    @Test(expected = RuntimeException.class)
     public void testUserdatafactoryError() throws KustvaktException {
-        UserdataFactory.getDaoInstance(new Userdata(1) {
-            @Override
-            public String[] requiredFields() {
-                return new String[0];
-            }
+        BeansFactory.getTypeFactory()
+                .getTypedBean(helper().getContext().getUserDataDaos(), new Userdata(1) {
+                    @Override
+                    public String[] requiredFields() {
+                        return new String[0];
+                    }
 
-            @Override
-            public String[] defaultFields() {
-                return new String[0];
-            }
-        }.getClass());
+                    @Override
+                    public String[] defaultFields() {
+                        return new String[0];
+                    }
+                }.getClass());
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+    }
 }
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 c49b605..83e1438 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
@@ -11,6 +11,7 @@
 import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
 import com.sun.jersey.test.framework.spi.container.grizzly.GrizzlyTestContainerFactory;
 import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -23,7 +24,7 @@
  * @author hanl
  * @date 29/07/2015
  */
-public abstract class FastJerseyTest {
+public abstract class FastJerseyTest extends BeanConfigTest {
 
     private final static String API_VERSION = "v0.1";
 
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
index 4cf5ecb..ce7851d 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
@@ -1,15 +1,14 @@
 package de.ids_mannheim.korap.web.service;
 
 import de.ids_mannheim.korap.config.AuthCodeInfo;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.BeanConfigTest;
 import de.ids_mannheim.korap.config.ClientInfo;
-import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.config.ContextHolder;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.handlers.OAuth2Handler;
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
 import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.user.User;
-import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -19,48 +18,50 @@
  * @date 13/05/2015
  */
 
-public class OAuth2HandlerTest {
+public class OAuth2HandlerTest extends BeanConfigTest {
 
     private static ClientInfo info;
-    private static OAuth2Handler handler;
-    private static EncryptionIface crypto;
+
     private static final String SCOPES = "search preferences queries account";
-    private static User user;
 
     @BeforeClass
-    public static void setup() throws KustvaktException {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
-        handler = new OAuth2Handler(
-                BeanConfiguration.getBeans().getPersistenceClient());
-        crypto = BeanConfiguration.getBeans().getEncryption();
-        info = new ClientInfo(crypto.createID(), crypto.createToken());
-        info.setConfidential(true);
-        //todo: support for subdomains?!
-        info.setUrl("http://localhost:8080/api/v0.1");
-        info.setRedirect_uri("testwebsite/login");
-
-        TestHelper.setupAccount();
-        user = TestHelper.getUser();
-        handler.registerClient(info, user);
+    public static void setup() throws Exception {
+        //        BeanConfiguration.loadClasspathContext("default-config.xml");
+        //        handler = new OAuth2Handler(
+        //                BeanConfiguration.getKustvaktContext().getPersistenceClient());
+        //        crypto = BeanConfiguration.getKustvaktContext().getEncryption();
+//        info = new ClientInfo(crypto.createID(), crypto.createToken());
+        //        info.setConfidential(true);
+        //        //todo: support for subdomains?!
+        //        info.setUrl("http://localhost:8080/api/v0.1");
+        //        info.setRedirect_uri("testwebsite/login");
+        //
+        //        helper = TestHelper.newInstance();
+        //        helper.setupAccount();
+        //        PersistenceClient cl = helper.getBean(ContextHolder.KUSTVAKT_DB);
+        //        handler = new OAuth2Handler(cl);
+        //        handler.registerClient(info, helper.getUser());
+        //        crypto = helper.getBean(ContextHolder.KUSTVAKT_ENCRYPTION);
     }
 
-    @AfterClass
-    public static void drop() throws KustvaktException {
-        assert handler != null;
-        handler.removeClient(info, user);
-        TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
-    }
+    //    @AfterClass
+    //    public static void drop() throws KustvaktException {
+    //        assert handler != null;
+    //        handler.removeClient(info, helper().getUser());
+    //        helper().dropUser();
+    //        BeansFactory.closeApplication();
+    //    }
 
     @Test
     public void testStoreAuthorizationCodeThrowsNoException()
             throws KustvaktException {
-        String auth_code = crypto.createToken();
+        String auth_code = helper().getContext().getEncryption().createToken();
         AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
                 auth_code);
         codeInfo.setScopes(SCOPES);
 
-        handler.authorize(codeInfo, user);
+        OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+        handler.authorize(codeInfo, helper().getUser());
         codeInfo = handler.getAuthorization(auth_code);
         Assert.assertNotNull("client is null!", codeInfo);
     }
@@ -68,14 +69,15 @@
     @Test
     public void testAuthorizationCodeRemoveThrowsNoException()
             throws KustvaktException {
-        String auth_code = crypto.createToken();
+        String auth_code = helper().getContext().getEncryption().createToken();
         AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
                 auth_code);
         codeInfo.setScopes(SCOPES);
 
-        handler.authorize(codeInfo, user);
-        String t = crypto.createToken();
-        String refresh = crypto.createToken();
+        OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+        handler.authorize(codeInfo, helper().getUser());
+        String t = helper().getContext().getEncryption().createToken();
+        String refresh = helper().getContext().getEncryption().createToken();
         handler.addToken(codeInfo.getCode(), t, refresh, 7200);
 
         TokenContext ctx = handler.getContext(t);
@@ -92,7 +94,7 @@
 
     @Test
     public void testStoreAccessCodeViaAuthCodeThrowsNoException() {
-        String auth_code = crypto.createToken();
+        String auth_code = helper().getContext().getEncryption().createToken();
         AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
                 auth_code);
         codeInfo.setScopes(SCOPES);
@@ -119,4 +121,19 @@
     public void testAccessTokenExpired() {
 
     }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+
+        EncryptionIface crypto = helper().getContext().getEncryption();
+        info = new ClientInfo(crypto.createID(), crypto.createToken());
+        info.setConfidential(true);
+        //todo: support for subdomains?!
+        info.setUrl("http://localhost:8080/api/v0.1");
+        info.setRedirect_uri("testwebsite/login");
+        PersistenceClient cl = helper().getBean(ContextHolder.KUSTVAKT_DB);
+        OAuth2Handler handler = new OAuth2Handler(cl);
+        handler.registerClient(info, helper().getUser());
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
index 6ba0ddc..9a3f782 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -1,6 +1,11 @@
 package de.ids_mannheim.korap.web.service.full;
 
+import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.web.service.FastJerseyTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 /**
  * @author hanl
@@ -8,6 +13,40 @@
  */
 public class AuthServiceTest extends FastJerseyTest {
 
+    @BeforeClass
+    public static void configure() throws Exception {
+        FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
+                "de.ids_mannheim.korap.web.filter",
+                "de.ids_mannheim.korap.web.utils");
+    }
+
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+    }
+
+    @Test
+    public void testBasicHttp() {
+        User user = helper().getUser();
+
+    }
+
+    @Test
+    public void testBasicLogout(){
+
+    }
+
+    @Test
+    public void testSessionTokenLogin() {
+
+    }
+
+    @Test
+    public void testSessionTokenLogout() {
+
+    }
+
     //todo: test basicauth via secure connection
 
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
index 4b6f118..ac05e24 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
@@ -1,13 +1,12 @@
 package de.ids_mannheim.korap.web.service.full;
 
 import com.sun.jersey.api.client.ClientResponse;
-import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.config.TestHelper;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.web.service.FastJerseyTest;
 import org.eclipse.jetty.server.Response;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -18,18 +17,10 @@
 public class FilterTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void setup() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
+    public static void setup() throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
-        TestHelper.setupAccount();
-    }
-
-    @AfterClass
-    public static void close() {
-        TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
     }
 
     @Test
@@ -40,7 +31,6 @@
                                 TestHelper.getUserCredentials()[1]))
                 .get(ClientResponse.class);
         assert resp.getStatus() == Response.SC_OK;
-        System.out.println("entity '" + resp.getEntity(String.class) + "'");
     }
 
     @Test
@@ -58,4 +48,9 @@
                 .get(ClientResponse.class);
         assert resp.getStatus() == Response.SC_UNAUTHORIZED;
     }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
index f297953..f227ba3 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
@@ -1,12 +1,11 @@
 package de.ids_mannheim.korap.web.service.full;
 
 import com.sun.jersey.api.client.ClientResponse;
-import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.CollectionQueryProcessor;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.service.FastJerseyTest;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -22,17 +21,11 @@
 
     @BeforeClass
     public static void configure() {
-        BeanConfiguration.loadClasspathContext();
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.light",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
     }
 
-    @AfterClass
-    public static void close() {
-        BeanConfiguration.closeApplication();
-    }
-
     //    @Test
     public void testFieldsInSearch() {
         ClientResponse response = resource().path(getAPIVersion())
@@ -113,4 +106,8 @@
         System.out.println("RESPONSE " + response.getEntity(String.class));
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java
deleted file mode 100644
index 45182a6..0000000
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktResourceServiceTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package de.ids_mannheim.korap.web.service.full;
-
-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.exceptions.KustvaktException;
-import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
-import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.web.service.FastJerseyTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-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");
-        FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
-                "de.ids_mannheim.korap.web.filter",
-                "de.ids_mannheim.korap.web.utils");
-        TestHelper.runBootInterfaces();
-    }
-
-    @AfterClass
-    public static void close() throws KustvaktException {
-        BeanConfiguration.getBeans().getResourceProvider().deleteAll();
-        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
-    @Ignore
-    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;
-
-        System.out.println("-------------------------------");
-        System.out.println("NODE COLLECTIONS" + node);
-        String id = node.path(0).path("id").asText();
-
-        System.out.println("ID IS " + id);
-        System.out.println("FROM NODE " + node);
-        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));
-        assert node != null;
-        int docs = node.path("documents").asInt();
-        System.out.println("-------------------------------");
-        System.out.println("NODE " + node);
-        assert docs > 0 && docs < 15;
-    }
-
-    @Test
-    public void testResourceStore() {
-
-    }
-
-}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
index b94be84..9870cea 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
@@ -2,13 +2,12 @@
 
 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.exceptions.KustvaktException;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.service.FastJerseyTest;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -20,24 +19,11 @@
 // todo: in combination with other tests, causes failures!
 public class OAuth2EndpointTest extends FastJerseyTest {
 
-    private static String[] credentials;
-
-    @AfterClass
-    public static void close() {
-        System.out.println("RUNNING AFTER CLASS SHUTDOWN");
-        TestHelper.dropUser();
-        BeanConfiguration.closeApplication();
-    }
-
     @BeforeClass
-    public static void configure() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
+    public static void configure() throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
-
-        TestHelper.setupAccount();
-        credentials = TestHelper.getUserCredentials();
     }
 
     @Test
@@ -45,6 +31,11 @@
 
     }
 
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().setupAccount();
+    }
+
     @Test
     @Ignore
     public void testAuthorizeClient() {
@@ -72,7 +63,8 @@
     @Test
     @Ignore
     public void authenticate() {
-        String enc = BasicHttpAuth.encode(credentials[0], credentials[1]);
+        String[] cred = TestHelper.getUserCredentials();
+        String enc = BasicHttpAuth.encode(cred[0], cred[1]);
         ClientResponse response = resource().path("v0.1").path("oauth2")
                 .path("register")
                 .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
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 d202175..f3cf778 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
@@ -2,18 +2,20 @@
 
 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.exceptions.KustvaktException;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
 import de.ids_mannheim.korap.user.Attributes;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.service.FastJerseyTest;
-import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * @author hanl
  * @date 14/01/2016
@@ -21,21 +23,14 @@
 public class ResourceServiceTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void configure() {
-        BeanConfiguration.loadClasspathContext("default-config.xml");
+    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");
-        TestHelper.runBootInterfaces();
-    }
-
-    @AfterClass
-    public static void close() throws KustvaktException {
-        BeanConfiguration.getBeans().getResourceProvider().deleteAll();
-        BeanConfiguration.closeApplication();
     }
 
     @Test
+    @Ignore
     public void testSearchSimple() {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[orth=das]")
@@ -44,23 +39,26 @@
                 .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assert node.path("matches").size() > 0;
+        Assert.assertNotNull(node);
+        assertNotEquals(0, node.path("matches").size());
     }
 
     @Test
+    @Ignore
     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();
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-
-        assert node.size() > 0;
+        assertNotEquals(0, node.size());
     }
 
     @Test
@@ -70,10 +68,11 @@
                 .path("collection").header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        assert node != null;
+        Assert.assertNotNull(node);
 
         System.out.println("-------------------------------");
         System.out.println("NODE COLLECTIONS" + node);
@@ -86,13 +85,15 @@
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
 
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                response.getStatus());
         node = JsonUtils.readTree(response.getEntity(String.class));
-        assert node != null;
+        Assert.assertNotNull(node);
         int docs = node.path("documents").asInt();
         System.out.println("-------------------------------");
         System.out.println("NODE " + node);
-        assert docs > 0 && docs < 15;
+        assertNotEquals(0, docs);
+        Assert.assertTrue(docs < 15);
     }
 
     @Test
@@ -100,4 +101,61 @@
 
     }
 
+    @Test
+    @Ignore
+    public void testSerializationQueryInCollection() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("corpus/WPD/search").queryParam("q", "[base=Haus]")
+                .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
+                .method("TRACE", ClientResponse.class);
+        System.out.println("RESPONSE 1 " + response);
+        String ent = response.getEntity(String.class);
+        System.out.println("Entity 1 " + ent);
+    }
+
+    @Test
+    public void testSerializationQueryPublic() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[base=Haus]")
+                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
+                .method("TRACE", ClientResponse.class);
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        System.out.println("PUBLIC COLLECTION");
+        System.out.println(node);
+    }
+
+    @Test
+    public void testQuery() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("q", "[base=Haus]")
+                .queryParam("ql", "poliqarp").queryParam("context", "sentence")
+                .get(ClientResponse.class);
+        String ent = response.getEntity(String.class);
+        JsonNode node = JsonUtils.readTree(ent);
+        assertNotNull(node);
+        assertEquals("base/s:s", node.at("/meta/context").asText());
+        assertNotEquals("${project.version}", "/meta/version");
+    }
+
+    @Test
+    @Ignore
+    public void testSerializationMeta() {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("search").queryParam("context", "sentence")
+                .queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
+                .get(ClientResponse.class);
+    }
+
+    @Test
+    @Ignore
+    public void testSerializationCollection() {
+        ClientResponse response = resource().path(getAPIVersion()).path("")
+                .get(ClientResponse.class);
+    }
+
+    @Override
+    public void initMethod() throws KustvaktException {
+        helper().runBootInterfaces();
+    }
 }
diff --git a/src/test/resources/default-config.xml b/src/test/resources/default-config.xml
index ce2dc35..f669953 100644
--- a/src/test/resources/default-config.xml
+++ b/src/test/resources/default-config.xml
@@ -40,7 +40,7 @@
         <property name="locations">
             <array>
                 <value>classpath:jdbc.properties</value>
-                <value>file:./jdbc.properties</value>
+                <value>file:./jdbc_tests.properties</value>
             </array>
         </property>
     </bean>
@@ -62,13 +62,17 @@
 
     <!--class="org.apache.commons.dbcp2.BasicDataSource"-->
     <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
+    <!-- org.springframework.jdbc.datasource.DriverManagerDataSource -->
     <bean id="dataSource"
           class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
-          lazy-init="true">
-        <property name="driverClassName" value="${jdbc.driverClassName}"/>
-        <property name="url" value="${jdbc.url}"/>
-        <property name="username" value="${jdbc.username}"/>
-        <property name="password" value="${jdbc.password}"/>
+          lazy-init="false">
+        <property name="driverClassName" value="org.sqlite.JDBC"/>
+        <property name="url" value="jdbc:sqlite:tmp_new.sqlite"/>
+        <!--<property name="initialSize" value="1" />-->
+        <!--<property name="maxTotal" value="1" />-->
+        <!--<property name="maxIdle" value="1" />-->
+        <!--<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>
@@ -82,15 +86,14 @@
     <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
         <property name="baselineOnMigrate" value="false"/>
         <property name="locations"
-                  value="classpath:${jdbc.schemaPath}"/>
+                  value="classpath:db.sqlite"/>
         <property name="dataSource" ref="dataSource"/>
     </bean>
 
     <bean id="kustvakt_db"
           class="de.ids_mannheim.korap.handlers.JDBCClient">
         <constructor-arg index="0" ref="dataSource"/>
-        <!-- deprecated property -->
-        <property name="database" value="${jdbc.database}"/>
+        <property name="database" value="jdbc:sqlite::memory:"/>
     </bean>
 
     <bean id="kustvakt_userdetails"
@@ -114,8 +117,8 @@
     </bean>
 
     <!--<bean id="collectionProvider"-->
-          <!--class="de.ids_mannheim.korap.handlers.CollectionDao">-->
-        <!--<constructor-arg ref="kustvakt_db"/>-->
+    <!--class="de.ids_mannheim.korap.handlers.CollectionDao">-->
+    <!--<constructor-arg ref="kustvakt_db"/>-->
     <!--</bean>-->
 
     <!--fixme: change name according to convention -->
@@ -166,7 +169,7 @@
                 ref="kustvakt_encryption"/>
     </bean>
 
-    <util:list id="auth_providers"
+    <util:list id="kustvakt_authproviders"
                value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface">
         <ref bean="basic_auth"/>
         <ref bean="session_auth"/>
@@ -174,6 +177,26 @@
         <ref bean="openid_auth"/>
     </util:list>
 
+    <bean id="userdata_details"
+          class="de.ids_mannheim.korap.handlers.UserDetailsDao">
+        <constructor-arg
+                type="de.ids_mannheim.korap.interfaces.db.PersistenceClient"
+                ref="kustvakt_db"/>
+    </bean>
+    <bean id="userdata_settings"
+          class="de.ids_mannheim.korap.handlers.UserDetailsDao">
+        <constructor-arg
+                type="de.ids_mannheim.korap.interfaces.db.PersistenceClient"
+                ref="kustvakt_db"/>
+    </bean>
+
+    <util:list id="kustvakt_userdata"
+               value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface">
+        <ref bean="userdata_details"/>
+        <ref bean="userdata_settings"/>
+    </util:list>
+
+
     <!-- specify type for constructor argument -->
     <bean id="kustvakt_authenticationmanager"
           class="de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager">
@@ -186,8 +209,9 @@
         <constructor-arg
                 type="de.ids_mannheim.korap.interfaces.db.AuditingIface"
                 ref="kustvakt_auditing"/>
+        <constructor-arg ref="kustvakt_userdata"/>
         <!-- inject authentication providers to use -->
-        <property name="providers" ref="auth_providers"/>
+        <property name="providers" ref="kustvakt_authproviders"/>
     </bean>
 
     <!-- todo: if db interfaces not loaded via spring, does transaction even work then? -->
