use of org.icij.datashare.mode.CommonMode in project datashare by ICIJ.
the class WebApp method start.
static void start(Properties properties) throws Exception {
CommonMode mode = CommonMode.create(properties);
Thread webServerThread = new Thread(() -> new WebServer().withThreadCount(10).withSelectThreads(2).withWebSocketThreads(1).configure(mode.createWebConfiguration()).start(parseInt(mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT))));
webServerThread.start();
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE) && parseBoolean(properties.getProperty(OPEN_LINK))) {
waitForServerToBeUp(parseInt(mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT)));
Desktop.getDesktop().browse(URI.create(new URI("http://localhost:") + mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT)));
}
webServerThread.join();
}
use of org.icij.datashare.mode.CommonMode 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());
}
use of org.icij.datashare.mode.CommonMode 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);
}
Aggregations