Package org.jboss.virtual

Examples of org.jboss.virtual.VFS


   public void testVisitAllChildrenIOException() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContextWithChildren();
      context.getMockRoot().setIOException("getChildren");
     
      VFS vfs = VFS.getVFS(context.getRootURI());
      MockVirtualFileFilter filter = new MockVirtualFileFilter();
      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter);
      try
      {
         vfs.visit(visitor);
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IOException.class, t);
View Full Code Here


   }
  
   public void testToString() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      VFS vfs = context.getVFS();
     
      assertEquals(context.toString(), vfs.toString());
   }
View Full Code Here

   }
  
   public void testHashCode() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      VFS vfs = context.getVFS();
     
      assertEquals(context.hashCode(), vfs.hashCode());
   }
View Full Code Here

   public void testEquals() throws Exception
   {
      MockVFSContext context1 = createSimpleVFSContext();
      MockVFSContext context2 = createSimpleVFSContext();
     
      VFS vfs1 = context1.getVFS();
      VFS vfs2 = context2.getVFS();

      assertEquals(vfs1, vfs2);
     
      MockVFSContext context3 = createSimple2VFSContext();
      VFS vfs3 = context3.getVFS();

      assertFalse(vfs1.equals(vfs3));
      assertFalse(vfs2.equals(vfs3));

      assertFalse(vfs1.equals(null));
View Full Code Here

   {
   }

   public static VirtualFile resolveCachedVirtualFile(URL vfsurl, String relativePath) throws IOException
   {
      VFS vfs = urlCache.get(vfsurl);
      if (vfs == null)
      {
         vfs = VFS.getVFS(vfsurl);
         urlCache.put(vfsurl, vfs);
      }
      else
      {
         // if the root of VFS has changed on disk, lets purge it
         // this is important for Jar files as we don't want stale jars as the
         // root of the VFS (i.e., on redeployment)
         if (vfs.getRoot().getHandler().hasBeenModified())
         {
            vfs = VFS.getVFS(vfsurl);
            urlCache.put(vfsurl, vfs);
         }
      }
      return vfs.findChild(relativePath);

   }
View Full Code Here

   }

   public static VirtualFile resolveVirtualFile(URL vfsurl, String relativePath) throws IOException
   {
      VFS vfs = VFS.getVFS(vfsurl);
      return vfs.findChild(relativePath);
   }
View Full Code Here

      {
        cache.setPermanentRoots(Collections.<URL, ExceptionHandler>singletonMap(dir, null));
        cache.start();
       
        URL sub = new URL(resourceName);
        VFS dirVFS = VFS.getVFS(dir);

        VirtualFile rootFile = VFS.getRoot(dir);
        System.out.println(rootFile);

        VirtualFile subFile1 = VFS.getRoot(sub);
View Full Code Here

         }
         cache.setPermanentRoots(Collections.<URL, ExceptionHandler>singletonMap(rootURL, null));
         cache.start();

         // setup VFS
         VFS vfs = VFS.getVFS(rootURL);
         VFSUtils.enableCopy(vfs);
         TrackingTempStore store = new TrackingTempStore(new MockTempStore(new Random().nextLong()));
         vfs.setTempStore(store);

         try
         {
            URL directRootURL = new URL("file://" + rootText);
            VirtualFile root = VFS.getRoot(directRootURL);
View Full Code Here

   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
   {
      URL url = rootUrl;
      if (url == null)
      {
         VFS vfs = getFile().getVFS();
         url = vfs.getRoot().toURL();
      }
      String pathName = path;
      if (pathName == null)
         pathName = getFile().getPathName();
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

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.