use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method removesPreviousAppFolderOnStart.
@Test
public void removesPreviousAppFolderOnStart() throws Exception {
addExplodedAppFromBuilder(emptyAppFileBuilder);
ApplicationFileBuilder emptyAppFileBuilder = new ApplicationFileBuilder("empty-app").usingResource("empty-config.xml", "empty-config.xml").deployedWith(PROPERTY_CONFIG_RESOURCES, "empty-config.xml");
addPackedAppFromBuilder(emptyAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
assertEquals("Application has not been properly registered with Mule", 1, deploymentService.getApplications().size());
assertAppsDir(NONE, new String[] { emptyAppFileBuilder.getId() }, true);
assertApplicationFiles(emptyAppFileBuilder.getId(), new String[] { "empty-config.xml" });
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysWithExtensionXmlPlugin.
@Test
public void deploysWithExtensionXmlPlugin() throws Exception {
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPlugin").definedBy("app-with-extension-xml-plugin-module-bye.xml").dependingOn(byeXmlExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
final DefaultDomainManager domainManager = new DefaultDomainManager();
domainManager.addDomain(createDefaultDomain());
TestApplicationFactory appFactory = createTestApplicationFactory(new MuleApplicationClassLoaderFactory(new DefaultNativeLibraryFinderFactory()), domainManager, serviceManager, extensionModelLoaderManager, moduleRepository, createDescriptorLoaderRepository());
deploymentService.setAppFactory(appFactory);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysMultiPluginVersionLib.
@Test
public void deploysMultiPluginVersionLib() throws Exception {
final ArtifactPluginFileBuilder echoPluginWithLib2 = new ArtifactPluginFileBuilder("echoPlugin2").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").dependingOn(new JarFileBuilder("barUtils2", barUtils2_0JarFile)).containingClass(pluginEcho2TestClassFile, "org/foo/echo/Plugin2Echo.class");
final ApplicationFileBuilder multiLibPluginAppFileBuilder = new ApplicationFileBuilder("multiPluginLibVersion").definedBy("multi-plugin-app-config.xml").dependingOn(echoPluginWithLib1).dependingOn(echoPluginWithLib2);
addPackedAppFromBuilder(multiLibPluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, multiLibPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysApplicationWithPrivilegedPluginDependingOnPlugin.
@Test
public void deploysApplicationWithPrivilegedPluginDependingOnPlugin() throws Exception {
ArtifactPluginFileBuilder echoPlugin = new ArtifactPluginFileBuilder("echoPlugin").configuredWith(PRIVILEGED_EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").configuredWith(PRIVILEGED_ARTIFACTS_PROPERTY, "org.mule.test:dependantPlugin").dependingOn(new JarFileBuilder("echoTestJar", echoTestJarFile));
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
addPackedAppFromBuilder(artifactFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder 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());
}
Aggregations