Search in sources :

Example 6 with ServerProvider

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());
}
Also used : ServerProvider(com.yahoo.jdisc.service.ServerProvider) Test(org.junit.Test)

Example 7 with ServerProvider

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());
}
Also used : ServerProvider(com.yahoo.jdisc.service.ServerProvider) Test(org.junit.Test)

Example 8 with ServerProvider

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();
}
Also used : ServerProvider(com.yahoo.jdisc.service.ServerProvider) Test(org.junit.Test)

Example 9 with ServerProvider

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();
}
Also used : ServerProvider(com.yahoo.jdisc.service.ServerProvider) Bundle(org.osgi.framework.Bundle) TestDriver(com.yahoo.jdisc.test.TestDriver) Test(org.junit.Test)

Example 10 with ServerProvider

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();
}
Also used : ServerProvider(com.yahoo.jdisc.service.ServerProvider) Bundle(org.osgi.framework.Bundle) TestDriver(com.yahoo.jdisc.test.TestDriver) Test(org.junit.Test)

Aggregations

ServerProvider (com.yahoo.jdisc.service.ServerProvider)13 Test (org.junit.Test)10 TestDriver (com.yahoo.jdisc.test.TestDriver)3 Bundle (org.osgi.framework.Bundle)2 Deconstructor (com.yahoo.container.jdisc.component.Deconstructor)1 ContainerBuilder (com.yahoo.jdisc.application.ContainerBuilder)1 NonWorkingServerProvider (com.yahoo.jdisc.test.NonWorkingServerProvider)1 HashSet (java.util.HashSet)1