use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder 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.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysApplicationWithPluginDependingOnPlugin.
@Test
public void deploysApplicationWithPluginDependingOnPlugin() throws Exception {
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 failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin.
@Test
public void failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin() throws Exception {
ArtifactPluginFileBuilder invalidPrivilegedPlugin = new ArtifactPluginFileBuilder("invalidPrivilegedPlugin").dependingOn(new JarFileBuilder("privilegedExtensionV1", privilegedExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/");
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("invalidPrivilegedPluginApp").definedBy(APP_WITH_PRIVILEGED_EXTENSION_PLUGIN_CONFIG).dependingOn(invalidPrivilegedPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployApplicationOnMissingService.
@Test
public void failsToDeployApplicationOnMissingService() throws Exception {
ArtifactPluginFileBuilder extensionPlugin = new ArtifactPluginFileBuilder("extensionPlugin").dependingOn(new JarFileBuilder("bundleExtensionv1", helloExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/, META-INF");
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionPlugin").definedBy(APP_WITH_EXTENSION_PLUGIN_CONFIG).dependingOn(extensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithInterceptorsAndNotExportedPackage.
@Test
@Issue("MULE-13756")
@Description("Tests that code called form application's ProcessorInterceptor can access internal resources/packages of the application")
public void deploysAppWithInterceptorsAndNotExportedPackage() throws Exception {
File loadsOwnResourceInterceptorFactoryClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsOwnResourceInterceptorFactory.java"));
File loadsOwnResourceInterceptorClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsOwnResourceInterceptor.java"));
ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app").configuredWith(EXPORTED_PACKAGES, "org.bar1").configuredWith(EXPORTED_RESOURCES, "test-resource.txt").definedBy("app-with-interceptor.xml").containingClass(loadsOwnResourceInterceptorFactoryClassFile, "org/foo/LoadsOwnResourceInterceptorFactory.class").containingClass(loadsOwnResourceInterceptorClassFile, "org/foo/LoadsOwnResourceInterceptor.class").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");
addPackedAppFromBuilder(nonExposingAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations