use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class AbstractApplicationTestCase method requireThatContainerApiIsAvailable.
@Test
public void requireThatContainerApiIsAvailable() {
TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class);
MyApplication app = (MyApplication) driver.application();
app.activateContainer(app.newContainerBuilder());
assertNotNull(app.container());
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ContainerBuilderTestCase method requireThatBindingSetsAreCreatedOnDemand.
@Test
public void requireThatBindingSetsAreCreatedOnDemand() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
BindingRepository<?> repo = builder.serverBindings("foo");
assertNotNull(repo);
assertSame(repo, builder.serverBindings("foo"));
assertNotNull(repo = builder.serverBindings("bar"));
assertSame(repo, builder.serverBindings("bar"));
assertNotNull(repo = builder.clientBindings("baz"));
assertSame(repo, builder.clientBindings("baz"));
assertNotNull(repo = builder.clientBindings("cox"));
assertSame(repo, builder.clientBindings("cox"));
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ContainerBuilderTestCase method requireThatContainerThreadFactoryIsBound.
@Test
public void requireThatContainerThreadFactoryIsBound() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
assertSame(ContainerThread.Factory.class, builder.getInstance(ThreadFactory.class).getClass());
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class MbusRequestHandlerTestCase method requireThatHandlerCanRespondInSameThread.
@Test
public void requireThatHandlerCanRespondInSameThread() throws Exception {
TestDriver driver = newTestDriver(SameThreadReplier.INSTANCE);
Response response = dispatchMessage(driver, new SimpleMessage("msg")).get(60, TimeUnit.SECONDS);
assertTrue(response instanceof MbusResponse);
assertEquals(Response.Status.OK, response.getStatus());
Reply reply = ((MbusResponse) response).getReply();
assertTrue(reply instanceof EmptyReply);
assertFalse(reply.hasErrors());
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class MbusRequestHandlerTestCase method newTestDriver.
private static TestDriver newTestDriver(MbusRequestHandler handler) {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
builder.serverBindings().bind("mbus://*/*", handler);
driver.activateContainer(builder);
return driver;
}
Aggregations