use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class IsolatedRuntimeTest method testAppWithoutApplicationManifest.
@Test
@Ignore
public void testAppWithoutApplicationManifest() throws Exception {
AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
AriesApplicationContext ctx = manager.install(app);
ctx.start();
assertHelloWorldService("test.eba");
manager.uninstall(ctx);
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class AriesApplicationManagerImplTest method testRolledbackUpdate.
@Test
public void testRolledbackUpdate() throws Exception {
AriesApplication app = createApplication(TEST_EBA);
DeploymentMetadata depMf = createUpdateDepMf();
DeploymentMetadata oldMf = app.getDeploymentMetadata();
AriesApplicationContext ctx = Skeleton.newMock(AriesApplicationContext.class);
Skeleton.getSkeleton(ctx).setReturnValue(new MethodCall(AriesApplicationContext.class, "getApplication"), app);
AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
Skeleton.getSkeleton(ctxMgr).setReturnValue(new MethodCall(AriesApplicationContextManager.class, "getApplicationContexts"), Collections.singleton(ctx));
Skeleton.getSkeleton(ctxMgr).setThrows(new MethodCall(AriesApplicationContextManager.class, "update", AriesApplication.class, DeploymentMetadata.class), new UpdateException("", null, true, null));
_appMgr.setApplicationContextManager(ctxMgr);
try {
_appMgr.update(app, depMf);
fail("Update should have failed.");
} catch (UpdateException e) {
assertTrue("Deployment.mf should have been rolled back to the old", app.getDeploymentMetadata() == oldMf);
}
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class AriesApplicationManagerImplTest method testFailedUpdate.
@Test
public void testFailedUpdate() throws Exception {
AriesApplication app = createApplication(TEST_EBA);
DeploymentMetadata depMf = createUpdateDepMf();
AriesApplicationContext ctx = Skeleton.newMock(AriesApplicationContext.class);
Skeleton.getSkeleton(ctx).setReturnValue(new MethodCall(AriesApplicationContext.class, "getApplication"), app);
AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
Skeleton.getSkeleton(ctxMgr).setReturnValue(new MethodCall(AriesApplicationContextManager.class, "getApplicationContexts"), Collections.singleton(ctx));
Skeleton.getSkeleton(ctxMgr).setThrows(new MethodCall(AriesApplicationContextManager.class, "update", AriesApplication.class, DeploymentMetadata.class), new UpdateException("", null, false, null));
_appMgr.setApplicationContextManager(ctxMgr);
try {
_appMgr.update(app, depMf);
fail("Update should have failed.");
} catch (UpdateException e) {
assertTrue("Deployment.mf should have been updated", app.getDeploymentMetadata() == depMf);
}
}
use of org.apache.aries.application.management.AriesApplicationContext in project aries by apache.
the class ApplicationContextManagerImpl method bindBundleFrameworkManager.
public void bindBundleFrameworkManager(BundleFrameworkManager bfm) {
LOGGER.debug(LOG_ENTRY, "bindBundleFrameworkManager", bfm);
List<AriesApplicationContext> contexts = new ArrayList<AriesApplicationContext>();
synchronized (_appToContextMap) {
contexts.addAll(_appToContextMap.values());
}
for (AriesApplicationContext ctx : contexts) {
try {
((ApplicationContextImpl) ctx).open();
} catch (BundleException e) {
LOGGER.debug(LOG_EXCEPTION, e);
}
}
LOGGER.debug(LOG_EXIT, "bindBundleFrameworkManager");
}
Aggregations