use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1538Test method testEffectiveActive.
private void testEffectiveActive(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
BundleArchiveBuilder bab = new BundleArchiveBuilder();
bab.symbolicName("bundle");
bab.requireCapability("osgi.service;filter:=\"(&(objectClass=java.lang.Object)(foo=bar))\";effective:=active");
bab.exportPackage("foo");
Subsystem root = getRootSubsystem();
Bundle a = root.getBundleContext().installBundle("a", bab.build());
uninstallableBundles.add(a);
startBundle(a);
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).bundle("b", new BundleArchiveBuilder().symbolicName("b").importPackage("foo").build()).build(), flag);
uninstallableSubsystems.add(subsystem);
startSubsystem(subsystem, flag);
stoppableSubsystems.add(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed and started");
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class ManyFeaturesWithSharedBundlesTest method testInstallOneFeatureAfterAll.
@Test
@org.junit.Ignore
public void testInstallOneFeatureAfterAll() throws Exception {
Collection<Callable<Subsystem>> callables = createInstallFeatureCallables();
Collection<Future<Subsystem>> futures = executor.invokeAll(callables);
Callable<Subsystem> callable = new Callable<Subsystem>() {
@Override
public Subsystem call() throws Exception {
Subsystem feature = getRootSubsystem().install("onefeature", createFeature("onefeature"));
return feature;
}
};
runTrials(Collections.singletonList(callable));
uninstallSubsystems(futures);
}
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 TargetRegion method add.
private void add(Collection<Subsystem> children) {
for (Subsystem child : children) {
region.add(child);
if (((BasicSubsystem) child).isScoped()) {
// Children of scoped children are not part of the target region.
continue;
}
// Children of unscoped children are part of the target region.
add(child.getChildren());
}
}
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");
}
}
Aggregations