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 ProvisionPolicyTest method testProvisionToRoot.
@Test
public void testProvisionToRoot() throws Exception {
Subsystem root = getRootSubsystem();
Subsystem composite = installSubsystemFromFile(root, COMPOSITE_A);
try {
assertProvisionPolicy(composite, false);
Subsystem feature = installSubsystemFromFile(composite, FEATURE_B);
try {
assertProvisionPolicy(feature, false);
assertConstituent(feature, BUNDLE_A);
assertNotConstituent(feature, BUNDLE_B);
assertNotConstituent(composite, BUNDLE_A);
assertNotConstituent(composite, BUNDLE_B);
assertNotConstituent(root, BUNDLE_A);
assertConstituent(root, BUNDLE_B);
} finally {
uninstallSubsystemSilently(feature);
}
} finally {
uninstallSubsystemSilently(composite);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class ResolutionTest method testContentWithNonConstituentDependencyWithNonConstituentDependency.
/*
* Test that the right regions are used when validating capabilities.
*
* Application A contains a content bundle requiring capability A. Bundle B
* provides capability A and is available as an installable resource from a
* repository service. Bundle B also requires capability B. Bundle C is an
* already installed resource in the root subsystem providing capability B.
* When validating capability A, the subsystem should use the root region as
* the from region, and its own region as the to region. When validating
* capability B, the subsystem should use the root region as the from region
* as well as for the to region.
*/
@Test
public void testContentWithNonConstituentDependencyWithNonConstituentDependency() throws Exception {
// Register a repository service containing bundle B requiring
// capability B and providing capability A.
registerRepositoryService(BUNDLE_B);
Subsystem root = getRootSubsystem();
// Install unmanaged bundle C providing capability B as a constituent
// of the root subsystem.
Bundle bundleC = installBundleFromFile(BUNDLE_C, root);
try {
// Install application A with content bundle A requiring
// capability A.
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
// Make sure the Require-Capability exists for capability a...
assertHeaderExists(applicationA, Constants.REQUIRE_CAPABILITY);
// ...but not for capability b.
RequireCapabilityHeader header = new RequireCapabilityHeader(applicationA.getSubsystemHeaders(null).get(Constants.REQUIRE_CAPABILITY));
assertEquals("Wrong number of clauses", 1, header.getClauses().size());
Clause clause = header.getClauses().iterator().next();
assertEquals("Wrong path", "a", clause.getPath());
assertEquals("Wrong resolution directive", Constants.RESOLUTION_MANDATORY, clause.getDirective(Constants.RESOLUTION_DIRECTIVE).getValue());
assertEquals("Wrong effective directive", Constants.EFFECTIVE_RESOLVE, clause.getDirective(Constants.EFFECTIVE_DIRECTIVE).getValue());
try {
// Make sure the runtime resolution works as well.
applicationA.start();
} catch (SubsystemException e) {
fail("Application A should have started");
} finally {
stopAndUninstallSubsystemSilently(applicationA);
}
} catch (SubsystemException e) {
fail("Application A should have installed." + e.getMessage());
} finally {
uninstallSilently(bundleC);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class ResolutionTest method testMissingNativeCodeRequirement.
@Test
public void testMissingNativeCodeRequirement() throws Exception {
Subsystem applicationE = null;
try {
applicationE = installSubsystemFromFile(APPLICATION_E);
// TODO this should fail to intsall
} catch (SubsystemException e) {
e.printStackTrace();
fail("Installation should succeed for Bundle-NativeCode");
}
try {
applicationE.start();
fail("Expected to fail to install");
} catch (Exception e) {
// expected
} finally {
uninstallSubsystemSilently(applicationE);
}
}
Aggregations