use of com.yahoo.jdisc.test.NonWorkingOsgiFramework in project vespa by vespa-engine.
the class ApplicationLoaderTestCase method requireThatApplicationStartExceptionUnsetsAndDestroysApplication.
@Test
public void requireThatApplicationStartExceptionUnsetsAndDestroysApplication() throws Exception {
MyApplication app = MyApplication.newStartException();
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), Arrays.asList(new MyApplicationModule(app)));
loader.init(null, false);
try {
loader.start();
fail();
} catch (MyException e) {
}
assertNull(loader.application());
assertFalse(app.stop.await(100, TimeUnit.MILLISECONDS));
assertTrue(app.destroy.await(600, TimeUnit.SECONDS));
try {
loader.activateContainer(loader.newContainerBuilder());
fail();
} catch (ApplicationNotReadyException e) {
}
loader.stop();
loader.destroy();
}
use of com.yahoo.jdisc.test.NonWorkingOsgiFramework in project vespa by vespa-engine.
the class ApplicationEnvironmentModuleTestCase method requireThatContainerBuilderCanBeInjected.
@Test
public void requireThatContainerBuilderCanBeInjected() {
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), Collections.<Module>emptyList());
assertNotNull(new ApplicationEnvironmentModule(loader).containerBuilder());
assertNotNull(Guice.createInjector(new ApplicationEnvironmentModule(loader)).getInstance(ContainerBuilder.class));
}
use of com.yahoo.jdisc.test.NonWorkingOsgiFramework in project vespa by vespa-engine.
the class ApplicationEnvironmentModuleTestCase method requireThatBindingsExist.
@Test
public void requireThatBindingsExist() {
List<Class<?>> expected = new LinkedList<>();
expected.add(ContainerActivator.class);
expected.add(ContainerBuilder.class);
expected.add(CurrentContainer.class);
expected.add(OsgiFramework.class);
expected.add(ThreadFactory.class);
Injector injector = Guice.createInjector();
for (Map.Entry<Key<?>, Binding<?>> entry : injector.getBindings().entrySet()) {
expected.add(entry.getKey().getTypeLiteral().getRawType());
}
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), Collections.<Module>emptyList());
injector = Guice.createInjector(new ApplicationEnvironmentModule(loader));
for (Map.Entry<Key<?>, Binding<?>> entry : injector.getBindings().entrySet()) {
assertNotNull(expected.remove(entry.getKey().getTypeLiteral().getRawType()));
}
assertTrue(expected.isEmpty());
}
use of com.yahoo.jdisc.test.NonWorkingOsgiFramework in project vespa by vespa-engine.
the class ApplicationLoaderTestCase method requireThatStopDoesNotFailWithoutStart.
@Test
public void requireThatStopDoesNotFailWithoutStart() throws Exception {
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), Collections.<Module>emptyList());
loader.stop();
loader.destroy();
}
use of com.yahoo.jdisc.test.NonWorkingOsgiFramework in project vespa by vespa-engine.
the class ApplicationLoaderTestCase method requireThatApplicationStopExceptionDestroysApplication.
@Test
public void requireThatApplicationStopExceptionDestroysApplication() throws Exception {
MyApplication app = MyApplication.newStopException();
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), Arrays.asList(new MyApplicationModule(app)));
loader.init(null, false);
loader.start();
try {
loader.stop();
} catch (MyException e) {
}
assertTrue(app.destroy.await(600, TimeUnit.SECONDS));
loader.destroy();
}
Aggregations