Search in sources :

Example 6 with SubsystemException

use of org.osgi.service.subsystem.SubsystemException in project aries by apache.

the class Aries1423Test method testEmptyNonOsgiHeaders.

@Test
public void testEmptyNonOsgiHeaders() throws Exception {
    try {
        Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
        uninstallSubsystemSilently(applicationA);
    } catch (SubsystemException e) {
        e.printStackTrace();
        fail("Subsystem should have installed");
    }
}
Also used : Subsystem(org.osgi.service.subsystem.Subsystem) SubsystemException(org.osgi.service.subsystem.SubsystemException) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Example 7 with SubsystemException

use of org.osgi.service.subsystem.SubsystemException in project aries by apache.

the class Aries1383Test method test16a.

/*
	 * (16) Unscoped subsystem with a value of apache-aries-provision-dependencies 
	 * that is the same as the scoped parent installs successfully.
	 */
@Test
public void test16a() throws Exception {
    Subsystem root = getRootSubsystem();
    try {
        Subsystem subsystem = installSubsystem(root, FEATURE_PROVISION_DEPENDENCIES_INSTALL, new SubsystemArchiveBuilder().symbolicName("application").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + AriesProvisionDependenciesDirective.INSTALL.toString()).build(), true);
        uninstallSubsystemSilently(subsystem);
    } catch (SubsystemException e) {
        e.printStackTrace();
        fail("Subsystem should have installed");
    }
}
Also used : SubsystemArchiveBuilder(org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder) AriesSubsystem(org.apache.aries.subsystem.AriesSubsystem) Subsystem(org.osgi.service.subsystem.Subsystem) SubsystemException(org.osgi.service.subsystem.SubsystemException) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest) Test(org.junit.Test)

Example 8 with SubsystemException

use of org.osgi.service.subsystem.SubsystemException in project aries by apache.

the class Aries1429Test method testMissingParentChildEdgeNotTolerated.

@Test
public void testMissingParentChildEdgeNotTolerated() throws Exception {
    Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
    try {
        removeConnectionWithParent(applicationA);
        try {
            ((AriesSubsystem) applicationA).addRequirements(Collections.singletonList((Requirement) new TestRequirement.Builder().namespace(PackageNamespace.PACKAGE_NAMESPACE).attribute(PackageNamespace.PACKAGE_NAMESPACE, "org.osgi.framework").build()));
            fail("No exception received");
        } catch (SubsystemException e) {
            Throwable cause = e.getCause();
            assertNotNull("Wrong cause", cause);
            assertEquals("Wrong cause", IllegalStateException.class, cause.getClass());
        }
    } finally {
        uninstallSubsystemSilently(applicationA);
    }
}
Also used : Requirement(org.osgi.resource.Requirement) TestRequirement(org.apache.aries.subsystem.itests.util.TestRequirement) AriesSubsystem(org.apache.aries.subsystem.AriesSubsystem) Subsystem(org.osgi.service.subsystem.Subsystem) SubsystemException(org.osgi.service.subsystem.SubsystemException) AriesSubsystem(org.apache.aries.subsystem.AriesSubsystem) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest) Test(org.junit.Test)

Example 9 with SubsystemException

use of org.osgi.service.subsystem.SubsystemException in project aries by apache.

the class Aries1408Test method testRequirementFromRemoteRepositoryConvertsToRequireCapability.

@Test
public void testRequirementFromRemoteRepositoryConvertsToRequireCapability() throws Exception {
    Bundle bundleB = installBundleFromFile(BUNDLE_B);
    try {
        Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
        uninstallSubsystemSilently(applicationA);
    } catch (SubsystemException e) {
        e.printStackTrace();
        fail("Subsystem should have installed");
    } finally {
        uninstallSilently(bundleB);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) Subsystem(org.osgi.service.subsystem.Subsystem) SubsystemException(org.osgi.service.subsystem.SubsystemException) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest) Test(org.junit.Test)

Example 10 with SubsystemException

use of org.osgi.service.subsystem.SubsystemException in project aries by apache.

the class Aries1416Test method testSharedContentBundlePreferredProvider.

@Test
public void testSharedContentBundlePreferredProvider() throws Exception {
    // Install feature A containing bundle B and application A both in the
    // archive and as content into the root subsystem region. Bundle B 
    // provides capability b. Application A contains bundle A requiring 
    // capability b both in the archive and as content. Preferred provider 
    // bundle B is also included in the archive but not as content.
    Subsystem featureA = installSubsystemFromFile(FEATURE_A);
    try {
        // Install feature B having the same characteristics as feature A
        // described above into the root subsystem region. Bundle B will 
        // become shared content of features A and B. Shared content bundle
        // B from the system repository should be used as the preferred
        // provider. Bundle B from the local repository should not be
        // provisioned.
        Subsystem featureB = installSubsystemFromFile(FEATURE_B);
        uninstallSubsystemSilently(featureB);
    } catch (SubsystemException e) {
        e.printStackTrace();
        fail("Subsystem should have installed");
    } finally {
        uninstallSubsystemSilently(featureA);
    }
}
Also used : Subsystem(org.osgi.service.subsystem.Subsystem) SubsystemException(org.osgi.service.subsystem.SubsystemException) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Aggregations

SubsystemException (org.osgi.service.subsystem.SubsystemException)61 Subsystem (org.osgi.service.subsystem.Subsystem)39 Test (org.junit.Test)32 SubsystemTest (org.apache.aries.subsystem.itests.SubsystemTest)23 AriesSubsystem (org.apache.aries.subsystem.AriesSubsystem)19 SubsystemArchiveBuilder (org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder)15 Bundle (org.osgi.framework.Bundle)11 BundleArchiveBuilder (org.apache.aries.subsystem.itests.util.BundleArchiveBuilder)7 Resource (org.osgi.resource.Resource)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)5 BundleException (org.osgi.framework.BundleException)5 Requirement (org.osgi.resource.Requirement)5 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)3 BundleRevision (org.osgi.framework.wiring.BundleRevision)3 Repository (org.osgi.service.repository.Repository)3 File (java.io.File)2 URISyntaxException (java.net.URISyntaxException)2 DeploymentManifest (org.apache.aries.subsystem.core.archive.DeploymentManifest)2