AriesApplicationManagerImpl implements AriesApplicationManager { public AriesApplicationContext update(AriesApplication app, DeploymentMetadata depMf) throws UpdateException { if (!(app instanceof AriesApplicationImpl)) throw new IllegalArgumentException("Argument is not AriesApplication created by this manager"); if (!!!app.getApplicationMetadata().getApplicationSymbolicName().equals(depMf.getApplicationSymbolicName()) || !!!app.getApplicationMetadata().getApplicationVersion().equals(depMf.getApplicationVersion())) { throw new IllegalArgumentException("The deployment metadata does not match the application."); } DeploymentMetadata oldMetadata = app.getDeploymentMetadata(); AriesApplicationContext foundCtx = null; for (AriesApplicationContext ctx : _applicationContextManager.getApplicationContexts()) { if (ctx.getApplication().equals(app)) { foundCtx = ctx; break; } } ((AriesApplicationImpl) app).setDeploymentMetadata(depMf); if (foundCtx != null) { try { return _applicationContextManager.update(app, oldMetadata); } catch (UpdateException ue) { if (ue.hasRolledBack()) { ((AriesApplicationImpl) app).setDeploymentMetadata(oldMetadata); } throw ue; } } else { return null; } }  void setApplicationMetadataFactory(ApplicationMetadataFactory amf); void setDeploymentMetadataFactory(DeploymentMetadataFactory dmf); void setBundleConverters(List<BundleConverter> bcs); void setDeploymentManifestManager(DeploymentManifestManager dm); void setLocalPlatform(LocalPlatform lp); void setApplicationContextManager(AriesApplicationContextManager acm); void setBundleContext(BundleContext b); AriesApplication createApplication(IDirectory ebaFile); AriesApplication createApplication(URL url); AriesApplication resolve(AriesApplication originalApp, ResolveConstraint... constraints); AriesApplicationContext install(AriesApplication app); void uninstall(AriesApplicationContext appContext); void addApplicationListener(AriesApplicationListener l); void removeApplicationListener(AriesApplicationListener l); AriesApplicationContext update(AriesApplication app, DeploymentMetadata depMf);  }
@Test public void testUpdate() throws Exception { AriesApplication app = createApplication(TEST_EBA); DeploymentMetadata depMf = createUpdateDepMf(); AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class); _appMgr.setApplicationContextManager(ctxMgr); _appMgr.update(app, depMf); assertTrue("Deployment.mf should have been updated", app.getDeploymentMetadata() == depMf); }