Search in sources :

Example 26 with Version

use of org.osgi.framework.Version in project aries by apache.

the class BundleRequiredExecutionEnvironmentHeaderTest method testExecutionEnvironment2.

@Test
public void testExecutionEnvironment2() {
    String name = "bar";
    Version version = Version.parseVersion("2.0.0.qualifier");
    ExecutionEnvironment ee = new ExecutionEnvironment(name, version);
    assertExecutionEnvironmentName(ee, name);
    assertExecutionEnvironmentVersion(ee, version);
}
Also used : ExecutionEnvironment(org.apache.aries.subsystem.core.archive.BundleRequiredExecutionEnvironmentHeader.Clause.ExecutionEnvironment) Version(org.osgi.framework.Version) Test(org.junit.Test)

Example 27 with Version

use of org.osgi.framework.Version in project aries by apache.

the class FragmentHostHeaderTest method testSymbolicName.

@Test
public void testSymbolicName() {
    String headerStr = "org.foo";
    FragmentHostHeader header = new FragmentHostHeader(headerStr);
    assertClauses(header, 1);
    assertSymbolicName(header.getClauses().iterator().next(), headerStr);
    assertBundleVersionAttribute(header.getClauses().iterator().next(), new VersionRange(VersionRange.LEFT_CLOSED, new Version("0"), null, VersionRange.RIGHT_OPEN));
}
Also used : Version(org.osgi.framework.Version) VersionRange(org.osgi.framework.VersionRange) Test(org.junit.Test)

Example 28 with Version

use of org.osgi.framework.Version in project aries by apache.

the class EBAInstaller method uninstall.

public void uninstall(File applicationLocation) throws Exception {
    AriesApplicationContext context = appContexts.get(applicationLocation);
    String appSymName = context.getApplication().getApplicationMetadata().getApplicationSymbolicName();
    Version appVersion = context.getApplication().getApplicationMetadata().getApplicationVersion();
    LOGGER.debug("uninstalling {} {} ", new Object[] { appSymName, appVersion });
    if (context != null) {
        context.stop();
        applicationManager.uninstall(context);
    }
    appContexts.remove(applicationLocation);
    LOGGER.debug("uninstalled {} {} state: {}", new Object[] { appSymName, appVersion, context.getApplicationState() });
}
Also used : Version(org.osgi.framework.Version) AriesApplicationContext(org.apache.aries.application.management.AriesApplicationContext)

Example 29 with Version

use of org.osgi.framework.Version in project aries by apache.

the class EBAInstaller method install.

public void install(File applicationLocation) throws Exception {
    AriesApplication app = applicationManager.createApplication(FileSystem.getFSRoot(applicationLocation));
    String appSymName = app.getApplicationMetadata().getApplicationSymbolicName();
    Version appVersion = app.getApplicationMetadata().getApplicationVersion();
    LOGGER.debug("created app from {} : {} {} with contents {}", new Object[] { applicationLocation.getName(), appSymName, appVersion, app.getApplicationMetadata().getApplicationContents() });
    AriesApplicationContext context = applicationManager.install(app);
    LOGGER.debug("installed app {} {} state: {}", new Object[] { appSymName, appVersion, context.getApplicationState() });
    context.start();
    LOGGER.debug("started app {} {} state: {}", new Object[] { appSymName, appVersion, context.getApplicationState() });
    // Store the application context away because it is the application context we need
    // to pass to the application manager if we're later asked to uninstall the application
    appContexts.put(applicationLocation, context);
}
Also used : Version(org.osgi.framework.Version) AriesApplicationContext(org.apache.aries.application.management.AriesApplicationContext) AriesApplication(org.apache.aries.application.management.AriesApplication)

Example 30 with Version

use of org.osgi.framework.Version in project aries by apache.

the class DeploymentGeneratorTest method setup.

@Before
public void setup() throws Exception {
    appMetadata = Skeleton.newMock(ApplicationMetadata.class);
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationSymbolicName"), "aries.test");
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getUseBundles"), Collections.EMPTY_LIST);
    app = Skeleton.newMock(AriesApplication.class);
    Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
    deplMFMgr = new DeploymentManifestManagerImpl();
    deplMFMgr.setResolver(_resolver);
    deplMFMgr.setLocalPlatform(localPlatform);
    deplMFMgr.setModellingManager(modellingManager);
    deplMFMgr.setModellingHelper(modellingHelper);
    deplMFMgr.setPreResolveHooks(new ArrayList<PreResolveHook>());
}
Also used : ApplicationMetadata(org.apache.aries.application.ApplicationMetadata) Version(org.osgi.framework.Version) DeploymentManifestManagerImpl(org.apache.aries.application.deployment.management.impl.DeploymentManifestManagerImpl) AriesApplication(org.apache.aries.application.management.AriesApplication) PreResolveHook(org.apache.aries.application.management.spi.resolve.PreResolveHook) MethodCall(org.apache.aries.unittest.mocks.MethodCall) Before(org.junit.Before)

Aggregations

Version (org.osgi.framework.Version)165 Test (org.junit.Test)30 Bundle (org.osgi.framework.Bundle)26 ArrayList (java.util.ArrayList)22 Capability (org.osgi.resource.Capability)19 File (java.io.File)17 HashMap (java.util.HashMap)16 Resource (org.osgi.resource.Resource)14 IOException (java.io.IOException)13 InputStream (java.io.InputStream)11 Manifest (java.util.jar.Manifest)11 Map (java.util.Map)9 HashSet (java.util.HashSet)8 Content (org.apache.aries.application.Content)8 AriesApplication (org.apache.aries.application.management.AriesApplication)8 VersionRange (org.apache.felix.utils.version.VersionRange)8 BundleRevision (org.osgi.framework.wiring.BundleRevision)8 List (java.util.List)7 BundleWiring (org.osgi.framework.wiring.BundleWiring)7 ResourceBuilder (aQute.bnd.osgi.resource.ResourceBuilder)6