use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deployAppNameWithZipSuffix.
@Test
public void deployAppNameWithZipSuffix() throws Exception {
final ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("empty-app.jar", emptyAppFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
reset(applicationDeploymentListener);
assertAppsDir(NONE, new String[] { applicationFileBuilder.getDeployedPath() }, true);
assertEquals("Application has not been properly registered with Mule", 1, deploymentService.getApplications().size());
// Checks that the empty-app.zip folder is not processed as a zip file
assertNoDeploymentInvoked(applicationDeploymentListener);
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployApplicationWithPluginDependantOnPluginNotShipped.
@Test
public void failsToDeployApplicationWithPluginDependantOnPluginNotShipped() throws Exception {
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").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();
assertDeploymentFailure(applicationDeploymentListener, artifactFileBuilder.getId(), times(1));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysWithExtensionXmlPluginWithDependencies.
@Test
public void deploysWithExtensionXmlPluginWithDependencies() throws Exception {
String moduleFileName = "module-using-java.xml";
String extensionName = "using-java-extension";
String moduleDestination = "org/mule/module/" + moduleFileName;
MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION).setRequiredProduct(MULE);
builder.withExtensionModelDescriber().setId(XmlExtensionModelLoader.DESCRIBER_ID).addProperty(RESOURCE_XML, moduleDestination);
builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().addProperty(EXPORTED_PACKAGES, asList("org.foo")).setId(MULE_LOADER_ID).build());
builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, MULE_LOADER_ID));
builder.setRequiredProduct(MULE).setMinMuleVersion(MIN_MULE_VERSION);
final ArtifactPluginFileBuilder byeXmlExtensionPlugin = new ArtifactPluginFileBuilder(extensionName).describedBy(builder.build()).containingResource("module-using-javaSource.xml", moduleDestination).dependingOn(new JarFileBuilder("echoTestJar", echoTestJarFile)).describedBy(builder.build());
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPluginWithDependencies").definedBy("app-with-extension-xml-plugin-module-using-java.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 deploysAppWithLibDifferentThanPlugin.
@Test
public void deploysAppWithLibDifferentThanPlugin() throws Exception {
final ApplicationFileBuilder differentLibPluginAppFileBuilder = new ApplicationFileBuilder("appWithLibDifferentThanPlugin").definedBy("app-plugin-different-lib-config.xml").dependingOn(echoPluginWithLib1).dependingOn(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile)).containingClass(pluginEcho2TestClassFile, "org/foo/echo/Plugin2Echo.class");
addPackedAppFromBuilder(differentLibPluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, differentLibPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method appHomePropertyIsPresent.
@Test
public void appHomePropertyIsPresent() throws Exception {
final ApplicationFileBuilder globalPropertyAppFileBuilder = new ApplicationFileBuilder("property-app").definedBy("app-properties-config.xml");
addExplodedAppFromBuilder(globalPropertyAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, globalPropertyAppFileBuilder.getId());
final Application app = findApp(globalPropertyAppFileBuilder.getId(), 1);
Optional<ConfigurationProperties> configurationProperties = app.getRegistry().lookupByType(ConfigurationProperties.class);
assertThat(configurationProperties.isPresent(), is(true));
String appHome = configurationProperties.get().resolveStringProperty("appHome").orElseThrow(() -> new RuntimeException("Could not find property appHome"));
assertThat(new File(appHome).exists(), is(true));
}
Aggregations