use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepositoryTestCase method requireThatInstallAllWorks.
@Test
public void requireThatInstallAllWorks() {
ServerRepository servers = newServerRepository();
ServerProvider foo = new MyServer();
ServerProvider bar = new MyServer();
servers.installAll(Arrays.asList(foo, bar));
Iterator<ServerProvider> it = servers.iterator();
assertTrue(it.hasNext());
assertSame(foo, it.next());
assertTrue(it.hasNext());
assertSame(bar, it.next());
assertFalse(it.hasNext());
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepositoryTestCase method requireThatUninstallWorks.
@Test
public void requireThatUninstallWorks() {
ServerRepository servers = newServerRepository();
ServerProvider server = new MyServer();
servers.install(server);
servers.uninstall(server);
assertFalse(servers.iterator().hasNext());
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class NonWorkingServerTestCase method requireThatReleaseDoesNotThrow.
@Test
public void requireThatReleaseDoesNotThrow() {
ServerProvider server = new NonWorkingServerProvider();
server.release();
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepositoryIntegrationTest method requireThatInstallFromBundleWorks.
@Test
public void requireThatInstallFromBundleWorks() throws Exception {
MyModule module = new MyModule();
TestDriver driver = TestDriver.newSimpleApplicationInstance(module);
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
Bundle bundle = installer.installAndStart("my-server-provider.jar").get(0);
ContainerBuilder builder = driver.newContainerBuilder();
builder.serverProviders().install(bundle, "com.yahoo.jdisc.bundle.MyServerProvider");
assertTrue(module.init.await(60, TimeUnit.SECONDS));
Iterator<ServerProvider> it = builder.serverProviders().iterator();
assertTrue(it.hasNext());
ServerProvider server = it.next();
assertNotNull(server);
server.start();
assertTrue(module.start.await(60, TimeUnit.SECONDS));
server.close();
assertTrue(module.close.await(60, TimeUnit.SECONDS));
server.release();
assertTrue(module.destroy.await(60, TimeUnit.SECONDS));
assertFalse(it.hasNext());
driver.close();
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepositoryIntegrationTest method requireThatInstallAllFromBundleWorks.
@Test
public void requireThatInstallAllFromBundleWorks() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstance(new MyModule());
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
Bundle bundle = installer.installAndStart("my-server-provider.jar").get(0);
ContainerBuilder builder = driver.newContainerBuilder();
builder.serverProviders().installAll(bundle, Arrays.asList("com.yahoo.jdisc.bundle.MyServerProvider", "com.yahoo.jdisc.bundle.MyServerProvider"));
Iterator<ServerProvider> it = builder.serverProviders().iterator();
assertTrue(it.hasNext());
assertNotNull(it.next());
assertTrue(it.hasNext());
assertNotNull(it.next());
assertFalse(it.hasNext());
driver.close();
}
Aggregations