use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainBundleDeploymentTestCase method failsToDeployDomainBundleWithCorruptedDomain.
@Test
public void failsToDeployDomainBundleWithCorruptedDomain() throws Exception {
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder(dummyAppDescriptorFileBuilder).dependingOn(dummyDomainFileBuilder);
DomainBundleFileBuilder domainBundleFileBuilder = new DomainBundleFileBuilder(new DomainFileBuilder("dummy-domain")).containing(applicationFileBuilder);
addDomainBundleFromBuilder(domainBundleFileBuilder);
startDeployment();
assertDeploymentFailure(domainBundleDeploymentListener, domainBundleFileBuilder.getId());
assertDeploymentFailure(domainDeploymentListener, dummyDomainFileBuilder.getId());
assertDeploymentFailure(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method doRedeployBrokenDomainAfterFixedDomain.
/**
* After a successful deploy using the {@link DomainDeploymentTestCase#domainDeploymentListener}, this method deploys a domain
* zip with the same name and a wrong configuration. Applications dependant of the domain should not be deleted after this
* failure full redeploy.
*/
private void doRedeployBrokenDomainAfterFixedDomain() throws Exception {
assertApplicationAnchorFileExists(dummyAppDescriptorFileBuilder.getId());
reset(domainDeploymentListener);
DomainFileBuilder domainBundleWrongFullRedeploy = new DomainFileBuilder("dummy-domain-bundle").definedBy("incomplete-domain-config.xml");
addPackedDomainFromBuilder(domainBundleWrongFullRedeploy);
assertDeploymentFailure(domainDeploymentListener, domainBundleWrongFullRedeploy.getId());
assertThat(undeployLatch.await(5000, SECONDS), is(true));
assertApplicationAnchorFileExists(dummyAppDescriptorFileBuilder.getId());
Application dependantApplication = deploymentService.getApplications().get(0);
assertThat(dependantApplication, is(notNullValue()));
assertThat(dependantApplication.getStatus(), is(DESTROYED));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method appliesApplicationPolicyWithPluginDependingOnDomainPlugin.
@Test
public void appliesApplicationPolicyWithPluginDependingOnDomainPlugin() throws Exception {
installEchoService();
installFooService();
policyManager.registerPolicyTemplate(policyIncludingDependantPluginFileBuilder.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 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");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method redeployModifiedDomainAndRedeployFailedApps.
@Test
@Ignore("MULE-12255 Add the test plugin as a plugin of the domain")
public void redeployModifiedDomainAndRedeployFailedApps() throws Exception {
DomainFileBuilder sharedBundleDomainFileBuilder = new DomainFileBuilder("shared-domain").definedBy("shared-domain-config.xml");
addExplodedDomainFromBuilder(sharedBundleDomainFileBuilder);
// change shared config name to use a wrong name
File domainConfigFile = new File(domainsDir + "/" + sharedBundleDomainFileBuilder.getDeployedPath(), Paths.get("mule", DEFAULT_CONFIGURATION_RESOURCE).toString());
String correctDomainConfigContent = IOUtils.toString(new FileInputStream(domainConfigFile));
String wrongDomainFileContext = correctDomainConfigContent.replace("test-shared-config", "test-shared-config-wrong");
copyInputStreamToFile(new ByteArrayInputStream(wrongDomainFileContext.getBytes()), domainConfigFile);
long firstFileTimestamp = domainConfigFile.lastModified();
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
assertDeploymentFailure(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertDeploymentFailure(applicationDeploymentListener, sharedBAppFileBuilder.getId());
reset(applicationDeploymentListener);
reset(domainDeploymentListener);
copyInputStreamToFile(new ByteArrayInputStream(correctDomainConfigContent.getBytes()), domainConfigFile);
alterTimestampIfNeeded(domainConfigFile, firstFileTimestamp);
assertDeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedBAppFileBuilder.getId());
}
Aggregations