Search in sources :

Example 1 with ApplicationFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.

the class AbstractDeploymentTestCase method createExtensionApplicationWithServices.

protected ApplicationFileBuilder createExtensionApplicationWithServices(String appConfigFile, ArtifactPluginFileBuilder... plugins) throws Exception {
    installEchoService();
    installFooService();
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionPlugin").definedBy(appConfigFile);
    for (ArtifactPluginFileBuilder plugin : plugins) {
        applicationFileBuilder.dependingOn(plugin);
    }
    return applicationFileBuilder;
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder)

Example 2 with ApplicationFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysAppWithPluginBootstrapProperty.

@Test
public void deploysAppWithPluginBootstrapProperty() throws Exception {
    final ArtifactPluginFileBuilder pluginFileBuilder = new ArtifactPluginFileBuilder("bootstrapPlugin").containingResource("plugin-bootstrap.properties", BOOTSTRAP_PROPERTIES).containingClass(echoTestClassFile, "org/foo/EchoTest.class").configuredWith(EXPORTED_RESOURCE_PROPERTY, BOOTSTRAP_PROPERTIES);
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("app-with-plugin-bootstrap").definedBy("app-with-plugin-bootstrap.xml").dependingOn(pluginFileBuilder);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
    final Application application = findApp(applicationFileBuilder.getId(), 1);
    final Optional<Object> lookupObject = application.getRegistry().lookupByName("plugin.echotest");
    assertThat(lookupObject.isPresent(), is(true));
    assertThat(lookupObject.get().getClass().getName(), equalTo("org.foo.EchoTest"));
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) Application(org.mule.runtime.deployment.model.api.application.Application) Test(org.junit.Test)

Example 3 with ApplicationFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method removesPreviousAppFolderOnRedeploy.

@Test
public void removesPreviousAppFolderOnRedeploy() throws Exception {
    startDeployment();
    addPackedAppFromBuilder(emptyAppFileBuilder);
    assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
    assertAppsDir(NONE, new String[] { emptyAppFileBuilder.getId() }, true);
    assertEquals("Application has not been properly registered with Mule", 1, deploymentService.getApplications().size());
    reset(applicationDeploymentListener);
    ApplicationFileBuilder emptyAppFileBuilder = new ApplicationFileBuilder("empty-app").usingResource("empty-config.xml", "empty-config.xml").deployedWith(PROPERTY_CONFIG_RESOURCES, "empty-config.xml");
    addPackedAppFromBuilder(emptyAppFileBuilder);
    assertApplicationRedeploymentSuccess(emptyAppFileBuilder.getId());
    assertApplicationFiles(emptyAppFileBuilder.getId(), new String[] { "empty-config.xml" });
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) Test(org.junit.Test)

Example 4 with ApplicationFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysAppWithPluginExportingAlreadyProvidedAppPackage.

@Test
public void deploysAppWithPluginExportingAlreadyProvidedAppPackage() throws Exception {
    // Defines a plugin that exports org.bar which is also exported on the application
    ArtifactPluginFileBuilder echoPluginWithoutLib1 = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo,org.bar").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class");
    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");
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) Test(org.junit.Test)

Example 5 with ApplicationFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysAppZipWithExtensionUpperCaseAfterStartup.

@Test
public void deploysAppZipWithExtensionUpperCaseAfterStartup() throws Exception {
    final ApplicationFileBuilder dummyAppDescriptorFileBuilderWithUpperCaseInExtension = new ApplicationFileBuilder("dummy-app", true).definedBy("dummy-app-config.xml").configuredWith("myCustomProp", "someValue").containingClass(echoTestClassFile, "org/foo/EchoTest.class");
    deployAfterStartUp(dummyAppDescriptorFileBuilderWithUpperCaseInExtension);
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) Test(org.junit.Test)

Aggregations

ApplicationFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder)74 Test (org.junit.Test)72 ArtifactPluginFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder)43 JarFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder)32 File (java.io.File)25 PolicyParametrization (org.mule.runtime.core.api.policy.PolicyParametrization)21 CompilerUtils (org.mule.tck.util.CompilerUtils)21 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)20 URISyntaxException (java.net.URISyntaxException)19 Collections.emptyList (java.util.Collections.emptyList)19 Collections.emptyMap (java.util.Collections.emptyMap)19 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)19 Matchers.equalTo (org.hamcrest.Matchers.equalTo)19 Is.is (org.hamcrest.core.Is.is)19 Assert.fail (org.junit.Assert.fail)19 PolicyRegistrationException (org.mule.runtime.deployment.model.api.policy.PolicyRegistrationException)19 TestPolicyProcessor.invocationCount (org.mule.runtime.module.deployment.internal.TestPolicyProcessor.invocationCount)19 MulePluginModel (org.mule.runtime.api.deployment.meta.MulePluginModel)18 MuleArtifactLoaderDescriptorBuilder (org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder)17 MuleArtifactLoaderDescriptor (org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptor)16