use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class DomainArchiveDeployer method undeployArtifact.
/**
* Undeploys a domain.
* <p/>
* Before undeploying the domain it undeploys the applications associated.
*
* @param artifactId domain name to undeploy
*/
@Override
public void undeployArtifact(String artifactId) {
Collection<Application> domainApplications = findApplicationsAssociated(artifactId);
for (Application domainApplication : domainApplications) {
applicationDeployer.undeployArtifact(domainApplication.getArtifactName());
}
domainDeployer.undeployArtifact(artifactId);
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class DefaultArchiveDeployerTestCase method createMockApplication.
private Application createMockApplication() {
Application artifact = mock(Application.class);
ApplicationDescriptor descriptor = mock(ApplicationDescriptor.class);
when(descriptor.getDataFolderName()).thenReturn(ARTIFACT_ID);
when(artifact.getDescriptor()).thenReturn(descriptor);
when(artifact.getArtifactName()).thenReturn(ARTIFACT_ID);
return artifact;
}
use of org.mule.runtime.deployment.model.api.application.Application 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.deployment.model.api.application.Application in project mule by mulesoft.
the class TestApplicationFactory method createArtifact.
@Override
public Application createArtifact(File appLocation, Optional<Properties> appProperties) throws IOException {
Application app = super.createArtifact(appLocation, appProperties);
TestApplicationWrapper testApplicationWrapper = new TestApplicationWrapper(app);
testApplicationWrapper.setFailOnDisposeApplication(failOnDisposeApplication);
testApplicationWrapper.setFailOnStopApplication(failOnStopApplication);
return testApplicationWrapper;
}
use of org.mule.runtime.deployment.model.api.application.Application in project mule by mulesoft.
the class TestPolicyManager method addPolicy.
/**
* Adds a parameterized policy
*
* @param appName application where the policy must be applied. Non empty.
* @param policyTemplateName template that must be used to instantiate the parametrized policy. Non empty.
* @param policyParametrization parametrization to instantiate the policy. Non null.
*/
public void addPolicy(String appName, String policyTemplateName, PolicyParametrization policyParametrization) throws PolicyRegistrationException {
checkArgument(!isEmpty(appName), "appName cannot be empty");
checkArgument(!isEmpty(policyTemplateName), "policyTemplateName cannot be empty");
checkArgument(policyParametrization != null, "policyParametrization cannot be ull");
Optional<PolicyTemplateDescriptor> policyTemplateDescriptor = policyTemplateDescriptors.stream().filter(template -> template.getName().equals(policyTemplateName)).findFirst();
if (!policyTemplateDescriptor.isPresent()) {
throw new IllegalStateException("Cannot find policy template descriptor with name: " + policyTemplateName);
}
Application application = deploymentService.findApplication(appName);
ApplicationPolicyManager policyManager = application.getPolicyManager();
policyManager.addPolicy(policyTemplateDescriptor.get(), policyParametrization);
}
Aggregations