use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class DynamicImportTest method verifyThatDynamicImportNeedsHandling.
/*
* Install an .esa containing a bundle with a BundleActivator, and a
* DynamicImport-Package on org.apache.aries.subsystem.itests.hello.api.
* This app should fail to start because we've not yet intervened to permit
* this dynamic package wiring requirement from being met.
*/
@Test
public void verifyThatDynamicImportNeedsHandling() throws Exception {
Subsystem subsystem = installSubsystemFromFile("dynamicImport.esa");
try {
startSubsystem(subsystem);
Bundle[] bundles = subsystem.getBundleContext().getBundles();
for (Bundle b : bundles) {
System.out.println(b.getSymbolicName() + " -> " + b.getState());
}
fail("dynamicImport.esa started when we didn't expect it to");
} catch (SubsystemException sx) {
Throwable cause = sx.getCause();
assertTrue("BundleException expected", cause instanceof BundleException);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class SubsystemDependency_4E2Test method test4E2A_where_S2isAComposite.
/* Repeat test [4e2a.app] with S2 as a composite
* that imports package x, requires bundle A and required capability y
*/
@Test
public void test4E2A_where_S2isAComposite() throws Exception {
Subsystem s1 = installSubsystemFromFile(SUBSYSTEM_4E2_S1_COMP);
startSubsystem(s1);
Subsystem s2 = installSubsystemFromFile(s1, SUBSYSTEM_4E2_S2_COMP);
startSubsystem(s2);
verifyBundlesInstalled(s1.getBundleContext(), "s1", BUNDLE_A, BUNDLE_B);
// - Verify the wiring of C, D and E wire to A->x, A, B->y respectively
checkBundlesCDandEWiredToAandB(s2);
stop(s1, s2);
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class SubsystemDependency_4E2Test method test4E2A_where_S2isAFeature.
/*
* - Repeat test [4e2a.app] with S2 as a feature
*/
@Test
public void test4E2A_where_S2isAFeature() throws Exception {
Subsystem s1 = installSubsystemFromFile(SUBSYSTEM_4E2_S1_COMP);
startSubsystem(s1);
Subsystem s2 = installSubsystemFromFile(s1, SUBSYSTEM_4E2_S2_FEATURE);
startSubsystem(s2);
verifyBundlesInstalled(s1.getBundleContext(), "s1", BUNDLE_A, BUNDLE_B);
// - Verify the wiring of C, D and E wire to A->x, A, B->y respectively
checkBundlesCDandEWiredToAandB(s2);
stop(s1, s2);
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class ApplicationTest method testApplication1.
/*
* Subsystem application1 has content bundle tb1.jar.
* Bundle tb1.jar has an import package dependency on org.apache.aries.subsystem.itests.tb3.
*/
@Test
public void testApplication1() throws Exception {
Subsystem application1 = installSubsystemFromFile("application1.esa");
try {
assertSymbolicName("org.apache.aries.subsystem.application1", application1);
assertVersion("0.0.0", application1);
assertType(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, application1);
assertChildren(0, application1);
assertConstituents(2, application1);
startSubsystem(application1);
assertBundleState(Bundle.RESOLVED | Bundle.ACTIVE, "org.apache.aries.subsystem.itests.tb1", application1);
assertBundleState(Bundle.RESOLVED | Bundle.ACTIVE, "org.apache.aries.subsystem.itests.tb3", getRootSubsystem());
} finally {
stopSubsystemSilently(application1);
uninstallSubsystemSilently(application1);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class ApplicationTest method testRequireBundle.
@Test
public void testRequireBundle() throws Exception {
File file = new File(BUNDLE_B);
// The following input stream is closed by the bundle context.
Bundle b = getRootSubsystem().getBundleContext().installBundle(file.toURI().toString(), new FileInputStream(file));
try {
Subsystem application = installSubsystemFromFile(APPLICATION_B);
try {
startSubsystem(application);
} finally {
stopSubsystemSilently(application);
uninstallSubsystemSilently(application);
}
} finally {
uninstallSilently(b);
}
}
Aggregations