Package org.apache.tika

Examples of org.apache.tika.ResourceLoggingClassLoader


     * TIKA-1145 If the TikaConfig has a ClassLoader set on it,
     * that should be used when loading the mimetypes and when
     * discovering services
     */
    public void testClassLoaderUsedEverywhere() throws Exception {
        ResourceLoggingClassLoader customLoader =
                new ResourceLoggingClassLoader(getClass().getClassLoader());
        TikaConfig config;
       
        // Without a classloader set, normal one will be used
        config = new TikaConfig();
        config.getMediaTypeRegistry();
        config.getParser();
        assertEquals(0, customLoader.getLoadedResources().size());
       
        // With a classloader set, resources will come through it
        config = new TikaConfig(customLoader);
        config.getMediaTypeRegistry();
        config.getParser();
       
        Map<String,List<URL>> resources = customLoader.getLoadedResources();
        int resourcesCount = resources.size();
        assertTrue(
                "Not enough things used the classloader, found only " + resourcesCount,
                resourcesCount > 3
        );
View Full Code Here

TOP

Related Classes of org.apache.tika.ResourceLoggingClassLoader

Copyright © 2018 www.massapicom. 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.