use of org.apache.aries.subsystem.core.archive.GenericHeader in project aries by apache.
the class RawSubsystemResource method computeSubsystemManifestBeforeRequirements.
private SubsystemManifest computeSubsystemManifestBeforeRequirements(IDirectory content, SubsystemManifest manifest) throws MalformedURLException {
SubsystemManifest.Builder builder = new SubsystemManifest.Builder().manifest(manifest);
addSubsystemSymbolicNameHeader(builder, manifest);
addSubsystemVersionHeader(builder, manifest);
addSubsystemTypeHeader(builder, manifest);
addSubsystemContentHeader(builder, manifest);
builder.header(new GenericHeader(Constants.AriesSubsystemOriginalContent, String.valueOf(content.toURL())));
return builder.build();
}
use of org.apache.aries.subsystem.core.archive.GenericHeader in project aries by apache.
the class Aries1426Test method testNoEffectOnSharingPolicy.
@Test
public void testNoEffectOnSharingPolicy() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Map<String, String> headers = applicationA.getDeploymentHeaders();
// There should be no subsystem Require-Capability header because
// the Application-ImportService header included the only relevant
// bundle clause.
assertNull("Wrong Require-Capability", headers.get(Constants.REQUIRE_CAPABILITY));
// There should be no subsystem Subsystem-ImportService header
// because the Application-ImportService header included the only
// relevant bundle clause.
assertNull("Wrong Subsystem-ImportService", headers.get(SubsystemConstants.SUBSYSTEM_IMPORTSERVICE));
org.apache.aries.subsystem.core.archive.Header<?> expected = new SubsystemContentHeader("bundle.a.jar;version=\"[0,0]\"");
org.apache.aries.subsystem.core.archive.Header<?> actual = new SubsystemContentHeader(headers.get(SubsystemConstants.SUBSYSTEM_CONTENT));
// The Subsystem-Content header should not include any synthesized
// resources used to process Application-ImportService.
assertEquals("Wrong Subsystem-Content", expected, actual);
expected = new GenericHeader("Application-ImportService", "org.osgi.service.coordinator.Coordinator");
actual = new GenericHeader("Application-ImportService", headers.get("Application-ImportService"));
// The Application-ImportService header should be included in the
// deployment manifest.
assertEquals("Wrong Application-ImportService", expected, actual);
BundleContext context = applicationA.getBundleContext();
// The Coordinator service should not be visible to the application
// region because Application-ImportService does not affect the
// sharing policy and nothing outside of the subsystems
// implementation made it visible.
assertNull("Coordinator service should not be visible", context.getServiceReference(Coordinator.class));
} finally {
uninstallSubsystemSilently(applicationA);
}
}
Aggregations