use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method appliesPolicyThatUsesPolicyClassOnExpression.
@Test
public void appliesPolicyThatUsesPolicyClassOnExpression() 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());
policyManager.addPolicy(applicationFileBuilder.getId(), policyIncludingPluginFileBuilder.getArtifactId(), new PolicyParametrization(BAR_POLICY_ID, s -> true, 1, emptyMap(), getResourceFile("/policy-using-policy-class-in-expression.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 createInjectedHelloExtensionPluginFileBuilder.
private ArtifactPluginFileBuilder createInjectedHelloExtensionPluginFileBuilder() throws URISyntaxException {
File injectedHelloExtensionJarFile = new CompilerUtils.ExtensionCompiler().compiling(getResourceFile("/org/foo/injected/InjectedHelloExtension.java"), getResourceFile("/org/foo/injected/InjectedHelloOperation.java")).compile("mule-module-hello-1.0.jar", "1.0");
MulePluginModel.MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModel.MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName("helloExtensionPlugin").setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader("helloExtensionPlugin", MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "1.0.0"));
mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).addProperty(EXPORTED_RESOURCES, asList("/", "META-INF/mule-hello.xsd", "META-INF/spring.handlers", "META-INF/spring.schemas")).build());
mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.injected.InjectedHelloExtension").addProperty("version", "1.0");
return new ArtifactPluginFileBuilder("helloExtensionPlugin-1.0").dependingOn(new JarFileBuilder("helloExtensionV1", injectedHelloExtensionJarFile)).describedBy((mulePluginModelBuilder.build()));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationPolicyDeploymentTestCase method createSingleExtensionPlugin.
private ArtifactPluginFileBuilder createSingleExtensionPlugin() {
MulePluginModel.MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModel.MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName("simpleExtensionPlugin").setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader("simpleExtensionPlugin", MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "1.0.0"));
mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).build());
mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.hello.SimpleExtension").addProperty("version", "1.0.0");
return new ArtifactPluginFileBuilder("simpleExtensionPlugin").dependingOn(new JarFileBuilder("simpleExtension", simpleExtensionJarFile)).describedBy(mulePluginModelBuilder.build());
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib.
@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib() throws Exception {
final String domainId = "shared-lib";
final ArtifactPluginFileBuilder pluginFileBuilder = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").dependingOn(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile));
final DomainFileBuilder domainFileBuilder = new DomainFileBuilder(domainId).dependingOnSharedLibrary(new JarFileBuilder("barUtils1.0", barUtils1_0JarFile)).definedBy("empty-domain-config.xml");
final ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("shared-lib-precedence-app").definedBy("app-shared-lib-precedence-config.xml").dependingOn(pluginFileBuilder).dependingOn(domainFileBuilder);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
executeApplicationFlow("main");
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysAppWithPluginDependingOnDomainPlugin.
@Test
public void deploysAppWithPluginDependingOnDomainPlugin() throws Exception {
DomainFileBuilder domainFileBuilder = new DomainFileBuilder("dummy-domain-bundle").definedBy("empty-domain-config.xml").dependingOn(echoPlugin);
ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(new CompilerUtils.SingleClassCompiler().compile(getResourceFile("/org/foo/echo/Plugin3Echo.java")), "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
ApplicationFileBuilder echoPluginAppFileBuilder = new ApplicationFileBuilder("dummyWithEchoPlugin").definedBy("app-with-echo-plugin-config.xml").dependingOn(domainFileBuilder).dependingOn(dependantPlugin);
addPackedDomainFromBuilder(domainFileBuilder);
addPackedAppFromBuilder(echoPluginAppFileBuilder);
startDeployment();
assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
assertDeploymentSuccess(applicationDeploymentListener, echoPluginAppFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations