use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithNotExportedPackageAndPlugin.
@Test
@Issue("MULE-13756")
@Description("Tests that code called form plugin's Processor cannot access internal resources/packages of the application")
public void deploysAppWithNotExportedPackageAndPlugin() throws Exception {
ArtifactPluginFileBuilder loadsAppResourcePlugin = new ArtifactPluginFileBuilder("loadsAppResourcePlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(loadsAppResourceCallbackClassFile, "org/foo/LoadsAppResourceCallback.class");
ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app").configuredWith(EXPORTED_PACKAGES, "org.bar1").configuredWith(EXPORTED_RESOURCES, "test-resource.txt").definedBy("app-with-loads-app-resource-plugin-config.xml").containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class").containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class").containingResource("test-resource.txt", "test-resource.txt").containingResource("test-resource.txt", "test-resource-not-exported.txt").dependingOn(loadsAppResourcePlugin);
addPackedAppFromBuilder(nonExposingAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppUsingPluginResource.
@Test
public void deploysAppUsingPluginResource() throws Exception {
final ArtifactPluginFileBuilder pluginWithResource = new ArtifactPluginFileBuilder("resourcePlugin").configuredWith(EXPORTED_RESOURCE_PROPERTY, "/pluginResource.properties").containingResource("pluginResourceSource.properties", "pluginResource.properties");
final ApplicationFileBuilder resourcePluginAppFileBuilder = new ApplicationFileBuilder("dummyWithPluginResource").definedBy("plugin-resource-app-config.xml").dependingOn(pluginWithResource);
addPackedAppFromBuilder(resourcePluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, resourcePluginAppFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployWithExtensionThatHasNonExistingIdForClassLoaderModel.
@Test
public void failsToDeployWithExtensionThatHasNonExistingIdForClassLoaderModel() throws Exception {
String extensionName = "extension-with-classloader-model-id-non-existing";
MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION);
builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId("a-non-existing-ID-describer").addProperty("aProperty", "aValue").build());
builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID));
final ArtifactPluginFileBuilder byeXmlExtensionPlugin = new ArtifactPluginFileBuilder(extensionName).describedBy(builder.build());
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPluginFails").definedBy("app-with-extension-xml-plugin-module-bye.xml").dependingOn(byeXmlExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId(), times(1));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysWithExtensionXmlPluginWithXmlDependencies.
@Test
public void deploysWithExtensionXmlPluginWithXmlDependencies() throws Exception {
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPluginWithXmlDependencies").definedBy("app-with-extension-xml-plugin-module-using-bye.xml").dependingOn(moduleUsingByeXmlExtensionPlugin);
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 deploysLightApplicationWithPluginDependingOnPlugin.
@Test
public void deploysLightApplicationWithPluginDependingOnPlugin() throws Exception {
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
File mavenRepoFolder = Paths.get(getMuleBaseFolder().getAbsolutePath(), "repository").toFile();
File testGroupIdRepoFolder = Paths.get(mavenRepoFolder.getAbsolutePath(), "org", "mule", "test").toFile();
JarFileBuilder testJarFileDependency = new JarFileBuilder("echoTestJar", echoTestJarFile);
copyFile(testJarFileDependency.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoTestJar", "1.0.0", "echoTestJar-1.0.0.pom").toFile());
copyFile(testJarFileDependency.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoTestJar", "1.0.0", "echoTestJar-1.0.0.jar").toFile());
copyFile(echoPlugin.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoPlugin", "1.0.0", "echoPlugin-1.0.0.pom").toFile());
copyFile(echoPlugin.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoPlugin", "1.0.0", "echoPlugin-1.0.0-mule-plugin.jar").toFile());
copyFile(dependantPlugin.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "dependantPlugin", "1.0.0", "dependantPlugin-1.0.0.pom").toFile());
copyFile(dependantPlugin.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "dependantPlugin", "1.0.0", "dependantPlugin-1.0.0-mule-plugin.jar").toFile());
final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin).usingLightWeightPackage();
addPackedAppFromBuilder(artifactFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations