use of org.mule.runtime.module.deployment.impl.internal.builder.PolicyFileBuilder in project mule by mulesoft.
the class PolicyTemplateDescriptorFactoryTestCase method assignsBundleDescriptor.
@Test
public void assignsBundleDescriptor() throws Exception {
MulePolicyModelBuilder mulePolicyModelBuilder = new MulePolicyModelBuilder().setName(POLICY_NAME).setMinMuleVersion("4.0.0").setRequiredProduct(MULE).withBundleDescriptorLoader(createPolicyBundleDescriptorLoader(PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID)).withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptor(MULE_LOADER_ID, emptyMap()));
PolicyFileBuilder policyFileBuilder = new PolicyFileBuilder(POLICY_NAME).usingLibrary(echoTestJarFile.getAbsolutePath()).describedBy(mulePolicyModelBuilder.build());
File tempFolder = createTempFolder();
unzip(policyFileBuilder.getArtifactFile(), tempFolder);
PolicyTemplateDescriptorFactory descriptorFactory = new PolicyTemplateDescriptorFactory(artifactPluginDescriptorLoader, descriptorLoaderRepository, ArtifactDescriptorValidatorBuilder.builder());
PolicyTemplateDescriptor desc = descriptorFactory.create(tempFolder, empty());
assertThat(desc.getBundleDescriptor().getArtifactId(), equalTo(POLICY_NAME));
assertThat(desc.getBundleDescriptor().getGroupId(), equalTo(POLICY_GROUP_ID));
assertThat(desc.getBundleDescriptor().getClassifier().get(), equalTo(POLICY_CLASSIFIER));
assertThat(desc.getBundleDescriptor().getType(), equalTo(POLICY_ARTIFACT_TYPE));
assertThat(desc.getBundleDescriptor().getVersion(), equalTo(POLICY_VERSION));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.PolicyFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method appliesApplicationPolicyUsingModuleThatUsesPlugin.
@Test
public void appliesApplicationPolicyUsingModuleThatUsesPlugin() throws Exception {
PolicyFileBuilder policyIncludingByePlugin = createPolicyIncludingByePlugin();
policyManager.registerPolicyTemplate(policyIncludingByePlugin.getArtifactFile());
ApplicationFileBuilder applicationFileBuilder = createExtensionApplicationWithServices(APP_WITH_SIMPLE_EXTENSION_CONFIG, createSingleExtensionPlugin());
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));
}
Aggregations