use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method extensionManagerPresent.
@Test
public void extensionManagerPresent() throws Exception {
addPackedAppFromBuilder(emptyAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
final Application app = findApp(emptyAppFileBuilder.getId(), 1);
assertThat(app.getRegistry().<ExtensionManager>lookupByName(MuleProperties.OBJECT_EXTENSION_MANAGER).get(), is(notNullValue()));
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysPackedAppsInOrderWhenAppArgumentIsUsed.
@Test
public void deploysPackedAppsInOrderWhenAppArgumentIsUsed() throws Exception {
assumeThat(parallelDeployment, is(false));
ApplicationFileBuilder app1 = createEmptyApp().withVersion("1.0.0");
ApplicationFileBuilder app2 = createEmptyApp().withVersion("2.0.0");
ApplicationFileBuilder app3 = createEmptyApp().withVersion("3.0.0");
addPackedAppFromBuilder(app1, "1.jar");
addPackedAppFromBuilder(app2, "2.jar");
addPackedAppFromBuilder(app3, "3.jar");
Map<String, Object> startupOptions = new HashMap<>();
startupOptions.put("app", "3:1:2");
StartupContext.get().setStartupOptions(startupOptions);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, "1");
assertApplicationDeploymentSuccess(applicationDeploymentListener, "2");
assertApplicationDeploymentSuccess(applicationDeploymentListener, "3");
assertAppsDir(NONE, new String[] { "1", "2", "3" }, 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("3", applications.get(0).getArtifactName());
assertEquals("1", applications.get(1).getArtifactName());
assertEquals("2", applications.get(2).getArtifactName());
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method removesZombieFilesAfterremovesZombieFilesAfterFailedAppIsDeleted.
@Test
public void removesZombieFilesAfterremovesZombieFilesAfterFailedAppIsDeleted() throws Exception {
final String appName = "bad-config-app";
final ApplicationFileBuilder badConfigAppFileBuilder = new ApplicationFileBuilder(appName).definedBy("bad-app-config.xml");
addPackedAppFromBuilder(badConfigAppFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, badConfigAppFileBuilder.getId());
assertAppsDir(new String[] {}, new String[] { badConfigAppFileBuilder.getId() }, true);
assertArtifactIsRegisteredAsZombie(badConfigAppFileBuilder.getId(), deploymentService.getZombieApplications());
final Application app = findApp(badConfigAppFileBuilder.getId(), 1);
assertStatus(app, ApplicationStatus.DEPLOYMENT_FAILED);
assertApplicationAnchorFileDoesNotExists(app.getArtifactName());
reset(applicationDeploymentListener);
deleteDirectory(new File(appsDir, app.getArtifactName()));
assertAppFolderIsDeleted(appName);
assertAtLeastOneUndeploymentSuccess(applicationDeploymentListener, badConfigAppFileBuilder.getId());
assertNoZombiePresent(deploymentService.getZombieApplications());
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method undeploysAppCompletelyEvenOnDisposingException.
@Test
public void undeploysAppCompletelyEvenOnDisposingException() 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.setFailOnDisposeApplication(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());
assertStatus(app, STOPPED);
assertAppFolderIsDeleted(emptyAppFileBuilder.getId());
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class ApplicationDeploymentTestCase method undeploysStoppedApp.
@Test
public void undeploysStoppedApp() throws Exception {
addPackedAppFromBuilder(emptyAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
final Application app = findApp(emptyAppFileBuilder.getId(), 1);
app.stop();
assertStatus(app, STOPPED);
deploymentService.undeploy(app);
}
Aggregations