use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class BundleInstallerIntegrationTest method requireThatInstallWorks.
@Test
public void requireThatInstallWorks() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
List<Bundle> prev = new LinkedList<>(driver.osgiFramework().bundles());
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
Bundle bundle = installer.installAndStart("cert-a.jar").get(0);
assertNotNull(bundle);
assertEquals("com.yahoo.vespa.jdisc_core.cert-a", bundle.getSymbolicName());
boolean found = false;
for (Bundle entry : driver.osgiFramework().bundles()) {
assertNotNull(entry);
if (prev.remove(entry)) {
continue;
}
assertFalse(found);
assertSame(bundle, entry);
found = true;
}
assertTrue(prev.isEmpty());
assertTrue(found);
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class BundleInstallerIntegrationTest method requireThatUninstallAllWorks.
@Test
public void requireThatUninstallAllWorks() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
List<Bundle> prev = new LinkedList<>(driver.osgiFramework().bundles());
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
List<Bundle> bundles = installer.installAndStart("cert-a.jar", "cert-b.jar");
assertNotNull(bundles);
installer.stopAndUninstall(bundles);
List<Bundle> next = new LinkedList<>(driver.osgiFramework().bundles());
next.removeAll(prev);
assertTrue(next.isEmpty());
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class BundleInstallerIntegrationTest method requireThatPrivilegedActivatorInstructionButNoRootPrivilegesKindOfWorksOnABestEffortBasis.
@Test
public void requireThatPrivilegedActivatorInstructionButNoRootPrivilegesKindOfWorksOnABestEffortBasis() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
installer.installAndStart("cert-j-priv.jar");
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class BundleInstallerIntegrationTest method requireThatInstallInstalledThrowsException.
@Test
public void requireThatInstallInstalledThrowsException() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
BundleInstaller installer = new BundleInstaller(driver.osgiFramework());
Bundle bundle = installer.installAndStart("cert-a.jar").get(0);
assertNotNull(bundle);
try {
installer.installAndStart("cert-a.jar");
fail();
} catch (BundleException e) {
assertEquals("OSGi bundle com.yahoo.vespa.jdisc_core.cert-a already started.", e.getMessage());
}
driver.close();
}
use of com.yahoo.jdisc.test.TestDriver in project vespa by vespa-engine.
the class ServerRepositoryIntegrationTest method requireThatInstallUnknownClassThrows.
@Test
public void requireThatInstallUnknownClassThrows() 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();
try {
builder.serverProviders().install(bundle, "class.not.Found");
fail();
} catch (ClassNotFoundException e) {
}
driver.close();
}
Aggregations