use of com.yahoo.jdisc.service.CurrentContainer in project vespa by vespa-engine.
the class ConnectionControlSearcherTestCase method doSearch.
private Result doSearch(URI uri, long connectedAtMillis, long nowMillis) {
SocketAddress remoteAddress = Mockito.mock(SocketAddress.class);
Version version = Version.HTTP_1_1;
Method method = Method.GET;
CurrentContainer container = Mockito.mock(CurrentContainer.class);
Mockito.when(container.newReference(Mockito.any())).thenReturn(Mockito.mock(Container.class));
final com.yahoo.jdisc.http.HttpRequest serverRequest = com.yahoo.jdisc.http.HttpRequest.newServerRequest(container, uri, method, version, remoteAddress, connectedAtMillis);
HttpRequest incoming = new HttpRequest(serverRequest, new ByteArrayInputStream(new byte[0]));
Query query = new Query(incoming);
Execution e = new Execution(new Chain<Searcher>(ConnectionControlSearcher.createTestInstance(() -> nowMillis)), Execution.Context.createContextStub());
Result r = e.search(query);
return r;
}
use of com.yahoo.jdisc.service.CurrentContainer in project vespa by vespa-engine.
the class EmptyResponseFilterTestCase method newRequest.
private static HttpRequest newRequest(final Method method, final String uri, final Version version) {
final CurrentContainer currentContainer = mock(CurrentContainer.class);
when(currentContainer.newReference(any(URI.class))).thenReturn(mock(Container.class));
return HttpRequest.newServerRequest(currentContainer, URI.create(uri), method, version);
}
use of com.yahoo.jdisc.service.CurrentContainer in project vespa by vespa-engine.
the class HttpResponseTestCase method mockContainer.
private static CurrentContainer mockContainer() {
final CurrentContainer currentContainer = mock(CurrentContainer.class);
when(currentContainer.newReference(any(URI.class))).thenReturn(mock(Container.class));
return currentContainer;
}
use of com.yahoo.jdisc.service.CurrentContainer in project vespa by vespa-engine.
the class RequestTestCase method requireThatDestroyReleasesContainer.
@Test
public void requireThatDestroyReleasesContainer() {
final MyContainer container = new MyContainer();
Request request = new Request(new CurrentContainer() {
@Override
public Container newReference(URI uri) {
return container;
}
}, URI.create("http://localhost/"));
assertEquals(1, container.refCount);
request.release();
assertEquals(0, container.refCount);
}
use of com.yahoo.jdisc.service.CurrentContainer in project vespa by vespa-engine.
the class ApplicationLoaderTestCase method requireThatOsgiServicesAreRegistered.
@Test
public void requireThatOsgiServicesAreRegistered() {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
BundleContext ctx = driver.osgiFramework().bundleContext();
Object service = ctx.getService(ctx.getServiceReference(CurrentContainer.class.getName()));
assertTrue(service instanceof CurrentContainer);
assertTrue(driver.close());
}
Aggregations