use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin.
@Test
public void failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin() throws Exception {
ArtifactPluginFileBuilder invalidPrivilegedPlugin = new ArtifactPluginFileBuilder("invalidPrivilegedPlugin").dependingOn(new JarFileBuilder("privilegedExtensionV1", privilegedExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/");
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("invalidPrivilegedPluginApp").definedBy(APP_WITH_PRIVILEGED_EXTENSION_PLUGIN_CONFIG).dependingOn(invalidPrivilegedPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method failsToDeployApplicationOnMissingService.
@Test
public void failsToDeployApplicationOnMissingService() throws Exception {
ArtifactPluginFileBuilder extensionPlugin = new ArtifactPluginFileBuilder("extensionPlugin").dependingOn(new JarFileBuilder("bundleExtensionv1", helloExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/, META-INF");
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionPlugin").definedBy(APP_WITH_EXTENSION_PLUGIN_CONFIG).dependingOn(extensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder 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.ArtifactPluginFileBuilder 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));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method redeployPolicyWithSecurityManagerDefined.
@Test
public void redeployPolicyWithSecurityManagerDefined() throws Exception {
ArtifactPluginFileBuilder simpleExtensionPlugin = createSingleExtensionPlugin();
policyManager.registerPolicyTemplate(policyWithPluginAndResource().getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_SIMPLE_EXTENSION_CONFIG, simpleExtensionPlugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
PolicyParametrization policy = new PolicyParametrization(BAR_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/policy-using-security-manager.xml"), emptyList());
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingPluginFileBuilder.getArtifactId(), policy);
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(1));
policyManager.removePolicy(applicationFileBuilder.getId(), BAR_POLICY_ID);
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingPluginFileBuilder.getArtifactId(), policy);
executeApplicationFlow("main");
assertThat(invocationCount, equalTo(2));
}
Aggregations