use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.
the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationSharedLib.
@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationSharedLib() throws Exception {
final String domainId = "shared-lib";
final DomainFileBuilder domainFileBuilder = new DomainFileBuilder(domainId).dependingOnSharedLibrary(new JarFileBuilder("barUtils1", barUtils1_0JarFile)).definedBy("empty-domain-config.xml");
final ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("shared-lib-precedence-app").definedBy("app-shared-lib-precedence-config.xml").dependingOnSharedLibrary(new JarFileBuilder("barUtils2", barUtils2_0JarFile)).containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").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.JarFileBuilder in project mule by mulesoft.
the class DeployableArtifactDescriptorFactoryTestCase method readsSharedLibs.
@Test
public void readsSharedLibs() throws Exception {
DeployableFileBuilder artifactFileBuilder = (DeployableFileBuilder) createArtifactFileBuilder().dependingOnSharedLibrary(new JarFileBuilder("shared", echoTestJarFile));
unzip(artifactFileBuilder.getArtifactFile(), getArtifactFolder());
D desc = createArtifactDescriptor();
assertThat(desc.getClassLoaderModel().getUrls().length, equalTo(2));
assertThat(toFile(desc.getClassLoaderModel().getUrls()[0]).getPath(), equalTo(getArtifactFolder().toString()));
assertThat(toFile(desc.getClassLoaderModel().getUrls()[1]).getPath(), endsWith(getArtifactRootFolder() + "test/repository/org/mule/test/shared/1.0.0/shared-1.0.0.jar"));
assertThat(desc.getClassLoaderModel().getExportedPackages(), contains("org.foo"));
assertThat(desc.getClassLoaderModel().getExportedResources(), containsInAnyOrder("META-INF/MANIFEST.MF", "README.txt"));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.
the class DeployableArtifactDescriptorFactoryTestCase method readsRuntimeLibs.
@Test
public void readsRuntimeLibs() throws Exception {
DeployableFileBuilder artifactFileBuilder = (DeployableFileBuilder) createArtifactFileBuilder().dependingOn(new JarFileBuilder("runtime", echoTestJarFile));
unzip(artifactFileBuilder.getArtifactFile(), getArtifactFolder());
D desc = createArtifactDescriptor();
assertThat(desc.getClassLoaderModel().getUrls().length, equalTo(2));
assertThat(toFile(desc.getClassLoaderModel().getUrls()[0]).getPath(), equalTo(getArtifactFolder().toString()));
assertThat(desc.getClassLoaderModel().getExportedPackages(), is(empty()));
assertThat(toFile(desc.getClassLoaderModel().getUrls()[1]).getPath(), endsWith(getArtifactRootFolder() + "test/repository/org/mule/test/runtime/1.0.0/runtime-1.0.0.jar"));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.
the class AbstractDeploymentTestCase method beforeClass.
@BeforeClass
public static void beforeClass() throws URISyntaxException, IllegalAccessException {
barUtils1ClassFile = new SingleClassCompiler().compile(getResourceFile("/org/bar1/BarUtils.java"));
barUtils1_0JarFile = new JarFileBuilder("barUtils1", new JarCompiler().compiling(getResourceFile("/org/bar1/BarUtils.java")).compile("bar-1.0.jar")).getArtifactFile();
barUtils2ClassFile = new SingleClassCompiler().compile(getResourceFile("/org/bar2/BarUtils.java"));
barUtils2_0JarFile = new JarCompiler().compiling(getResourceFile("/org/bar2/BarUtils.java")).compile("bar-2.0.jar");
echoTestJarFile = new JarCompiler().compiling(getResourceFile("/org/foo/EchoTest.java")).compile("echo.jar");
defaulServiceEchoJarFile = new JarCompiler().compiling(getResourceFile("/org/mule/echo/DefaultEchoService.java"), getResourceFile("/org/mule/echo/EchoServiceProvider.java")).compile("mule-module-service-echo-default-4.0-SNAPSHOT.jar");
defaultFooServiceJarFile = new JarCompiler().compiling(getResourceFile("/org/mule/service/foo/DefaultFooService.java"), getResourceFile("/org/mule/service/foo/FooServiceProvider.java")).dependingOn(defaulServiceEchoJarFile.getAbsoluteFile()).compile("mule-module-service-foo-default-4.0-SNAPSHOT.jar");
helloExtensionV1JarFile = new ExtensionCompiler().compiling(getResourceFile("/org/foo/hello/HelloExtension.java"), getResourceFile("/org/foo/hello/HelloOperation.java")).including(getResourceFile("/org/foo/hello/registry-bootstrap.properties"), "META-INF/org/mule/runtime/core/config/registry-bootstrap.properties").compile("mule-module-hello-1.0.0.jar", "1.0.0");
helloExtensionV2JarFile = new ExtensionCompiler().compiling(getResourceFile("/org/foo/hello/HelloExtension.java"), getResourceFile("/org/foo/hello/HelloOperation.java")).compile("mule-module-hello-2.0.0.jar", "2.0.0");
echoTestClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/EchoTest.java"));
loadsAppResourceCallbackClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsAppResourceCallback.java"));
pluginEcho1TestClassFile = new SingleClassCompiler().dependingOn(barUtils1_0JarFile).compile(getResourceFile("/org/foo/Plugin1Echo.java"));
internalIsRunningTests = (Boolean) readDeclaredStaticField(ModuleDelegatingEntityResolver.class, "internalIsRunningTests", true);
writeDeclaredStaticField(ModuleDelegatingEntityResolver.class, "internalIsRunningTests", true, true);
}
use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder 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()));
}
Aggregations