Search in sources :

Example 6 with BasicSubsystem

use of org.apache.aries.subsystem.core.internal.BasicSubsystem in project aries by apache.

the class Aries1419Test method testRequireCapability.

@Test
public void testRequireCapability() throws Exception {
    Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
    try {
        Bundle bundleA = getConstituentAsBundle(applicationA, BUNDLE_A, null, null);
        String expectedStr = bundleA.getHeaders().get(Constants.REQUIRE_CAPABILITY);
        RequireCapabilityHeader expected = new RequireCapabilityHeader(expectedStr);
        Map<String, String> headers = ((BasicSubsystem) applicationA).getDeploymentHeaders();
        String actualStr = headers.get(Constants.REQUIRE_CAPABILITY);
        RequireCapabilityHeader actual = new RequireCapabilityHeader(actualStr);
        assertEquals("Wrong header", expected, actual);
    } finally {
        uninstallSubsystemSilently(applicationA);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) RequireCapabilityHeader(org.apache.aries.subsystem.core.archive.RequireCapabilityHeader) BasicSubsystem(org.apache.aries.subsystem.core.internal.BasicSubsystem) Subsystem(org.osgi.service.subsystem.Subsystem) BasicSubsystem(org.apache.aries.subsystem.core.internal.BasicSubsystem) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Example 7 with BasicSubsystem

use of org.apache.aries.subsystem.core.internal.BasicSubsystem in project aries by apache.

the class Aries1421Test method testImportPackageVersionRanges.

@Test
public void testImportPackageVersionRanges() throws Exception {
    Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
    try {
        Bundle bundleA = getConstituentAsBundle(applicationA, BUNDLE_A, null, null);
        String expectedStr = bundleA.getHeaders().get(Constants.IMPORT_PACKAGE);
        ImportPackageHeader expected = new ImportPackageHeader(expectedStr);
        Map<String, String> headers = ((BasicSubsystem) applicationA).getDeploymentHeaders();
        String actualStr = headers.get(Constants.IMPORT_PACKAGE);
        ImportPackageHeader actual = new ImportPackageHeader(actualStr);
        assertEquals("Wrong header", expected, actual);
    } finally {
        uninstallSubsystemSilently(applicationA);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) BasicSubsystem(org.apache.aries.subsystem.core.internal.BasicSubsystem) Subsystem(org.osgi.service.subsystem.Subsystem) BasicSubsystem(org.apache.aries.subsystem.core.internal.BasicSubsystem) ImportPackageHeader(org.apache.aries.subsystem.core.archive.ImportPackageHeader) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Aggregations

BasicSubsystem (org.apache.aries.subsystem.core.internal.BasicSubsystem)7 Subsystem (org.osgi.service.subsystem.Subsystem)7 Test (org.junit.Test)6 SubsystemTest (org.apache.aries.subsystem.itests.SubsystemTest)5 Bundle (org.osgi.framework.Bundle)5 RequireCapabilityHeader (org.apache.aries.subsystem.core.archive.RequireCapabilityHeader)2 File (java.io.File)1 AriesSubsystem (org.apache.aries.subsystem.AriesSubsystem)1 AriesProvisionDependenciesDirective (org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective)1 ImportPackageHeader (org.apache.aries.subsystem.core.archive.ImportPackageHeader)1 RequireBundleHeader (org.apache.aries.subsystem.core.archive.RequireBundleHeader)1 SubsystemImportServiceHeader (org.apache.aries.subsystem.core.archive.SubsystemImportServiceHeader)1 Region (org.eclipse.equinox.region.Region)1 RegionDigraph (org.eclipse.equinox.region.RegionDigraph)1 CoreOptions.mavenBundle (org.ops4j.pax.exam.CoreOptions.mavenBundle)1 CoreOptions.streamBundle (org.ops4j.pax.exam.CoreOptions.streamBundle)1 State (org.osgi.service.subsystem.Subsystem.State)1 SubsystemException (org.osgi.service.subsystem.SubsystemException)1