Package com.hp.hpl.jena.util

Examples of com.hp.hpl.jena.util.FileManager


   
    public void testUsesFileManager()
        {
        Resource root = resourceInModel( "x rdf:type ja:DocumentManager; x ja:fileManager f" );
        Assembler a = new DocumentManagerAssembler();
        FileManager fm = new FileManager();
        Assembler mock = new NamedObjectAssembler( resource( "f" ), fm );
        Object x = a.open( mock, root );
        assertInstanceOf( OntDocumentManager.class, x );
        assertSame( fm, ((OntDocumentManager) x).getFileManager() );
        }
View Full Code Here


       
        if ( cmdLine.contains(lmapDecl) )
        {
            String lmapFile = cmdLine.getValue(lmapDecl) ;
            LocationMapper locMap = new LocationMapper(lmapFile) ;
            fileManager = new FileManager(locMap) ;
        }
    }
View Full Code Here

    }


    public void testFileManagerNoFile()
    {
        FileManager fileManager = new FileManager() ;
        fileManager.addLocatorFile() ;
        try {
            // Tests either way round - exception or a null return.
            InputStream in = fileManager.open(filenameNonExistent) ;
            closeInputStream(in) ;
            assertNull("Found non-existant file: "+filenameNonExistent, in) ;
        } catch (NotFoundException ex) {}
    }
View Full Code Here

        } catch (NotFoundException ex) {}
    }
   
    public void testFileManagerLocatorClassLoader()
    {
        FileManager fileManager = new FileManager() ;
        fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader()) ;
        InputStream in = fileManager.open("java/lang/String.class") ;
        assertNotNull(in) ;
        closeInputStream(in) ;
    }
View Full Code Here

        closeInputStream(in) ;
    }

    public void testFileManagerLocatorClassLoaderNotFound()
    {
        FileManager fileManager = new FileManager() ;
        fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader()) ;
        try {
            InputStream in = fileManager.open("not/java/lang/String.class") ;
            closeInputStream(in) ;
            assertNull("Found non-existant class", in) ;
        } catch (NotFoundException ex) {}
    }
View Full Code Here

        } catch (NotFoundException ex) {}
    }

    public void testFileManagerLocatorZip()
    {
        FileManager fileManager = new FileManager() ;
        try {
            fileManager.addLocatorZip(zipname) ;
        } catch (Exception ex)
        {
           fail("Failed to create a filemanager and add a zip locator") ;
        }
        InputStream in = fileManager.open(filename) ;
        assertNotNull(in) ;
        closeInputStream(in) ;
    }
View Full Code Here

        closeInputStream(in) ;
    }

    public void testFileManagerLocatorZipNonFound()
    {
        FileManager fileManager = new FileManager() ;
        try {
            fileManager.addLocatorZip(zipname) ;
        } catch (Exception ex)
        { fail("Failed to create a filemanager and add a zip locator") ; }
        try {
            InputStream in = fileManager.open(filenameNonExistent) ;
            closeInputStream(in) ;
            assertNull("Found non-existant zip file member", in) ;
        } catch (NotFoundException ex) {}
    }
View Full Code Here

        } catch (NotFoundException ex) {}
    }
   
    public void testFileManagerClone()
    {
        FileManager fileManager1 = new FileManager() ;
        FileManager fileManager2 = new FileManager(fileManager1) ;
       
        // Should not affect fileManager2
        fileManager1.addLocatorFile() ;
        {
            InputStream in = fileManager1.open(testingDir+"/"+filename) ;
            assertNotNull(in) ;
            closeInputStream(in) ;
        }
        // Should not work.
        try {
            InputStream in = fileManager2.open(testingDir+"/"+filename) ;
            closeInputStream(in) ;
            assertNull("Found file via wrong FileManager", in) ;
        } catch (NotFoundException ex) {}
    }
View Full Code Here

   
   
    public void testLocationMappingURLtoFileOpen()
    {
        LocationMapper locMap = new LocationMapper(TestLocationMapper.mapping) ;
        FileManager fileManager = new FileManager(locMap) ;
        fileManager.addLocatorFile() ;
        InputStream in = fileManager.open("http://example.org/file") ;
        assertNotNull(in) ;
        closeInputStream(in) ;
    }
View Full Code Here

    public void testFollowOwlImports()
        {
        final Model modelToLoad = model( "this hasMarker B5" );
        Model  m = model( "x ja:reasoner y; _x owl:imports eh:/loadMe" );
        FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad );
        Model m2 = new ImportManager().withImports( fm, m );
        assertInstanceOf( MultiUnion.class, m2.getGraph() );
        assertIsoModels( modelToLoad.union( m ), m2 );
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.util.FileManager

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.