use of org.mule.runtime.module.deployment.impl.internal.policy.PropertiesBundleDescriptorLoader.PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method failsToApplyBrokenApplicationPolicy.
@Test
public void failsToApplyBrokenApplicationPolicy() throws Exception {
PolicyFileBuilder brokenPolicyFileBuilder = new PolicyFileBuilder(BAR_POLICY_NAME).describedBy(new MulePolicyModel.MulePolicyModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName(BAR_POLICY_NAME).setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader(BAR_POLICY_NAME, MULE_POLICY_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID)).withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptor(MULE_LOADER_ID, emptyMap())).build());
policyManager.registerPolicyTemplate(brokenPolicyFileBuilder.getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_EXTENSION_PLUGIN_CONFIG, helloExtensionV1Plugin);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
try {
policyManager.addPolicy(applicationFileBuilder.getId(), brokenPolicyFileBuilder.getArtifactId(), new PolicyParametrization(FOO_POLICY_ID, parameters -> true, 1, emptyMap(), getResourceFile("/brokenPolicy.xml"), emptyList()));
fail("Policy application should have failed");
} catch (PolicyRegistrationException expected) {
}
}
Aggregations