Search in sources :

Example 71 with ApplicationFileBuilder

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

the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationLib.

@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationLib() throws Exception {
    final String domainId = "shared-lib";
    final DomainFileBuilder domainFileBuilder = new DomainFileBuilder(domainId).dependingOnSharedLibrary(new JarFileBuilder("barUtils1_0", barUtils1_0JarFile)).definedBy("empty-domain-config.xml");
    final ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("shared-lib-precedence-app").definedBy("app-shared-lib-precedence-config.xml").dependingOnSharedLibrary(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile)).containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").dependingOn(domainFileBuilder);
    addPackedDomainFromBuilder(domainFileBuilder);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
    assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
    executeApplicationFlow("main");
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) DomainFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder) Test(org.junit.Test)

Example 72 with ApplicationFileBuilder

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

the class DomainDeploymentTestCase method deploysAppUsingDomainExtension.

@Test
public void deploysAppUsingDomainExtension() throws Exception {
    installEchoService();
    installFooService();
    DomainFileBuilder domainFileBuilder = new DomainFileBuilder("dummy-domain-bundle").definedBy("empty-domain-config.xml").dependingOn(helloExtensionV1Plugin);
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithHelloExtension").definedBy(APP_WITH_EXTENSION_PLUGIN_CONFIG).dependingOn(domainFileBuilder);
    addPackedDomainFromBuilder(domainFileBuilder);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
    assertDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
    executeApplicationFlow("main");
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) DomainFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder) Test(org.junit.Test)

Example 73 with ApplicationFileBuilder

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

the class DomainDeploymentTestCase method pluginFromDomainUsedInApp.

@Test
public void pluginFromDomainUsedInApp() throws Exception {
    addPackedDomainFromBuilder(exceptionThrowingPluginImportingDomain);
    ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices("exception-throwing-app.xml").dependingOn(exceptionThrowingPluginImportingDomain);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    try {
        executeApplicationFlow("main");
        fail("Flow execution was expected to throw an exception");
    } catch (MuleRuntimeException expected) {
        assertThat(expected.getCause().getCause().getClass().getName(), is(equalTo("org.exception.CustomException")));
    }
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) Test(org.junit.Test)

Example 74 with ApplicationFileBuilder

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

the class DomainDeploymentTestCase method deploysAppUsingDomainPlugin.

@Test
public void deploysAppUsingDomainPlugin() throws Exception {
    DomainFileBuilder domainFileBuilder = new DomainFileBuilder("dummy-domain-bundle").definedBy("empty-domain-config.xml").dependingOn(echoPlugin);
    ApplicationFileBuilder echoPluginAppFileBuilder = new ApplicationFileBuilder("dummyWithEchoPlugin").definedBy("app-with-echo-plugin-config.xml").dependingOn(domainFileBuilder);
    addPackedDomainFromBuilder(domainFileBuilder);
    addPackedAppFromBuilder(echoPluginAppFileBuilder);
    startDeployment();
    assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
    assertDeploymentSuccess(applicationDeploymentListener, echoPluginAppFileBuilder.getId());
    executeApplicationFlow("main");
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) DomainFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder) 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