Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile


   public void testToURI() throws Exception
   {
      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
      URI uri = context.getRootURI();
      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
     
      VirtualFile root = VFS.getRoot(uri);
      assertEquals(uri, root.toURI());

      VirtualFile found1 = root.findChild("child1");
      assertEquals(child1.toURI(), found1.toURI());

      VirtualFile found11 = root.findChild("child1/child1,1");
      assertEquals(child11.toURI(), found11.toURI());
   }
View Full Code Here


   public void testToURL() throws Exception
   {
      MockVFSContext context = registerStructuredVFSContextWithSubChildren();
      URL url = context.getRootURL();
      VirtualFile child1 = getChildHandler(context, "child1").getVirtualFile();
      VirtualFile child11 = getChildHandler(context, "child1/child1,1").getVirtualFile();
     
      VirtualFile root = VFS.getRoot(url);
      assertEquals(url, root.toURL());

      VirtualFile found1 = root.findChild("child1");
      assertEquals(child1.toURL(), found1.toURL());

      VirtualFile found11 = root.findChild("child1/child1,1");
      assertEquals(child11.toURL(), found11.toURL());
   }
View Full Code Here

   public void testGetLastModfied() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setLastModified(12345l);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertEquals(12345l, file.getLastModified());

      context.getMockRoot().setLastModified(67890l);
      assertEquals(67890l, file.getLastModified());
   }
View Full Code Here

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

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

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

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

   public void testGetSize() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setSize(12345l);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertEquals(12345l, file.getSize());

      context.getMockRoot().setSize(67890l);
      assertEquals(67890l, file.getSize());
   }
View Full Code Here

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

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

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

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

   public void testIsLeaf() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setLeaf(false);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertEquals(false, file.isLeaf());

      context.getMockRoot().setLeaf(true);
      assertEquals(true, file.isLeaf());
   }
View Full Code Here

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      try
      {
         file.isLeaf();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IOException.class, t);
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.