Search in sources :

Example 6 with EnumerationAdapter

use of org.mule.runtime.core.internal.util.EnumerationAdapter in project mule by mulesoft.

the class ClasspathModuleDiscovererTestCase method discoversModuleWithExportedServices.

@Test
public void discoversModuleWithExportedServices() throws Exception {
    List<URL> moduleProperties = new ArrayList();
    moduleProperties.add(getClass().getClassLoader().getResource("moduleExportedServices.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("moduleExportedServices"));
    assertThat(muleModule.getExportedPackages(), is(empty()));
    assertThat(muleModule.getExportedPaths(), is(empty()));
    assertThat(muleModule.getPrivilegedExportedPackages(), is(empty()));
    assertThat(muleModule.getPrivilegedArtifacts(), is(empty()));
    assertThat(muleModule.getExportedServices().size(), equalTo(3));
    assertThat(muleModule.getExportedServices().get(0).getServiceInterface(), equalTo("org.foo.ServiceInterface"));
    assertThat(muleModule.getExportedServices().get(1).getServiceInterface(), equalTo("org.foo.ServiceInterface"));
    assertThat(muleModule.getExportedServices().get(2).getServiceInterface(), equalTo("org.bar.ServiceInterface"));
}
Also used : ArrayList(java.util.ArrayList) EnumerationAdapter(org.mule.runtime.core.internal.util.EnumerationAdapter) URL(java.net.URL) MuleModule(org.mule.runtime.container.api.MuleModule) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

URL (java.net.URL)6 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 EnumerationAdapter (org.mule.runtime.core.internal.util.EnumerationAdapter)6 SmallTest (org.mule.tck.size.SmallTest)6 MuleModule (org.mule.runtime.container.api.MuleModule)5