use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployWithExtensionThatHasNonExistingIdForExtensionModel.
@Test
public void failsToDeployWithExtensionThatHasNonExistingIdForExtensionModel() throws Exception {
String extensionName = "extension-with-extension-model-id-non-existing";
MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION);
builder.withExtensionModelDescriber().setId("a-non-existing-ID-describer").addProperty("aProperty", "aValue");
builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID));
builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptor(MULE_LOADER_ID, emptyMap()));
final ArtifactPluginFileBuilder byeXmlExtensionPlugin = new ArtifactPluginFileBuilder(extensionName).describedBy(builder.build());
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPluginFails").definedBy("app-with-extension-xml-plugin-module-bye.xml").dependingOn(byeXmlExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppZipWithPlugin.
@Test
public void deploysAppZipWithPlugin() throws Exception {
final ApplicationFileBuilder echoPluginAppFileBuilder = new ApplicationFileBuilder("dummyWithEchoPlugin").definedBy("app-with-echo-plugin-config.xml").dependingOn(echoPlugin);
addPackedAppFromBuilder(echoPluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(applicationDeploymentListener, echoPluginAppFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysMultipleAppsZipOnStartup.
@Test
public void deploysMultipleAppsZipOnStartup() throws Exception {
final int totalApps = 20;
for (int i = 1; i <= totalApps; i++) {
addExplodedAppFromBuilder(new ApplicationFileBuilder(Integer.toString(i), emptyAppFileBuilder));
}
startDeployment();
for (int i = 1; i <= totalApps; i++) {
assertDeploymentSuccess(applicationDeploymentListener, new ApplicationFileBuilder(Integer.toString(i), emptyAppFileBuilder).getId());
}
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method appliesApplicationPolicyUsingModuleThatUsesPluginDuplicatedInTheApplication.
@Test
public void appliesApplicationPolicyUsingModuleThatUsesPluginDuplicatedInTheApplication() throws Exception {
PolicyFileBuilder policyIncludingByePlugin = createPolicyIncludingByePlugin();
policyManager.registerPolicyTemplate(policyIncludingByePlugin.getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_MODULE_BYE_CONFIG, createSingleExtensionPlugin(), byeXmlExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingByePlugin.getArtifactId(), new PolicyParametrization(BAR_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/module-using-bye-policy.xml"), emptyList()));
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method injectsObjectsFromApplicationIntoPolicies.
@Test
public void injectsObjectsFromApplicationIntoPolicies() throws Exception {
final ArtifactPluginFileBuilder bootstrapPluginFileBuilder = new ArtifactPluginFileBuilder("bootstrapPlugin").containingResource("plugin-bootstrap.properties", BOOTSTRAP_PROPERTIES).containingClass(echoTestClassFile, "org/foo/EchoTest.class").configuredWith(EXPORTED_RESOURCE_PROPERTY, BOOTSTRAP_PROPERTIES);
PolicyFileBuilder fooPolicyFileBuilder = createInjectedPolicy();
policyManager.registerPolicyTemplate(fooPolicyFileBuilder.getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_SIMPLE_EXTENSION_CONFIG, createSingleExtensionPlugin(), bootstrapPluginFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
policyManager.addPolicy(applicationFileBuilder.getId(), fooPolicyFileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/appPluginPolicy.xml"), emptyList()));
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
}
Aggregations