use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class BasicSubsystem method getParents.
@Override
public Collection<Subsystem> getParents() {
AriesSubsystemParentsHeader header = getDeploymentManifest().getAriesSubsystemParentsHeader();
if (header == null)
return Collections.emptyList();
Collection<Subsystem> result = new ArrayList<Subsystem>(header.getClauses().size());
for (AriesSubsystemParentsHeader.Clause clause : header.getClauses()) {
BasicSubsystem subsystem = Activator.getInstance().getSubsystems().getSubsystemById(clause.getId());
if (subsystem == null)
continue;
result.add(subsystem);
}
return result;
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1608Test method test.
private void test(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).content("org.apache.aries.subsystem.itests.aries1608provider,org.apache.aries.subsystem.itests.aries1608required").bundle("aries1608required", getClass().getClassLoader().getResourceAsStream("aries1608/aries1608required.jar")).build(), flag);
try {
startSubsystem(subsystem, flag);
stopSubsystem(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have started");
} finally {
uninstallSubsystemSilently(subsystem);
}
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed");
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1434Test method testActiveChild.
@Test
public void testActiveChild() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Subsystem compositeA = getChild(applicationA, COMPOSITE_A, null, SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE);
startSubsystem(compositeA);
try {
assertState(State.ACTIVE, compositeA);
startSubsystem(applicationA);
try {
assertState(State.ACTIVE, applicationA);
assertState(State.ACTIVE, compositeA);
} finally {
stopSubsystemSilently(applicationA);
}
} finally {
stopSubsystemSilently(compositeA);
}
} finally {
uninstallSubsystemSilently(applicationA);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1435Test method testWovenSubsystemContainsProvider.
@Test
public void testWovenSubsystemContainsProvider() throws Exception {
registerWeavingHook("b");
Subsystem applicationE = installSubsystemFromFile(APPLICATION_E);
try {
assertConstituent(applicationE, BUNDLE_B);
testDynamicImport(applicationE, "b.B");
testSharingPolicy(applicationE, "b", false);
} finally {
uninstallSubsystemSilently(applicationE);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1435Test method testWildcardEverything.
@Test
public void testWildcardEverything() throws Exception {
registerWeavingHook("b", "*");
Subsystem compositeB = installSubsystemFromFile(COMPOSITE_B);
try {
Bundle bundleB = compositeB.getBundleContext().installBundle(BUNDLE_B, new ByteArrayInputStream(createBundleBContent()));
try {
Subsystem applicationB = installSubsystemFromFile(compositeB, APPLICATION_B);
Subsystem featureB = installSubsystemFromFile(applicationB, FEATURE_B);
Subsystem applicationE = installSubsystemFromFile(featureB, APPLICATION_E);
testSharingPolicy(applicationE, "b", false);
testSharingPolicy(applicationE, "org.osgi.framework.Constants", false);
testSharingPolicy(applicationB, "b", false);
testSharingPolicy(applicationB, "org.osgi.framework.Constants", false);
testSharingPolicy(compositeB, "b", false);
testSharingPolicy(compositeB, "org.osgi.framework.Constants", false);
testSharingPolicy(getRootSubsystem(), "b", false);
testSharingPolicy(getRootSubsystem(), "org.osgi.framework.Constants", false);
testDynamicImport(applicationE, "b.B");
testDynamicImport(applicationE, "org.osgi.framework.Constants");
testDynamicImport(featureB, "b.B");
testDynamicImport(featureB, "org.osgi.framework.Constants");
testDynamicImport(applicationB, "b.B");
testDynamicImport(applicationB, "org.osgi.framework.Constants");
testDynamicImport(compositeB, "b.B");
testDynamicImport(compositeB, "org.osgi.framework.Constants");
testSharingPolicy(applicationE, "b", true);
testSharingPolicy(applicationE, "org.osgi.framework.Constants", true);
testSharingPolicy(applicationB, "b", true);
testSharingPolicy(applicationB, "org.osgi.framework.Constants", true);
testSharingPolicy(compositeB, "b", true);
testSharingPolicy(compositeB, "org.osgi.framework.Constants", true);
testSharingPolicy(getRootSubsystem(), "b", false);
testSharingPolicy(getRootSubsystem(), "org.osgi.framework.Constants", false);
uninstallSubsystemSilently(applicationE);
uninstallSubsystemSilently(featureB);
uninstallSubsystemSilently(applicationB);
} finally {
uninstallSilently(bundleB);
}
} finally {
uninstallSubsystemSilently(compositeB);
}
}
Aggregations