Search in sources :

Example 16 with Subsystem

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

the class Aries1383Test method test15b.

/*
	 * (15) Unscoped subsystem with a value of apache-aries-provision-dependencies 
	 * that is different than the scoped parent fails installation.
	 */
@Test
public void test15b() throws Exception {
    Subsystem root = getRootSubsystem();
    Subsystem application = installSubsystem(root, APPLICATION_PROVISION_DEPENDENCIES_INSTALL, applicationProvisionDependenciesInstall(), true);
    try {
        Subsystem feature = installSubsystem(application, FEATURE_PROVISION_DEPENDENCIES_RESOLVE, featureProvisionDependenciesResolve(), false);
        uninstallSubsystemSilently(feature);
        fail("Subsystem should not have installed");
    } catch (SubsystemException e) {
        e.printStackTrace();
    } finally {
        uninstallSubsystemSilently(application);
    }
}
Also used : 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 17 with Subsystem

use of org.osgi.service.subsystem.Subsystem 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 18 with Subsystem

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

the class Aries1425Test method testFragmentResolved.

@Test
public void testFragmentResolved() throws Exception {
    Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
    try {
        applicationA.start();
        try {
            Bundle bundleA = getConstituentAsBundle(applicationA, BUNDLE_A, null, IdentityNamespace.TYPE_FRAGMENT);
            assertBundleState(bundleA, Bundle.RESOLVED);
        } finally {
            stopSubsystemSilently(applicationA);
        }
    } finally {
        uninstallSubsystemSilently(applicationA);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) Subsystem(org.osgi.service.subsystem.Subsystem) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Example 19 with Subsystem

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

Example 20 with Subsystem

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);
    }
}
Also used : Subsystem(org.osgi.service.subsystem.Subsystem) Test(org.junit.Test) SubsystemTest(org.apache.aries.subsystem.itests.SubsystemTest)

Aggregations

Subsystem (org.osgi.service.subsystem.Subsystem)187 Test (org.junit.Test)151 SubsystemTest (org.apache.aries.subsystem.itests.SubsystemTest)78 AriesSubsystem (org.apache.aries.subsystem.AriesSubsystem)52 SubsystemException (org.osgi.service.subsystem.SubsystemException)50 Bundle (org.osgi.framework.Bundle)48 SubsystemArchiveBuilder (org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder)31 BundleArchiveBuilder (org.apache.aries.subsystem.itests.util.BundleArchiveBuilder)22 BasicSubsystem (org.apache.aries.subsystem.core.internal.BasicSubsystem)19 IOException (java.io.IOException)11 Hashtable (java.util.Hashtable)8 BundleContext (org.osgi.framework.BundleContext)7 File (java.io.File)6 ArrayList (java.util.ArrayList)6 TestCapability (org.apache.aries.subsystem.itests.util.TestCapability)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Callable (java.util.concurrent.Callable)5 BundleException (org.osgi.framework.BundleException)5 FileInputStream (java.io.FileInputStream)4 Future (java.util.concurrent.Future)4