use of org.mule.runtime.deployment.model.api.domain.Domain in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomainZipAfterStartup.
@Test
public void deploysDomainZipAfterStartup() throws Exception {
startDeployment();
addPackedDomainFromBuilder(emptyDomainFileBuilder);
assertDeploymentSuccess(domainDeploymentListener, emptyDomainFileBuilder.getId());
assertDomainDir(NONE, new String[] { DEFAULT_DOMAIN_NAME, emptyDomainFileBuilder.getId() }, true);
final Domain domain = findADomain(emptyDomainFileBuilder.getId());
assertNotNull(domain);
assertNotNull(domain.getRegistry());
assertDomainAnchorFileExists(emptyDomainFileBuilder.getId());
}
use of org.mule.runtime.deployment.model.api.domain.Domain in project mule by mulesoft.
the class DomainDeploymentTestCase method undeploysDomainAndDomainsApps.
@Test
public void undeploysDomainAndDomainsApps() throws Exception {
doDomainUndeployAndVerifyAppsAreUndeployed(() -> {
Domain domain = findADomain(dummyDomainFileBuilder.getId());
deploymentService.undeploy(domain);
});
}
use of org.mule.runtime.deployment.model.api.domain.Domain in project mule by mulesoft.
the class DomainDeploymentTestCase method refreshDomainClassloaderAfterRedeployment.
@Ignore("MULE-6926: flaky test")
@Test
public void refreshDomainClassloaderAfterRedeployment() throws Exception {
startDeployment();
// Deploy domain and apps and wait until success
addPackedDomainFromBuilder(sharedDomainFileBuilder);
addPackedAppFromBuilder(sharedAAppFileBuilder);
addPackedAppFromBuilder(sharedBAppFileBuilder);
assertDeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedBAppFileBuilder.getId());
// Ensure resources are registered at domain's registry
Domain domain = findADomain(sharedDomainFileBuilder.getId());
assertThat(domain.getRegistry().lookupByName("http-listener-config").isPresent(), is(true));
ArtifactClassLoader initialArtifactClassLoader = domain.getArtifactClassLoader();
reset(domainDeploymentListener);
reset(applicationDeploymentListener);
// Force redeployment by touching the domain's config file
File domainFolder = new File(domainsDir.getPath(), sharedDomainFileBuilder.getId());
File configFile = new File(domainFolder, sharedDomainFileBuilder.getConfigFile());
long firstFileTimestamp = configFile.lastModified();
touch(configFile);
alterTimestampIfNeeded(configFile, firstFileTimestamp);
assertUndeploymentSuccess(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertUndeploymentSuccess(applicationDeploymentListener, sharedBAppFileBuilder.getId());
assertUndeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
assertDeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, sharedBAppFileBuilder.getId());
domain = findADomain(sharedDomainFileBuilder.getId());
ArtifactClassLoader artifactClassLoaderAfterRedeployment = domain.getArtifactClassLoader();
// Ensure that after redeployment the domain's class loader has changed
assertThat(artifactClassLoaderAfterRedeployment, not(sameInstance(initialArtifactClassLoader)));
// Undeploy domain and apps
removeAppAnchorFile(sharedAAppFileBuilder.getId());
removeAppAnchorFile(sharedBAppFileBuilder.getId());
removeDomainAnchorFile(sharedDomainFileBuilder.getId());
assertUndeploymentSuccess(applicationDeploymentListener, sharedAAppFileBuilder.getId());
assertUndeploymentSuccess(applicationDeploymentListener, sharedBAppFileBuilder.getId());
assertUndeploymentSuccess(domainDeploymentListener, sharedDomainFileBuilder.getId());
}
use of org.mule.runtime.deployment.model.api.domain.Domain in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomain.
private void deploysDomain() {
assertDeploymentSuccess(domainDeploymentListener, dummyDomainBundleFileBuilder.getId());
assertDomainDir(NONE, new String[] { DEFAULT_DOMAIN_NAME, dummyDomainBundleFileBuilder.getId() }, true);
final Domain domain = findADomain(dummyDomainBundleFileBuilder.getId());
assertNotNull(domain);
assertNotNull(domain.getRegistry());
assertApplicationDeploymentSuccess(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
assertAppsDir(NONE, new String[] { dummyAppDescriptorFileBuilder.getId() }, true);
final Application app = findApp(dummyAppDescriptorFileBuilder.getId(), 1);
assertNotNull(app);
}
use of org.mule.runtime.deployment.model.api.domain.Domain in project mule by mulesoft.
the class DomainArchiveDeployer method findApplicationsAssociated.
private Collection<Application> findApplicationsAssociated(String artifactId) {
Domain domain = deploymentService.findDomain(artifactId);
Preconditions.checkArgument(domain != null, String.format("Domain %s does not exists", artifactId));
return findApplicationsAssociated(domain);
}
Aggregations