use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.
the class DeployableArtifactDescriptorFactoryTestCase method classLoaderModelWithoutIncludeTestDependencies.
@Test
public void classLoaderModelWithoutIncludeTestDependencies() throws Exception {
D desc = createArtifactDescriptor(getArtifactRootFolder() + "do-not-include-test-dependencies");
ClassLoaderModel classLoaderModel = desc.getClassLoaderModel();
assertThat(classLoaderModel.isIncludeTestDependencies(), is(false));
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.
the class DeployableArtifactDescriptorFactoryTestCase method classLoaderModelWithPluginDependencyWithAnotherPlugin.
@Test
public void classLoaderModelWithPluginDependencyWithAnotherPlugin() throws Exception {
D desc = createArtifactDescriptor(getArtifactRootFolder() + "plugin-dependency-with-another-plugin");
ClassLoaderModel classLoaderModel = desc.getClassLoaderModel();
assertThat(classLoaderModel.getDependencies().size(), is(2));
assertThat(classLoaderModel.getDependencies(), hasItems(dependantPluginDependencyMatcher(), emptyPluginDependencyMatcher()));
assertThat(classLoaderModel.getUrls().length, is(1));
classLoaderModel.getDependencies().stream().forEach(bundleDependency -> {
assertThat(asList(classLoaderModel.getUrls()), not(hasItem(bundleDependency.getBundleUri())));
});
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.
the class DeployableArtifactDescriptorFactoryTestCase method loadsDescriptorFromJson.
@Test
public void loadsDescriptorFromJson() throws Exception {
String artifactPath = getArtifactRootFolder() + "no-dependencies";
D desc = createArtifactDescriptor(artifactPath);
assertThat(desc.getMinMuleVersion(), is(new MuleVersion("4.0.0")));
assertThat(desc.getConfigResources(), hasSize(1));
assertThat(desc.getConfigResources(), hasItem(getDefaultConfigurationResourceLocation()));
ClassLoaderModel classLoaderModel = desc.getClassLoaderModel();
assertThat(classLoaderModel.getDependencies().isEmpty(), is(true));
assertThat(classLoaderModel.getUrls().length, is(1));
assertThat(toFile(classLoaderModel.getUrls()[0]).getPath(), is(getArtifact(artifactPath).getAbsolutePath()));
assertThat(classLoaderModel.getExportedPackages().isEmpty(), is(true));
assertThat(classLoaderModel.getExportedResources().isEmpty(), is(true));
assertThat(classLoaderModel.getDependencies().isEmpty(), is(true));
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.
the class FileSystemPolicyClassLoaderModelLoaderTestCase method createsClassLoaderModelFromFolder.
@Test
public void createsClassLoaderModelFromFolder() throws Exception {
File policyFolder = temporaryFolder.newFolder();
File libFolder = new File(policyFolder, LIB_DIR);
assertThat(libFolder.mkdir(), is(true));
File file1 = new File(libFolder, "test1.jar");
stringToFile(file1.getAbsolutePath(), "foo");
File file2 = new File(libFolder, "test2.jar");
stringToFile(file2.getAbsolutePath(), "foo");
ClassLoaderModel classLoaderModel = classLoaderModelLoader.load(policyFolder, null, POLICY);
assertThat(classLoaderModel.getUrls().length, equalTo(3));
assertThat(classLoaderModel.getUrls()[0], equalTo(policyFolder.toURI().toURL()));
assertThat(asList(classLoaderModel.getUrls()), allOf(hasItem(file1.toURI().toURL()), hasItem(file2.toURI().toURL())));
assertThat(classLoaderModel.getDependencies(), is(empty()));
assertThat(classLoaderModel.getExportedPackages(), is(empty()));
assertThat(classLoaderModel.getExportedResources(), is(empty()));
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel in project mule by mulesoft.
the class LibFolderClassLoaderModelLoaderTestCase method ignoresNonJarsFilesFromLibFolder.
@Test
public void ignoresNonJarsFilesFromLibFolder() throws Exception {
File libFolder = serviceFolder.newFolder(LIB_FOLDER);
File jarFile = new File(libFolder, "dummy.txt");
jarFile.createNewFile();
ClassLoaderModel classLoaderModel = classLoaderModelLoader.load(serviceFolder.getRoot(), emptyMap(), SERVICE);
// Contains only the service root
assertThat(classLoaderModel.getUrls(), hasItemInArray(serviceFolder.getRoot().toURL()));
}
Aggregations