Search in sources :

Example 1 with Routes

use of net.codestory.http.routes.Routes in project datashare by ICIJ.

the class UserTaskResourceTest method setupAppWith.

private void setupAppWith(String... userLogins) {
    final PropertiesProvider propertiesProvider = new PropertiesProvider();
    taskManager = new TaskManagerMemory(propertiesProvider);
    configure(new CommonMode(new Properties()) {

        @Override
        protected void configure() {
            bind(PropertiesProvider.class).toInstance(propertiesProvider);
            bind(PipelineRegistry.class).toInstance(mock(PipelineRegistry.class));
            bind(SessionIdStore.class).toInstance(SessionIdStore.inMemory());
            bind(TaskManager.class).toInstance(taskManager);
            bind(Filter.class).toInstance(new BasicAuthFilter("/", "ds", DatashareUser.users(userLogins)));
            bind(TaskFactory.class).toInstance(mock(TaskFactory.class));
            bind(Indexer.class).toInstance(mock(Indexer.class));
        }

        @Override
        protected Routes addModeConfiguration(Routes routes) {
            return routes.add(TaskResource.class).filter(Filter.class);
        }
    }.createWebConfiguration());
}
Also used : BasicAuthFilter(net.codestory.http.filters.basic.BasicAuthFilter) CommonMode(org.icij.datashare.mode.CommonMode) Routes(net.codestory.http.routes.Routes) Properties(java.util.Properties) PipelineRegistry(org.icij.datashare.extension.PipelineRegistry) PropertiesProvider(org.icij.datashare.PropertiesProvider) SessionIdStore(net.codestory.http.security.SessionIdStore) Indexer(org.icij.datashare.text.indexing.Indexer) Filter(net.codestory.http.filters.Filter) BasicAuthFilter(net.codestory.http.filters.basic.BasicAuthFilter)

Example 2 with Routes

use of net.codestory.http.routes.Routes in project datashare by ICIJ.

the class TaskResourceTest method setUp.

@Before
public void setUp() {
    PipelineRegistry pipelineRegistry = new PipelineRegistry(new PropertiesProvider());
    pipelineRegistry.register(EmailPipeline.class);
    configure(new CommonMode(new Properties()) {

        @Override
        protected void configure() {
            bind(TaskFactory.class).toInstance(taskFactory);
            bind(Indexer.class).toInstance(mock(Indexer.class));
            bind(TaskManager.class).toInstance(taskManager);
            bind(PipelineRegistry.class).toInstance(pipelineRegistry);
            bind(Filter.class).to(LocalUserFilter.class).asEagerSingleton();
            bind(PropertiesProvider.class).toInstance(new PropertiesProvider(getDefaultProperties()));
        }

        @Override
        protected Routes addModeConfiguration(Routes routes) {
            return routes.add(TaskResource.class).filter(LocalUserFilter.class);
        }
    }.createWebConfiguration());
    init(taskFactory);
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) Indexer(org.icij.datashare.text.indexing.Indexer) CommonMode(org.icij.datashare.mode.CommonMode) Routes(net.codestory.http.routes.Routes) Properties(java.util.Properties) PipelineRegistry(org.icij.datashare.extension.PipelineRegistry)

Aggregations

Properties (java.util.Properties)2 Routes (net.codestory.http.routes.Routes)2 PropertiesProvider (org.icij.datashare.PropertiesProvider)2 PipelineRegistry (org.icij.datashare.extension.PipelineRegistry)2 CommonMode (org.icij.datashare.mode.CommonMode)2 Indexer (org.icij.datashare.text.indexing.Indexer)2 Filter (net.codestory.http.filters.Filter)1 BasicAuthFilter (net.codestory.http.filters.basic.BasicAuthFilter)1 SessionIdStore (net.codestory.http.security.SessionIdStore)1 LocalUserFilter (org.icij.datashare.session.LocalUserFilter)1