use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method undeploysAppRemovesTemporaryData.
@Test
public void undeploysAppRemovesTemporaryData() throws Exception {
addPackedAppFromBuilder(dummyAppDescriptorFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
final Application app = findApp(dummyAppDescriptorFileBuilder.getId(), 1);
File appTemporaryFolder = new File(app.getRegistry().<MuleConfiguration>lookupByName(MuleProperties.OBJECT_MULE_CONFIGURATION).get().getWorkingDirectory());
// As this app has a plugin, the tmp directory must exist
assertThat(appTemporaryFolder.exists(), is(true));
// Remove the anchor file so undeployment starts
assertTrue("Unable to remove anchor file", removeAppAnchorFile(dummyAppDescriptorFileBuilder.getId()));
assertUndeploymentSuccess(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
assertStatus(app, DESTROYED);
// Check the tmp directory was effectively removed
assertThat(appTemporaryFolder.exists(), is(false));
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method undeploysApplicationRemovingAnchorFile.
@Test
public void undeploysApplicationRemovingAnchorFile() throws Exception {
addPackedAppFromBuilder(emptyAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
Application app = findApp(emptyAppFileBuilder.getId(), 1);
assertTrue("Unable to remove anchor file", removeAppAnchorFile(emptyAppFileBuilder.getId()));
assertUndeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
assertStatus(app, DESTROYED);
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method undeploysAppCompletelyEvenOnStoppingException.
@Test
public void undeploysAppCompletelyEvenOnStoppingException() throws Exception {
addPackedAppFromBuilder(emptyAppFileBuilder);
final DefaultDomainManager domainManager = new DefaultDomainManager();
domainManager.addDomain(createDefaultDomain());
TestApplicationFactory appFactory = createTestApplicationFactory(new MuleApplicationClassLoaderFactory(new DefaultNativeLibraryFinderFactory()), domainManager, serviceManager, extensionModelLoaderManager, moduleRepository, createDescriptorLoaderRepository());
appFactory.setFailOnStopApplication(true);
deploymentService.setAppFactory(appFactory);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
Application app = findApp(emptyAppFileBuilder.getId(), 1);
assertTrue("Unable to remove anchor file", removeAppAnchorFile(emptyAppFileBuilder.getId()));
assertUndeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
assertAppFolderIsDeleted(emptyAppFileBuilder.getId());
assertStatus(app, DESTROYED);
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysExplodedAppsInOrderWhenAppArgumentIsUsed.
@Test
public void deploysExplodedAppsInOrderWhenAppArgumentIsUsed() throws Exception {
assumeThat(parallelDeployment, is(false));
ApplicationFileBuilder appFileBuilder1 = new ApplicationFileBuilder("1").definedBy("empty-config.xml");
addExplodedAppFromBuilder(appFileBuilder1);
ApplicationFileBuilder appFileBuilder2 = new ApplicationFileBuilder("2").definedBy("empty-config.xml");
addExplodedAppFromBuilder(appFileBuilder2);
ApplicationFileBuilder appFileBuilder3 = new ApplicationFileBuilder("3").definedBy("empty-config.xml");
addExplodedAppFromBuilder(appFileBuilder3);
Map<String, Object> startupOptions = new HashMap<>();
startupOptions.put("app", format("%s:%s:%s", appFileBuilder3.getId(), appFileBuilder1.getId(), appFileBuilder2.getId()));
StartupContext.get().setStartupOptions(startupOptions);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, appFileBuilder3.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, appFileBuilder1.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, appFileBuilder2.getId());
assertAppsDir(NONE, new String[] { appFileBuilder1.getId(), appFileBuilder2.getId(), appFileBuilder3.getId() }, true);
// When apps are passed as -app app1:app2:app3 the startup order matters
List<Application> applications = deploymentService.getApplications();
assertNotNull(applications);
assertEquals(3, applications.size());
assertEquals(appFileBuilder3.getId(), applications.get(0).getArtifactName());
assertEquals(appFileBuilder1.getId(), applications.get(1).getArtifactName());
assertEquals(appFileBuilder2.getId(), applications.get(2).getArtifactName());
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppJustOnce.
@Test
public void deploysAppJustOnce() throws Exception {
addPackedAppFromBuilder(emptyAppFileBuilder);
Map<String, Object> startupOptions = new HashMap<>();
String appName = "empty-app-1.0.0-mule-application";
startupOptions.put("app", format("%s:%s:%s", appName, appName, appName));
StartupContext.get().setStartupOptions(startupOptions);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
assertAppsDir(NONE, new String[] { emptyAppFileBuilder.getId() }, true);
List<Application> applications = deploymentService.getApplications();
assertEquals(1, applications.size());
}
Aggregations