Search in sources :

Example 26 with ArtifactPluginFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.

the class AbstractDeploymentTestCase method createModuleUsingByeXmlPluginFileBuilder.

private ArtifactPluginFileBuilder createModuleUsingByeXmlPluginFileBuilder() {
    String moduleFileName = "module-using-bye.xml";
    String extensionName = "using-bye-extension";
    String moduleDestination = "org/mule/module/" + moduleFileName;
    MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION).setRequiredProduct(MULE);
    builder.withExtensionModelDescriber().setId(XmlExtensionModelLoader.DESCRIBER_ID).addProperty(RESOURCE_XML, moduleDestination);
    builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().addProperty(EXPORTED_PACKAGES, asList("org.foo")).setId(MULE_LOADER_ID).build());
    builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, MULE_LOADER_ID));
    return new ArtifactPluginFileBuilder(extensionName).containingResource("module-using-byeSource.xml", moduleDestination).dependingOn(byeXmlExtensionPlugin).describedBy(builder.build());
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) MulePluginModelBuilder(org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder) MuleArtifactLoaderDescriptorBuilder(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder) MulePluginModel(org.mule.runtime.api.deployment.meta.MulePluginModel)

Example 27 with ArtifactPluginFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.

the class AbstractDeploymentTestCase method createHelloExtensionV1PluginFileBuilder.

private ArtifactPluginFileBuilder createHelloExtensionV1PluginFileBuilder() {
    MulePluginModelBuilder mulePluginModelBuilder = new 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).build());
    mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.hello.HelloExtension").addProperty("version", "1.0.0");
    return new ArtifactPluginFileBuilder("helloExtensionPlugin-1.0.0").dependingOn(new JarFileBuilder("helloExtensionV1", helloExtensionV1JarFile)).describedBy((mulePluginModelBuilder.build()));
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) MuleArtifactLoaderDescriptorBuilder(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) MulePluginModelBuilder(org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder)

Example 28 with ArtifactPluginFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.

the class AbstractDeploymentTestCase method createByeXmlPluginFileBuilder.

private ArtifactPluginFileBuilder createByeXmlPluginFileBuilder() {
    final String prefixModuleName = "module-bye";
    String extensionName = "bye-extension";
    final String resources = "org/mule/module/";
    String moduleDestination = resources + prefixModuleName + ".xml";
    MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION);
    builder.withExtensionModelDescriber().setId(XmlExtensionModelLoader.DESCRIBER_ID).addProperty(RESOURCE_XML, moduleDestination);
    builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptor(MULE_LOADER_ID, emptyMap()));
    builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, MULE_LOADER_ID));
    builder.setRequiredProduct(MULE).setMinMuleVersion(MIN_MULE_VERSION);
    return new ArtifactPluginFileBuilder(extensionName).containingResource("module-byeSource.xml", moduleDestination).containingResource("module-using-bye-catalogSource.xml", resources + prefixModuleName + "-catalog.xml").containingResource("module-bye-type-schemaSource.json", resources + "type1-schema.json").containingResource("module-bye-type-schemaSource.json", resources + "inner/folder/type2-schema.json").containingResource("module-bye-type-schemaSource.json", "org/mule/type3-schema.json").describedBy(builder.build());
}
Also used : MuleArtifactLoaderDescriptor(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptor) ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) MulePluginModelBuilder(org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder) MulePluginModel(org.mule.runtime.api.deployment.meta.MulePluginModel) MulePluginModelBuilder(org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder)

Example 29 with ArtifactPluginFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method failsToDeployApplicationWithPluginDependantOnPluginNotShipped.

@Test
public void failsToDeployApplicationWithPluginDependantOnPluginNotShipped() throws Exception {
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").dependingOn(echoPlugin);
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentFailure(applicationDeploymentListener, artifactFileBuilder.getId(), times(1));
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) Test(org.junit.Test)

Example 30 with ArtifactPluginFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysWithExtensionXmlPluginWithDependencies.

@Test
public void deploysWithExtensionXmlPluginWithDependencies() throws Exception {
    String moduleFileName = "module-using-java.xml";
    String extensionName = "using-java-extension";
    String moduleDestination = "org/mule/module/" + moduleFileName;
    MulePluginModel.MulePluginModelBuilder builder = new MulePluginModel.MulePluginModelBuilder().setName(extensionName).setMinMuleVersion(MIN_MULE_VERSION).setRequiredProduct(MULE);
    builder.withExtensionModelDescriber().setId(XmlExtensionModelLoader.DESCRIBER_ID).addProperty(RESOURCE_XML, moduleDestination);
    builder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().addProperty(EXPORTED_PACKAGES, asList("org.foo")).setId(MULE_LOADER_ID).build());
    builder.withBundleDescriptorLoader(createBundleDescriptorLoader(extensionName, MULE_EXTENSION_CLASSIFIER, MULE_LOADER_ID));
    builder.setRequiredProduct(MULE).setMinMuleVersion(MIN_MULE_VERSION);
    final ArtifactPluginFileBuilder byeXmlExtensionPlugin = new ArtifactPluginFileBuilder(extensionName).describedBy(builder.build()).containingResource("module-using-javaSource.xml", moduleDestination).dependingOn(new JarFileBuilder("echoTestJar", echoTestJarFile)).describedBy(builder.build());
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionXmlPluginWithDependencies").definedBy("app-with-extension-xml-plugin-module-using-java.xml").dependingOn(byeXmlExtensionPlugin);
    addPackedAppFromBuilder(applicationFileBuilder);
    final DefaultDomainManager domainManager = new DefaultDomainManager();
    domainManager.addDomain(createDefaultDomain());
    TestApplicationFactory appFactory = createTestApplicationFactory(new MuleApplicationClassLoaderFactory(new DefaultNativeLibraryFinderFactory()), domainManager, serviceManager, extensionModelLoaderManager, moduleRepository, createDescriptorLoaderRepository());
    deploymentService.setAppFactory(appFactory);
    startDeployment();
    assertDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) DefaultDomainManager(org.mule.runtime.module.deployment.impl.internal.domain.DefaultDomainManager) MuleArtifactLoaderDescriptorBuilder(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) MulePluginModel(org.mule.runtime.api.deployment.meta.MulePluginModel) DefaultNativeLibraryFinderFactory(org.mule.runtime.deployment.model.internal.nativelib.DefaultNativeLibraryFinderFactory) Matchers.containsString(org.hamcrest.Matchers.containsString) TestApplicationFactory.createTestApplicationFactory(org.mule.runtime.module.deployment.internal.TestApplicationFactory.createTestApplicationFactory) MuleApplicationClassLoaderFactory(org.mule.runtime.deployment.model.internal.application.MuleApplicationClassLoaderFactory) Test(org.junit.Test)

Aggregations

ArtifactPluginFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder)41 Test (org.junit.Test)31 ApplicationFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder)27 JarFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder)18 MulePluginModel (org.mule.runtime.api.deployment.meta.MulePluginModel)15 MuleArtifactLoaderDescriptorBuilder (org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder)13 File (java.io.File)12 MuleArtifactLoaderDescriptor (org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptor)10 URISyntaxException (java.net.URISyntaxException)5 MulePluginModelBuilder (org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder)5 CompilerUtils (org.mule.tck.util.CompilerUtils)5 TestArtifactDescriptor (org.mule.runtime.module.artifact.builder.TestArtifactDescriptor)4 PolicyFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.PolicyFileBuilder)4 ArrayList (java.util.ArrayList)3 Arrays.asList (java.util.Arrays.asList)3 Collections.emptyList (java.util.Collections.emptyList)3 Collections.emptyMap (java.util.Collections.emptyMap)3 Collections.singletonList (java.util.Collections.singletonList)3 Collections.singletonMap (java.util.Collections.singletonMap)3 List (java.util.List)3