use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.
the class ClasspathModuleDiscovererTestCase method discoversModule.
@Test
public void discoversModule() throws Exception {
List<URL> moduleProperties = new ArrayList();
moduleProperties.add(getClass().getClassLoader().getResource("invalidModule.properties"));
when(classLoader.getResources(ClasspathModuleDiscoverer.MODULE_PROPERTIES)).thenReturn(new EnumerationAdapter(moduleProperties));
expectedException.expect(IllegalArgumentException.class);
moduleDiscoverer.discover();
}
use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.
the class ClasspathModuleDiscovererTestCase method discoversModuleWithExportedJavaPackages.
@Test
public void discoversModuleWithExportedJavaPackages() throws Exception {
List<URL> moduleProperties = new ArrayList();
moduleProperties.add(getClass().getClassLoader().getResource("moduleJavaPackages.properties"));
when(classLoader.getResources(ClasspathModuleDiscoverer.MODULE_PROPERTIES)).thenReturn(new EnumerationAdapter(moduleProperties));
List<MuleModule> muleModules = moduleDiscoverer.discover();
assertThat(muleModules, hasSize(1));
MuleModule muleModule = muleModules.get(0);
assertThat(muleModule.getName(), is("moduleJavaPackages"));
assertThat(muleModule.getExportedPackages(), contains("org.foo", "org.bar"));
assertThat(muleModule.getExportedPaths(), is(empty()));
assertThat(muleModule.getPrivilegedExportedPackages(), is(empty()));
assertThat(muleModule.getPrivilegedArtifacts(), is(empty()));
assertThat(muleModule.getExportedServices(), is(empty()));
}
use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.
the class ClasspathModuleDiscovererTestCase method ignoresDuplicateModule.
@Test
public void ignoresDuplicateModule() throws Exception {
List<URL> moduleProperties = new ArrayList();
moduleProperties.add(getClass().getClassLoader().getResource("moduleJavaPackages.properties"));
when(classLoader.getResources(ClasspathModuleDiscoverer.MODULE_PROPERTIES)).thenReturn(new EnumerationAdapter(moduleProperties));
List<MuleModule> modules = moduleDiscoverer.discover();
assertThat(modules.size(), equalTo(1));
}
use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.
the class ClasspathModuleDiscovererTestCase method discoversModuleWithExportedPrivilegedApi.
@Test
public void discoversModuleWithExportedPrivilegedApi() throws Exception {
List<URL> moduleProperties = new ArrayList();
moduleProperties.add(getClass().getClassLoader().getResource("moduleJavaPrivilegedApi.properties"));
when(classLoader.getResources(ClasspathModuleDiscoverer.MODULE_PROPERTIES)).thenReturn(new EnumerationAdapter(moduleProperties));
List<MuleModule> muleModules = moduleDiscoverer.discover();
assertThat(muleModules, hasSize(1));
MuleModule muleModule = muleModules.get(0);
assertThat(muleModule.getName(), is("moduleJavaPrivilegedApi"));
assertThat(muleModule.getExportedPackages(), is(empty()));
assertThat(muleModule.getExportedPaths(), is(empty()));
assertThat(muleModule.getPrivilegedExportedPackages(), contains("org.foo", "org.bar"));
assertThat(muleModule.getPrivilegedArtifacts(), contains("privilegedArtifact1", "privilegedArtifact2"));
assertThat(muleModule.getExportedServices(), is(empty()));
}
use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.
the class ClasspathModuleDiscovererTestCase method discoversModuleWithExportedResourcePackages.
@Test
public void discoversModuleWithExportedResourcePackages() throws Exception {
List<URL> moduleProperties = new ArrayList();
moduleProperties.add(getClass().getClassLoader().getResource("moduleResourcePackages.properties"));
when(classLoader.getResources(ClasspathModuleDiscoverer.MODULE_PROPERTIES)).thenReturn(new EnumerationAdapter(moduleProperties));
List<MuleModule> muleModules = moduleDiscoverer.discover();
assertThat(muleModules, hasSize(1));
MuleModule muleModule = muleModules.get(0);
assertThat(muleModule.getName(), is("moduleResourcePackages"));
assertThat(muleModule.getExportedPackages(), is(empty()));
assertThat(muleModule.getExportedPaths(), containsInAnyOrder("META-INF/module.xsd", "README.txt"));
assertThat(muleModule.getPrivilegedExportedPackages(), is(empty()));
assertThat(muleModule.getPrivilegedArtifacts(), is(empty()));
assertThat(muleModule.getExportedServices(), is(empty()));
}
Aggregations