use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method appliesApplicationPolicyWithNotificationListener.
@Test
public void appliesApplicationPolicyWithNotificationListener() throws Exception {
policyManager.registerPolicyTemplate(fooPolicyFileBuilder.getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_EXTENSION_PLUGIN_CONFIG, helloExtensionV1Plugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
List<Integer> notificationListenerActionIds = new ArrayList<>();
PolicyNotificationListener<PolicyNotification> notificationListener = notification -> notificationListenerActionIds.add(notification.getAction().getActionId());
policyManager.addPolicy(applicationFileBuilder.getId(), fooPolicyFileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, pointparameters -> true, 1, singletonMap(POLICY_PROPERTY_KEY, POLICY_PROPERTY_VALUE), getResourceFile("/fooPolicy.xml"), singletonList(notificationListener)));
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
new PollingProber(POLICY_NOTIFICATION_TIMEOUT, 100).check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
assertThat(notificationListenerActionIds, hasSize(4));
assertThat(notificationListenerActionIds, hasItems(PROCESS_START, BEFORE_NEXT, AFTER_NEXT, PROCESS_END));
return true;
}
});
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainBundleDeploymentTestCase method deploysDomainBundle.
@Test
public void deploysDomainBundle() 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());
assertDomainDir(NONE, new String[] { DEFAULT_DOMAIN_NAME, dummyDomainFileBuilder.getId() }, true);
assertAppsDir(NONE, new String[] { dummyAppDescriptorFileBuilder.getId() }, true);
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class DomainBundleDeploymentTestCase method deploysDomainBundleWithCorruptedApp.
@Test
public void deploysDomainBundleWithCorruptedApp() throws Exception {
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder(dummyAppDescriptorFileBuilder).corrupted();
DomainBundleFileBuilder domainBundleFileBuilder = new DomainBundleFileBuilder(dummyDomainFileBuilder).containing(applicationFileBuilder);
addDomainBundleFromBuilder(domainBundleFileBuilder);
startDeployment();
assertDeploymentFailure(domainBundleDeploymentListener, domainBundleFileBuilder.getId());
assertDomainDir(NONE, new String[] { DEFAULT_DOMAIN_NAME, dummyDomainFileBuilder.getId() }, true);
assertDeploymentSuccess(domainDeploymentListener, dummyDomainFileBuilder.getId());
assertDeploymentFailure(applicationDeploymentListener, dummyAppDescriptorFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder 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.ApplicationFileBuilder 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));
}
Aggregations