Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile


   public void testIsLeafClosed() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      try
      {
         file.isLeaf();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalStateException.class, t);
View Full Code Here


   public void testIsHidden() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setHidden(true);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertEquals(true, file.isHidden());

      context.getMockRoot().setHidden(false);
      assertEquals(false, file.isHidden());
   }
View Full Code Here

   public void testIsHiddenIOException() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setIOException("isHidden");

      VirtualFile file = VFS.getRoot(context.getRootURI());
      try
      {
         file.isHidden();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IOException.class, t);
View Full Code Here

   public void testIsHiddenClosed() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      try
      {
         file.isHidden();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalStateException.class, t);
View Full Code Here

   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

   {
      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

            entry = new ClassPathEntry(fentry, rootLength);
         file = fentry;
      }
      else if( vfIter != null )
      {
         VirtualFile fentry = vfIter.getNextEntry();
         if( fentry != null )
            entry = new ClassPathEntry(fentry, rootLength);
         vf = fentry;
      }
View Full Code Here

      }

      VirtualFile getNextEntry()
         throws IOException
      {
         VirtualFile next = null;
         if( index >= currentListing.size() && subDirectories.size() > 0 )
         {
            do
            {
               VirtualFile nextDir = subDirectories.removeFirst();
               currentListing = nextDir.getChildren(filter);
            } while( currentListing.size() == 0 && subDirectories.size() > 0 );
            index = 0;
         }
         if( index < currentListing.size() )
         {
View Full Code Here

      String host = u.getHost();
      MemoryContext ctx = MemoryContextFactory.getInstance().find(host);
      if (ctx == null)
         throw new IOException("vfs does not exist: " + u.toString());

      VirtualFile vf = ctx.getChild(ctx.getRoot(), u.getPath()).getVirtualFile();
      if (vf == null)
         throw new IOException("vfs does not exist: " + u.toString());

      return new VirtualFileURLConnection(u, vf);
   }
View Full Code Here

   {
      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setStream(bytes);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      InputStream stream = file.openStream();
      byte[] buffer = new byte[bytes.length];
      stream.read(buffer);
     
      assertTrue(stream.read() == -1);
      assertTrue(Arrays.equals(bytes, buffer));
View Full Code Here

TOP

Related Classes of org.jboss.virtual.VirtualFile

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.