Examples of ModuleClassLoader


Examples of org.jboss.modules.ModuleClassLoader

    @Test()
    public void testDirectResourceRetrieval() {
        log.info("Test accessing resources using getResource method");

        ModuleClassLoader classLoader = (ModuleClassLoader) getClass().getClassLoader();

        // checking that resource under META-INF is accessible
        URL manifestResource = classLoader.getResource("META-INF/example.txt");

        assertNotNull("Resource in META-INF should be accessible", manifestResource);

        // checking that resource under META-INF is accessible
        URL nestedManifestResource = classLoader.getResource("META-INF/properties/nested.properties");
        assertNotNull("Nested resource should be also accessible", nestedManifestResource);

        // checking that resource which is not under META-INF is not accessible
        URL nonManifestResource = classLoader.getResource("example2.txt");
        assertNull("Resource in the root of WAR shouldn't be accessible", nonManifestResource);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.