Examples of MockVFSContext


Examples of org.jboss.test.virtual.support.MockVFSContext

   }

   public void testOpenStream() throws Exception
   {
      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);
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      assertTrue(Arrays.equals(bytes, buffer));
   }

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      try
      {
         file.openStream();
         fail("Should not be here");
      }
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      }
   }

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      try
      {
         file.openStream();
         fail("Should not be here");
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

   }

   public void testCloseStreams() throws Exception
   {
      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();
      assertEquals(1, stream.read());
     
      file.closeStreams();
      assertEquals(-1, stream.read());
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

   }

   public void testCloseStreamViaClose() throws Exception
   {
      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();
      assertEquals(1, stream.read());
     
      file.close();
      assertEquals(-1, stream.read());
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      assertEquals(-1, stream.read());
   }

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
   }
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      file.close();
   }
  
   public void testCloseDuplicate() throws Exception
   {
      MockVFSContext context = registerSimpleVFSContext();

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      file.close();
   }
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      file.close();
   }

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertEquals(context.getVFS(), file.getVFS());
   }
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

      assertEquals(context.getVFS(), file.getVFS());
   }

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      try
      {
         file.getVFS();
         fail("Should not be here");
View Full Code Here

Examples of org.jboss.test.virtual.support.MockVFSContext

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

      VirtualFile file = VFS.getRoot(context.getRootURI());
      assertNull(file.getParent());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.