use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainBundleDeploymentTestCase method redeploysDomainBundleWithBrokenDomain.
@Test
public void redeploysDomainBundleWithBrokenDomain() throws Exception {
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder(dummyAppDescriptorFileBuilder).dependingOn(dummyDomainFileBuilder);
DomainBundleFileBuilder domainBundleFileBuilder = new DomainBundleFileBuilder(dummyDomainFileBuilder).containing(applicationFileBuilder);
addDomainBundleFromBuilder(domainBundleFileBuilder);
startDeployment();
assertDeploymentSuccess(domainBundleDeploymentListener, domainBundleFileBuilder.getId());
assertDeploymentSuccess(domainDeploymentListener, dummyDomainFileBuilder.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
reset(domainDeploymentListener);
reset(domainBundleDeploymentListener);
reset(applicationDeploymentListener);
dummyDomainFileBuilder = new DomainFileBuilder(dummyDomainFileBuilder).corrupted();
domainBundleFileBuilder = new DomainBundleFileBuilder(dummyDomainFileBuilder).containing(applicationFileBuilder);
addDomainBundleFromBuilder(domainBundleFileBuilder);
assertDeploymentFailure(domainBundleDeploymentListener, domainBundleFileBuilder.getId());
assertDomainRedeploymentFailure(dummyDomainFileBuilder.getId());
assertRedeploymentFailure(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
assertThat(deploymentService.findApplication(dummyAppDescriptorFileBuilder.getId()), is(nullValue()));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method appliesApplicationPolicyDuplicatingDomainPlugin.
@Test
public void appliesApplicationPolicyDuplicatingDomainPlugin() throws Exception {
installEchoService();
installFooService();
policyManager.registerPolicyTemplate(policyIncludingPluginFileBuilder.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());
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingPluginFileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/appPluginPolicy.xml"), emptyList()));
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method failsToDeployAppWithDomainPluginVersionMismatch.
@Test
public void failsToDeployAppWithDomainPluginVersionMismatch() throws Exception {
installEchoService();
installFooService();
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).dependingOn(helloExtensionV2Plugin);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method appliesApplicationPolicyUsingDomainPlugin.
@Test
public void appliesApplicationPolicyUsingDomainPlugin() throws Exception {
installEchoService();
installFooService();
policyManager.registerPolicyTemplate(policyIncludingPluginFileBuilder.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());
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingPluginFileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/appPluginPolicy.xml"), emptyList()));
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib.
@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib() throws Exception {
final String domainId = "shared-lib";
final ArtifactPluginFileBuilder pluginFileBuilder = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").dependingOn(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile));
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").dependingOn(pluginFileBuilder).dependingOn(domainFileBuilder);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations