Search in sources :

Example 1 with GenericHeader

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();
}
Also used : SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) GenericHeader(org.apache.aries.subsystem.core.archive.GenericHeader)

Example 2 with GenericHeader

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);
    }
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) Subsystem(org.osgi.service.subsystem.Subsystem) GenericHeader(org.apache.aries.subsystem.core.archive.GenericHeader) Coordinator(org.osgi.service.coordinator.Coordinator) BundleContext(org.osgi.framework.BundleContext) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Aggregations

GenericHeader (org.apache.aries.subsystem.core.archive.GenericHeader)2 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)1 SubsystemManifest (org.apache.aries.subsystem.core.archive.SubsystemManifest)1 SubsystemTest (org.apache.aries.subsystem.itests.SubsystemTest)1 Test (org.junit.Test)1 BundleContext (org.osgi.framework.BundleContext)1 Coordinator (org.osgi.service.coordinator.Coordinator)1 Subsystem (org.osgi.service.subsystem.Subsystem)1