use of org.apache.aries.application.management.AriesApplicationContext 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);
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class BasicAppManagerTest method testAppWithApplicationManifest.
@Test
public void testAppWithApplicationManifest() throws Exception {
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
// application name should equal to whatever Application name provided in the application.mf
assertEquals("test application 2", app.getApplicationMetadata().getApplicationName());
AriesApplicationContext ctx = manager.install(app);
ctx.start();
HelloWorld hw = context().getService(HelloWorld.class);
String result = hw.getMessage();
assertEquals(result, "hello world");
ctx.stop();
manager.uninstall(ctx);
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class IsolatedRuntimeTest method testAppWithGlobalRepositoryBundle.
@Test
@Ignore
public void testAppWithGlobalRepositoryBundle() throws Exception {
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
IsolationTestUtils.prepareSampleBundleV2(bundleContext, context().getService(RepositoryGenerator.class), context().getService(RepositoryAdmin.class), context().getService(ModellingManager.class));
AriesApplication newApp = manager.resolve(app, new ResolveConstraint() {
@Override
public String getBundleName() {
return "org.apache.aries.isolated.sample";
}
@Override
public VersionRange getVersionRange() {
return ManifestHeaderProcessor.parseVersionRange("[2.0.0,2.0.0]", true);
}
});
AriesApplicationContext ctx = manager.install(newApp);
ctx.start();
assertHelloWorldService("org.apache.aries.sample2", "hello brave new world");
manager.uninstall(ctx);
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class IsolatedRuntimeTest method testAppWithApplicationManifest.
@Test
@Ignore
public void testAppWithApplicationManifest() throws Exception {
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
AriesApplicationContext ctx = manager.install(app);
ctx.start();
assertHelloWorldService("org.apache.aries.sample2");
manager.uninstall(ctx);
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class IsolatedRuntimeTest method testAppWithFragment.
@Test
@Ignore
public void testAppWithFragment() throws Exception {
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("withFragment.eba")));
AriesApplicationContext ctx = manager.install(app);
ctx.start();
assertHelloWorldService("withFragment.eba");
manager.uninstall(ctx);
}
Aggregations