use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployApplicationWithMissingPluginDependencyOnPlugin.
@Test
public void failsToDeployApplicationWithMissingPluginDependencyOnPlugin() throws Exception {
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class");
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());
try {
executeApplicationFlow("main");
fail("Expected to fail as there should be a missing class");
} catch (Exception e) {
assertThat(e.getCause().getCause(), instanceOf(MuleFatalException.class));
assertThat(e.getCause().getCause().getCause(), instanceOf(NoClassDefFoundError.class));
assertThat(e.getCause().getCause().getCause().getMessage(), containsString("org/foo/EchoTest"));
}
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithExportedPackagePrecedenceOverPlugin.
@Test
public void deploysAppWithExportedPackagePrecedenceOverPlugin() throws Exception {
// Defines a plugin that contains org.bar package, which is also exported on the application
ArtifactPluginFileBuilder echoPluginWithoutLib1 = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").dependingOn(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile));
ApplicationFileBuilder sharedLibPluginAppFileBuilder = new ApplicationFileBuilder("shared-plugin-lib-app").definedBy("app-with-echo1-plugin-config.xml").dependingOn(echoPluginWithoutLib1).dependingOnSharedLibrary(new JarFileBuilder("barUtils", barUtils1_0JarFile));
addPackedAppFromBuilder(sharedLibPluginAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, sharedLibPluginAppFileBuilder.getId());
assertAppsDir(NONE, new String[] { sharedLibPluginAppFileBuilder.getId() }, true);
assertApplicationAnchorFileExists(sharedLibPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithPluginSharedLibrary.
@Test
public void deploysAppWithPluginSharedLibrary() throws Exception {
final ArtifactPluginFileBuilder echoPluginWithoutLib1 = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class");
final ApplicationFileBuilder sharedLibPluginAppFileBuilder = new ApplicationFileBuilder("shared-plugin-lib-app").definedBy("app-with-echo1-plugin-config.xml").dependingOn(echoPluginWithoutLib1).dependingOnSharedLibrary(new JarFileBuilder("barUtils", barUtils1_0JarFile));
addPackedAppFromBuilder(sharedLibPluginAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, sharedLibPluginAppFileBuilder.getId());
assertAppsDir(NONE, new String[] { sharedLibPluginAppFileBuilder.getId() }, true);
assertApplicationAnchorFileExists(sharedLibPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppZipWithPrivilegedExtensionPlugin.
@Test
public void deploysAppZipWithPrivilegedExtensionPlugin() throws Exception {
ArtifactPluginFileBuilder privilegedExtensionPlugin = createPrivilegedExtensionPlugin();
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("privilegedPluginApp").definedBy(APP_WITH_PRIVILEGED_EXTENSION_PLUGIN_CONFIG).dependingOn(privilegedExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppProvidingResourceForPlugin.
@Test
public void deploysAppProvidingResourceForPlugin() throws Exception {
File resourceConsumerClassFile = new CompilerUtils.SingleClassCompiler().compile(getResourceFile("/org/foo/resource/ResourceConsumer.java"));
final ArtifactPluginFileBuilder pluginUsingAppResource = new ArtifactPluginFileBuilder("appResourcePlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.resource").containingClass(resourceConsumerClassFile, "org/foo/resource/ResourceConsumer.class");
final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("appProvidingResourceForPlugin").definedBy("app-providing-resource-for-plugin.xml").dependingOn(pluginUsingAppResource).configuredWith(EXPORTED_RESOURCES, "META-INF/app-resource.txt").usingResource(getResourceFile("/test-resource.txt").toString(), "META-INF/app-resource.txt");
addPackedAppFromBuilder(artifactFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations