use of org.eclipse.equinox.region.RegionDigraph in project aries by apache.
the class Aries1435Test method testConnectedNonSubsystemRegions.
@Test
public void testConnectedNonSubsystemRegions() throws Exception {
registerWeavingHook("b");
Bundle bundleB = getRootSubsystem().getBundleContext().installBundle(BUNDLE_B, new ByteArrayInputStream(createBundleBContent()));
uninstallableBundles.add(bundleB);
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
uninstallableSubsystems.add(applicationA);
Subsystem applicationB = getChild(applicationA, APPLICATION_B);
uninstallSubsystem(applicationB);
removeConnectionWithParent(applicationA);
Region region = getRegion(applicationA);
RegionDigraph digraph = region.getRegionDigraph();
Region r1 = digraph.createRegion("R1");
deletableRegions.add(r1);
region.connectRegion(r1, digraph.createRegionFilterBuilder().allow("y", "(y=x)").build());
Region r2a = digraph.createRegion("R2A");
deletableRegions.add(r2a);
Bundle bundleB1 = r2a.installBundleAtLocation(BUNDLE_B + '1', new ByteArrayInputStream(createBundleBContent()));
uninstallableBundles.add(bundleB1);
Region r2b = digraph.createRegion("R2B");
deletableRegions.add(r2b);
r2b.connectRegion(r2a, digraph.createRegionFilterBuilder().allow("osgi.wiring.package", "(&(osgi.wiring.package=b)(version=0))").build());
region.connectRegion(r2b, digraph.createRegionFilterBuilder().allow("osgi.wiring.package", "(&(osgi.wiring.package=b)(version=0))").build());
applicationB = installSubsystemFromFile(applicationA, APPLICATION_B);
uninstallableSubsystems.add(applicationB);
try {
testDynamicImport(applicationB, "b.B");
} catch (AssertionError e) {
fail("Dynamic import should have succeeded");
}
testSharingPolicy(applicationB, "b", true);
testSharingPolicy(applicationA, "b", true);
testSharingPolicy(getRootSubsystem(), "b", false);
}
Aggregations