use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1425Test method testProvisionResourceHeader.
@Test
public void testProvisionResourceHeader() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Map<String, String> headers = applicationA.getDeploymentHeaders();
String header = headers.get(SubsystemConstants.PROVISION_RESOURCE);
assertFalse("Fragment content treated as dependency", header != null && header.contains(BUNDLE_A));
} finally {
uninstallSubsystemSilently(applicationA);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1425Test method testBundleSelectedFromLocalRepository.
@Test
public void testBundleSelectedFromLocalRepository() throws Exception {
Subsystem applicationB = installSubsystemFromFile(APPLICATION_B);
try {
assertNotConstituent(applicationB, BUNDLE_A, null, IdentityNamespace.TYPE_FRAGMENT);
assertConstituent(applicationB, BUNDLE_A, null, IdentityNamespace.TYPE_BUNDLE);
} finally {
uninstallSubsystemSilently(applicationB);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1425Test method testBundleSelectedFromRemoteRepository.
@Test
public void testBundleSelectedFromRemoteRepository() throws Exception {
// Make sure the repository containing the fragment comes first.
registerRepositoryService(BUNDLE_A_FRAGMENT);
registerRepositoryService(BUNDLE_A_BUNDLE);
Subsystem applicationC = installSubsystemFromFile(APPLICATION_C);
try {
assertNotConstituent(applicationC, BUNDLE_A, null, IdentityNamespace.TYPE_FRAGMENT);
assertConstituent(applicationC, BUNDLE_A, null, IdentityNamespace.TYPE_BUNDLE);
} finally {
uninstallSubsystemSilently(applicationC);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1425Test method testDeployedContentHeader.
@Test
public void testDeployedContentHeader() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Map<String, String> headers = applicationA.getDeploymentHeaders();
String header = headers.get(SubsystemConstants.DEPLOYED_CONTENT);
DeployedContentHeader dch = new DeployedContentHeader(header);
boolean foundClause = false;
for (DeployedContentHeader.Clause clause : dch.getClauses()) {
if (BUNDLE_A.equals(clause.getSymbolicName())) {
assertEquals("Wrong type", IdentityNamespace.TYPE_FRAGMENT, clause.getType());
foundClause = true;
break;
}
}
assertTrue("Missing clause", foundClause);
} finally {
uninstallSubsystemSilently(applicationA);
}
}
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