use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ContainerTerminationTestCase method requireThatAppContextIsFromBuilder.
@Test
public void requireThatAppContextIsFromBuilder() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
Object obj = new Object();
builder.setAppContext(obj);
driver.activateContainer(builder);
DeactivatedContainer container = driver.activateContainer(null);
assertSame(obj, container.appContext());
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class AbstractServerProviderTestCase method requireThatAbstractClassIsAServerProvider.
@Test
public void requireThatAbstractClassIsAServerProvider() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
assertTrue(ServerProvider.class.isInstance(new MyServerProvider(driver)));
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class CurrentContainerTestCase method requireThatNewRequestsCreateSnapshot.
@Test
public void requireThatNewRequestsCreateSnapshot() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
driver.activateContainer(driver.newContainerBuilder());
Request request = new Request(driver, URI.create("http://host/path"));
assertNotNull(request.container());
request.release();
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ProxyRequestHandlerTestCase method requireThatRequestContentCompletedIsProxied.
@Test
public void requireThatRequestContentCompletedIsProxied() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
MyRequestHandler requestHandler = MyRequestHandler.newInstance();
Request request = newRequest(driver, requestHandler);
ContentChannel resolvedContent = request.connect(MyResponseHandler.newEagerCompletion());
request.release();
assertSame(request, requestHandler.request);
ByteBuffer buf = ByteBuffer.allocate(69);
resolvedContent.write(buf, null);
assertSame(buf, requestHandler.content.writeBuf);
requestHandler.content.writeCompletion.completed();
MyCompletion writeCompletion = new MyCompletion();
resolvedContent.write(buf = ByteBuffer.allocate(69), writeCompletion);
assertSame(buf, requestHandler.content.writeBuf);
assertFalse(writeCompletion.completed);
assertNull(writeCompletion.failed);
requestHandler.content.writeCompletion.completed();
assertTrue(writeCompletion.completed);
assertNull(writeCompletion.failed);
MyCompletion closeCompletion = new MyCompletion();
resolvedContent.close(closeCompletion);
assertTrue(requestHandler.content.closed);
assertFalse(closeCompletion.completed);
assertNull(writeCompletion.failed);
requestHandler.content.closeCompletion.completed();
assertTrue(closeCompletion.completed);
assertNull(closeCompletion.failed);
requestHandler.respond();
assertTrue(driver.close());
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ProxyRequestHandlerTestCase method requireThatNullRequestContentIsProxied.
@Test
public void requireThatNullRequestContentIsProxied() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
MyRequestHandler requestHandler = MyRequestHandler.newNullContent();
Request request = newRequest(driver, requestHandler);
request.connect(MyResponseHandler.newEagerCompletion()).close(null);
request.release();
requestHandler.respond();
assertTrue(driver.close());
}
Aggregations