use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationSharedLib.
@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationSharedLib() throws Exception {
final String domainId = "shared-lib";
final DomainFileBuilder domainFileBuilder = new DomainFileBuilder(domainId).dependingOnSharedLibrary(new JarFileBuilder("barUtils1", 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", 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");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysAppUsingDomainExtensionWithSharedExtension.
@Test
public void deploysAppUsingDomainExtensionWithSharedExtension() throws Exception {
installEchoService();
installFooService();
DomainFileBuilder domainFileBuilder = new DomainFileBuilder("hello-domain-bundle").definedBy("hello-domain-config.xml").dependingOn(helloExtensionV1Plugin);
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithSharedHelloExtension").definedBy(APP_WITH_SHARED_EXTENSION_PLUGIN_CONFIG).dependingOn(domainFileBuilder);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method failsToApplyApplicationPolicyWithDomainPluginVersionMismatch.
@Test
public void failsToApplyApplicationPolicyWithDomainPluginVersionMismatch() throws Exception {
installEchoService();
installFooService();
policyManager.registerPolicyTemplate(policyIncludingHelloPluginV2FileBuilder.getArtifactFile());
DomainFileBuilder domainFileBuilder = new DomainFileBuilder("dummy-domain-bundle").definedBy("empty-domain-config.xml").dependingOn(helloExtensionV1Plugin);
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("dummyWithHelloExtension").definedBy(APP_WITH_EXTENSION_PLUGIN_CONFIG).dependingOn(domainFileBuilder);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
try {
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingHelloPluginV2FileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/appPluginPolicy.xml"), emptyList()));
fail("Policy application should have failed");
} catch (PolicyRegistrationException expected) {
}
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysAppWithPluginDependingOnDomainPlugin.
@Test
public void deploysAppWithPluginDependingOnDomainPlugin() throws Exception {
DomainFileBuilder domainFileBuilder = new DomainFileBuilder("dummy-domain-bundle").definedBy("empty-domain-config.xml").dependingOn(echoPlugin);
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(new CompilerUtils.SingleClassCompiler().compile(getResourceFile("/org/foo/echo/Plugin3Echo.java")), "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
ApplicationFileBuilder echoPluginAppFileBuilder = new ApplicationFileBuilder("dummyWithEchoPlugin").definedBy("app-with-echo-plugin-config.xml").dependingOn(domainFileBuilder).dependingOn(dependantPlugin);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(echoPluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, echoPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method redeploysDomainAndAllApplicationsEvenWhenOneFails.
@Test
public void redeploysDomainAndAllApplicationsEvenWhenOneFails() throws Exception {
addExplodedDomainFromBuilder(dummyDomainFileBuilder, dummyDomainFileBuilder.getId());
addExplodedAppFromBuilder(dummyDomainApp1FileBuilder, dummyDomainApp1FileBuilder.getId());
addExplodedAppFromBuilder(dummyDomainApp2FileBuilder, dummyDomainApp2FileBuilder.getId());
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, dummyDomainFileBuilder.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, dummyDomainApp1FileBuilder.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, dummyDomainApp2FileBuilder.getId());
reset(domainDeploymentListener);
reset(applicationDeploymentListener);
deploymentService.getLock().lock();
try {
doRedeployDummyDomainByChangingConfigFileWithGoodOne();
ApplicationFileBuilder updateAppDomainBuilder = new ApplicationFileBuilder("dummy-domain-app1").definedBy("incomplete-app-config.xml");
addExplodedAppFromBuilder(updateAppDomainBuilder);
} finally {
deploymentService.getLock().unlock();
}
assertDomainRedeploymentFailure(dummyDomainFileBuilder.getId());
assertApplicationRedeploymentFailure(dummyDomainApp1FileBuilder.getId());
assertApplicationRedeploymentSuccess(dummyDomainApp2FileBuilder.getId());
}
Aggregations