Package org.jboss.virtual

Examples of org.jboss.virtual.VFS


  
   public void testGetVFS() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      URI rootURI = context.getRootURI();
      VFS vfs = context.getVFS();
      VirtualFile rootFile = vfs.getRoot();
     
      assertEquals(new URI("vfs" + rootURI), rootFile.toURI());
   }
View Full Code Here


   public void testGetRoot() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      URI rootURI = context.getRootURI();
      VirtualFileHandler rootHandler = context.getRoot();
      VFS vfs = context.getVFS();
      VirtualFile rootFile = vfs.getRoot();
     
      assertEquals(rootURI, rootHandler.toURI());
      assertEquals(rootHandler.getVirtualFile(), rootFile);
   }
View Full Code Here

  
   public void testArchive2() throws Exception
   {
      URL url = getResource("/vfs/sundry/jar/archive.jar");
      url = JarUtils.createJarURL(url);
      VFS vfs = VFS.getVFS(url);
      VirtualFile file = vfs.getRoot();
      log.debug(file.getName() + " " + file);
      assertFalse("Should not be a leaf", file.isLeaf());
      file = file.findChild("empty");
      log.debug(file.getName() + " " + file);
   }
View Full Code Here

      testVisit(context, visitor, expected);
   }
  
   protected void testVisit(MockVFSContext context, MockVirtualFileVisitor visitor, HashSet<String> expected) throws Exception
   {
      VFS vfs = context.getVFS();
      vfs.visit(visitor);
     
      HashSet<String> actual = new HashSet<String>();
      for (VirtualFile file : visitor.getVisited())
         actual.add(file.getPathName());
      assertEquals(expected, actual);
View Full Code Here

   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
   {
      URL url = rootUrl;
      if (url == null)
      {
         VFS vfs = getRoot().getVFS();
         url = vfs.getRoot().toURL();
      }
      String pathName = path;
      if (pathName == null)
         pathName = getRoot().getPathName();
View Full Code Here

   public void testGetVFSURI() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      MockVFSContext context2 = registerSimple2VFSContext();
     
      VFS vfs = VFS.getVFS(context.getRootURI());
      assertNotNull(vfs);
      assertEquals(context.getVFS(), vfs);
     
      VFS vfs2 = VFS.getVFS(context2.getRootURI());
      assertNotNull(vfs2);
      assertEquals(context2.getVFS(), vfs2);
   }
View Full Code Here

   public void testGetVFSURL() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      MockVFSContext context2 = registerSimple2VFSContext();
     
      VFS vfs = VFS.getVFS(context.getRootURL());
      assertNotNull(vfs);
      assertEquals(context.getVFS(), vfs);
     
      VFS vfs2 = VFS.getVFS(context2.getRootURL());
      assertNotNull(vfs2);
      assertEquals(context2.getVFS(), vfs2);
   }
View Full Code Here

   public void testGetRoot() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
     
      VFS vfs = VFS.getVFS(context.getRootURI());
      assertNotNull(vfs);

      VirtualFile root = vfs.getRoot();
      assertNotNull(root);
     
      assertEquals(context.getRoot().getVirtualFile(), root);
   }
View Full Code Here

   public void testGetRootIOException() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.setIOException("getRoot");
     
      VFS vfs = VFS.getVFS(context.getRootURI());
      assertNotNull(vfs);

      try
      {
         vfs.getRoot();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IOException.class, t);
View Full Code Here

   public void testFindChildRoot() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setLeaf(false);
     
      VFS vfs = VFS.getVFS(context.getRootURI());
     
      assertFindChild(vfs, "", vfs.getRoot());
   }
View Full Code Here

TOP

Related Classes of org.jboss.virtual.VFS

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.