use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1435Test method testNoProviders.
@Test
public void testNoProviders() throws Exception {
registerWeavingHook("b");
Subsystem applicationB = installSubsystemFromFile(APPLICATION_B);
try {
Bundle bundleA = getConstituentAsBundle(applicationB, BUNDLE_A, null, null);
bundleA.loadClass("a.A");
try {
bundleA.loadClass("b.B");
fail("Class should not have loaded");
} catch (ClassNotFoundException e) {
// Okay.
}
testSharingPolicy(applicationB, "b", false);
} finally {
uninstallSubsystemSilently(applicationB);
}
}
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 Aries1435Test method testChildExportsPackage.
@Test
public void testChildExportsPackage() throws Exception {
registerWeavingHook("b");
Subsystem applicationB = installSubsystemFromFile(APPLICATION_B);
try {
Subsystem compositeE = installSubsystemFromFile(applicationB, COMPOSITE_E);
try {
startSubsystem(compositeE);
try {
testSharingPolicy(applicationB, "b", true);
testDynamicImport(applicationB, "b.B");
testSharingPolicy(applicationB, "b", true);
testSharingPolicy(compositeE, "b", false);
testSharingPolicy(getRootSubsystem(), "b", false);
} finally {
stopSubsystemSilently(compositeE);
}
} finally {
uninstallSubsystemSilently(compositeE);
}
} finally {
uninstallSubsystemSilently(applicationB);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1435Test method testDisconnectedEdgeWithParent.
@Test
public void testDisconnectedEdgeWithParent() throws Exception {
registerWeavingHook("b");
Bundle bundleB = getRootSubsystem().getBundleContext().installBundle(BUNDLE_B, new ByteArrayInputStream(createBundleBContent()));
try {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Subsystem applicationB = getChild(applicationA, APPLICATION_B);
uninstallSubsystem(applicationB);
removeConnectionWithParent(applicationA);
applicationB = installSubsystemFromFile(applicationA, APPLICATION_B);
try {
try {
testDynamicImport(applicationB, "b.B");
fail("Dynamic import should have failed");
} catch (AssertionError e) {
// Okay.
}
testSharingPolicy(applicationB, "b", true);
testSharingPolicy(applicationA, "b", false);
testSharingPolicy(getRootSubsystem(), "b", false);
} finally {
uninstallSubsystemSilently(applicationB);
}
} finally {
uninstallSubsystemSilently(applicationA);
}
} finally {
uninstallSilently(bundleB);
}
}
Aggregations