[jboss-cvs] JBossAS SVN: r57284 - in projects/microcontainer/trunk/container/src: main/org/jboss/virtual/plugins/context resources/tests/vfs resources/tests/vfs/context resources/tests/vfs/context/file resources/tests/vfs/context/file/archive.jar resources/tests/vfs/context/file/children resources/tests/vfs/context/file/complex resources/tests/vfs/context/file/complex/subfolder resources/tests/vfs/context/file/simple resources/tests/vfs/context/jar tests/org/jboss/test/virtual/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 29 08:20:32 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-29 08:20:20 -0400 (Fri, 29 Sep 2006)
New Revision: 57284

Added:
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/archive.jar/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/archive.jar/child
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child1
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child2
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child3
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/child
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/subfolder/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/subfolder/subchild
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/simple/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/simple/child
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/archive.jar
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/children.jar
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/complex.jar
   projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/simple.jar
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSContextTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVFSContextUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVirtualFileHandlerUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVirtualFileHandlerUnitTestCase.java
Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/VFSAllTestSuite.java
Log:
Make a start on systematic tests of the VFS implementations.

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -287,7 +287,7 @@
       buffer.append('@');
       buffer.append(System.identityHashCode(this));
       buffer.append("[path=").append(getPathName());
-      buffer.append(" context=").append(getVFSContext().getRootURI());
+      buffer.append(" context=").append(context.getRootURI());
       buffer.append(" real=").append(safeToURLString());
       buffer.append(']');
       return buffer.toString();

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/archive.jar/child
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/archive.jar/child	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/archive.jar/child	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child1
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child1	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child1	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child2
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child2	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child2	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child3
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child3	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/children/child3	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/child
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/child	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/child	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/subfolder/subchild
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/subfolder/subchild	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/complex/subfolder/subchild	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/simple/child
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/simple/child	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/resources/tests/vfs/context/file/simple/child	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1 @@
+empty
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/archive.jar
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/archive.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/children.jar
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/children.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/complex.jar
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/complex.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/simple.jar
===================================================================
(Binary files differ)


Property changes on: projects/microcontainer/trunk/container/src/resources/tests/vfs/context/jar/simple.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSContextTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSContextTest.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSContextTest.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,200 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractVFSContextTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVFSContextTest extends AbstractVFSTest
+{
+   public AbstractVFSContextTest(String name)
+   {
+      super(name);
+   }
+   
+   protected abstract VFSContext getVFSContext(String name) throws Exception;
+
+   /* TODO URI testing
+   public void testRootURI() throws Exception
+   {
+   }
+   */
+   
+   public void testGetVFS() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      URI rootURI = context.getRootURI();
+      VFS vfs = context.getVFS();
+      VirtualFile rootFile = vfs.getRoot();
+      
+      assertEquals(rootURI, rootFile.toURI());
+   }
+   
+   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);
+   }
+   
+   /* TODO getOptions
+   public void testGetOptions() throws Exception
+   {
+   }
+   */
+   
+   public void testGetChildren() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      List<VirtualFileHandler> children = context.getChildren(root, false);
+      
+      Set<String> expected = new HashSet<String>();
+      expected.add("child1");
+      expected.add("child2");
+      expected.add("child3");
+
+      Set<String> actual = new HashSet<String>();
+      for (VirtualFileHandler child : children)
+      {
+         if (child.getName().startsWith("META-INF") == false)
+            actual.add(child.getName());
+      }
+      
+      assertEquals(expected, actual);
+   }
+
+   public void testGetChildrenNullFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      try
+      {
+         context.getChildren(null, false);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildRoot() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.findChild(root, "");
+      assertEquals(root, found);
+   }
+
+   public void testFindChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.findChild(root, "child");
+      assertEquals("child", found.getPathName());
+   }
+
+   public void testFindChildSubFolder() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.findChild(root, "subfolder");
+      assertEquals("subfolder", found.getPathName());
+   }
+
+   public void testFindChildSubChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = context.findChild(root, "subfolder/subchild");
+      assertEquals("subfolder/subchild", found.getPathName());
+   }
+
+   public void testFindChildDoesNotExist() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         context.findChild(root, "doesnotexist");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowableTemp(IOException.class, t);
+      }
+   }
+
+   public void testFindChildNullFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      try
+      {
+         context.findChild(null, "");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         context.findChild(root, null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   /* TODO visit
+   public void testVisit() throws Exception
+   {
+   }
+   */
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSTest.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVFSTest.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.net.URL;
+
+import junit.framework.AssertionFailedError;
+
+import org.jboss.test.BaseTestCase;
+
+/**
+ * AbstractVFSTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVFSTest extends BaseTestCase
+{
+   public AbstractVFSTest(String name)
+   {
+      super(name);
+   }
+   
+   // TODO move to AbstractTestCase
+   public URL getResource(String name)
+   {
+      URL url = super.getResource(name);
+      assertNotNull("Resource not found: " + name, url);
+      return url;
+   }
+
+   protected <T> void checkThrowableTemp(Class<T> expected, Throwable throwable)
+   {
+      if (expected == null)
+         fail("Must provide an expected class");
+      if (throwable == null)
+         fail("Must provide a throwable for comparison");
+      if (throwable instanceof AssertionFailedError || throwable instanceof AssertionError)
+         throw (Error) throwable;
+      // TODO move to AbstractTestCase if (expected.equals(throwable.getClass()) == false)
+      if (expected.isAssignableFrom(throwable.getClass()) == false)
+      {
+         getLog().error("Unexpected throwable", throwable);
+         fail("Unexpected throwable: " + throwable);
+      }
+      else
+      {
+         getLog().debug("Got expected " + expected.getName() + "(" + throwable + ")");
+      }
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,600 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * AbstractVirtualFileHandlerTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractVirtualFileHandlerTest extends AbstractVFSTest
+{
+   public AbstractVirtualFileHandlerTest(String name)
+   {
+      super(name);
+   }
+   
+   protected abstract VFSContext getVFSContext(String name) throws Exception;
+
+   protected String getRootName(String name) throws Exception
+   {
+      return name;
+   }
+   
+   protected abstract long getRealLastModified(String name, String path) throws Exception;
+   
+   protected abstract long getRealSize(String name, String path) throws Exception;
+   
+   public void testRootName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      String rootName = getRootName("complex");
+      assertEquals(rootName, root.getName());
+   }
+
+   public void testChildName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertEquals("child", child.getName());
+   }
+
+   public void testSubFolderName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder");
+      assertEquals("subfolder", child.getName());
+   }
+
+   public void testSubChildName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+      assertTrue(child.getName().endsWith("subchild"));
+   }
+   
+   public void testRootPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      assertEquals("", root.getPathName());
+   }
+
+   public void testChildPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertEquals("child", child.getPathName());
+   }
+
+   public void testSubFolderPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder");
+      assertEquals("subfolder", child.getPathName());
+   }
+
+   public void testSubChildPathName() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+      assertEquals("subfolder/subchild", child.getPathName());
+   }
+
+   /* TODO URI testing
+   public void testToURI() throws Exception
+   {
+   }
+   */
+
+   /* TODO URL testing
+   public void testToURL() throws Exception
+   {
+   }
+   */
+   
+   public void testRootLastModified() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      long realLastModified = getRealLastModified("simple", null);
+      assertEquals(realLastModified, root.getLastModified());
+   }
+   
+   public void testChildLastModified() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      long realLastModified = getRealLastModified("simple", "child");
+      assertEquals(realLastModified, child.getLastModified());
+   }
+
+   public void testGetLastModifiedClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getLastModified();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testRootSize() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      long realSize = getRealSize("simple", null);
+      assertEquals(realSize, root.getSize());
+   }
+   
+   public void testChildSize() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      long realSize = getRealSize("simple", "child");
+      assertEquals(realSize, child.getSize());
+   }
+
+   public void testGetSizeClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getSize();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   public void testRootIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      assertFalse(root.isLeaf());
+   }
+
+   public void testChildIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertTrue(child.isLeaf());
+   }
+
+   public void testSubFolderIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder");
+      assertFalse(child.isLeaf());
+   }
+
+   public void testSubChildIsLeaf() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+      assertTrue(child.isLeaf());
+   }
+
+   public void testIsLeafClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.isLeaf();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testRootIsArchive() throws Exception
+   {
+      VFSContext context = getVFSContext("archive.jar");
+      VirtualFileHandler root = context.getRoot();
+      assertTrue(root.isArchive());
+   }
+
+   public void testChildIsArchive() throws Exception
+   {
+      VFSContext context = getVFSContext("archive.jar");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertFalse(child.isArchive());
+   }
+
+   public void testIsArchiveClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.isArchive();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+   
+   // TODO how to test a real hidden file across platforms?
+   public void testRootIsHidden() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      assertFalse(root.isHidden());
+   }
+   
+   // TODO how to test a real hidden file across platforms?
+   public void testChildIsHidden() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertFalse(child.isHidden());
+   }
+
+   public void testIsHiddenClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.isHidden();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testOpenStream() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      InputStream stream = child.openStream();
+      try
+      {
+         byte[] contents = new byte[10];
+         int read = stream.read(contents);
+         int total = 0;
+         while (read != -1)
+         {
+            total += read;
+            read = stream.read(contents, total, 10-total);
+         }
+         assertEquals(5, total);
+         assertTrue(Arrays.equals("empty\0\0\0\0\0".getBytes(), contents));
+      }
+      finally
+      {
+         stream.close();
+      }
+   }
+
+   public void testOpenStreamClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.openStream();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testRootParent() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      assertNull(root.getParent());
+   }
+   
+   public void testChildParent() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      assertEquals(root, child.getParent());
+   }
+
+   public void testgetParentClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getParent();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetChildren() throws Exception
+   {
+      VFSContext context = getVFSContext("children");
+      VirtualFileHandler root = context.getRoot();
+      List<VirtualFileHandler> children = root.getChildren(false);
+      
+      Set<String> expected = new HashSet<String>();
+      expected.add("child1");
+      expected.add("child2");
+      expected.add("child3");
+
+      Set<String> actual = new HashSet<String>();
+      for (VirtualFileHandler child : children)
+      {
+         if (child.getName().startsWith("META-INF") == false)
+            actual.add(child.getName());
+      }
+      
+      assertEquals(expected, actual);
+   }
+
+   public void testGetChildrenClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getChildren(false);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testFindChildRoot() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.findChild("");
+      assertEquals(root, found);
+   }
+
+   public void testFindChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.findChild("child");
+      assertEquals("child", found.getPathName());
+   }
+
+   public void testFindChildSubFolder() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.findChild("subfolder");
+      assertEquals("subfolder", found.getPathName());
+   }
+
+   public void testFindChildSubChild() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler found = root.findChild("subfolder/subchild");
+      assertEquals("subfolder/subchild", found.getPathName());
+   }
+
+   public void testFindChildDoesNotExist() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         root.findChild("doesnotexist");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowableTemp(IOException.class, t);
+      }
+   }
+
+   public void testFindChildNullPath() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      try
+      {
+         root.findChild(null);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalArgumentException.class, t);
+      }
+   }
+
+   public void testFindChildClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.findChild("");
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   public void testGetVFSContext() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler handler = context.getRoot();
+      assertEquals(context, handler.getVFSContext());
+   }
+
+   public void testGetVFSContextClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getVFSContext();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+  
+   public void testRootGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      checkVirtualFile(root);
+   }
+
+   public void testChildGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      checkVirtualFile(child);
+   }
+
+   public void testSubFolderGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder");
+      checkVirtualFile(child);
+   }
+
+   public void testSubChildGetVirtualFile() throws Exception
+   {
+      VFSContext context = getVFSContext("complex");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+      checkVirtualFile(child);
+   }
+
+   public void testGetVirtualFileClosed() throws Exception
+   {
+      VFSContext context = getVFSContext("simple");
+      VirtualFileHandler root = context.getRoot();
+      VirtualFileHandler child = context.findChild(root, "child");
+      child.close();
+      try
+      {
+         child.getVirtualFile();
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(IllegalStateException.class, t);
+      }
+   }
+
+   protected void checkVirtualFile(VirtualFileHandler handler) throws Exception
+   {
+      VirtualFile file = handler.getVirtualFile();
+      
+      assertEquals(handler.getVFSContext().getVFS(), file.getVFS());
+      assertEquals(handler.getName(), file.getName());
+      assertEquals(handler.getPathName(), file.getPathName());
+      assertEquals(handler.isArchive(), file.isArchive());
+      assertEquals(handler.isHidden(), file.isHidden());
+      assertEquals(handler.isLeaf(), file.isLeaf());
+      assertEquals(handler.getLastModified(), file.getLastModified());
+      assertEquals(handler.getSize(), file.getSize());
+      assertEquals(handler.toURI(), file.toURI());
+      assertEquals(handler.toURL(), file.toURL());
+      
+      VirtualFileHandler parent = handler.getParent();
+      if (parent == null)
+         assertNull(file.getParent());
+      else
+         assertEquals(parent.getVirtualFile(), file.getParent());
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVFSContextUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVFSContextUnitTestCase.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVFSContextUnitTestCase.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.virtual.plugins.context.file.FileSystemContext;
+import org.jboss.virtual.spi.VFSContext;
+
+/**
+ * FileVFSContextUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class FileVFSContextUnitTestCase extends AbstractVFSContextTest
+{
+   public FileVFSContextUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(FileVFSContextUnitTestCase.class);
+   }
+
+   protected VFSContext getVFSContext(String name) throws Exception
+   {
+      URL url = getResource("/vfs/context/file/" + name + "/");
+      return new FileSystemContext(url);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVirtualFileHandlerUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVirtualFileHandlerUnitTestCase.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/FileVirtualFileHandlerUnitTestCase.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,82 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.virtual.plugins.context.file.FileSystemContext;
+import org.jboss.virtual.spi.VFSContext;
+
+/**
+ * FileVirtualFileHandlerUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class FileVirtualFileHandlerUnitTestCase extends AbstractVirtualFileHandlerTest
+{
+   public FileVirtualFileHandlerUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(FileVirtualFileHandlerUnitTestCase.class);
+   }
+
+   protected URL getRootResource(String name) throws Exception
+   {
+      return getResource("/vfs/context/file/" + name + "/");
+   }
+   
+   protected File getRealFile(String name, String path) throws Exception
+   {
+      URL url = getRootResource(name);
+      if (path != null)
+         url = new URL(url, path);
+      File file = new File(url.getPath());
+      return file;
+   }
+   
+   protected VFSContext getVFSContext(String name) throws Exception
+   {
+      URL url = getRootResource(name);
+      return new FileSystemContext(url);
+   }
+
+   protected long getRealLastModified(String name, String path) throws Exception
+   {
+      File file = getRealFile(name, path);
+      return file.lastModified();
+   }
+
+   protected long getRealSize(String name, String path) throws Exception
+   {
+      File file = getRealFile(name, path);
+      return file.length();
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVFSContextUnitTestCase.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.virtual.plugins.context.jar.JarContext;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.spi.VFSContext;
+
+/**
+ * JARVFSContextUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARVFSContextUnitTestCase extends AbstractVFSContextTest
+{
+   public JARVFSContextUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(JARVFSContextUnitTestCase.class);
+   }
+
+   protected VFSContext getVFSContext(String name) throws Exception
+   {
+      URL url = getResource("/vfs/context/jar/" + name + ".jar");
+      url = JarUtils.createJarURL(url);
+      return new JarContext(url);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVirtualFileHandlerUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVirtualFileHandlerUnitTestCase.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/JARVirtualFileHandlerUnitTestCase.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -0,0 +1,119 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.virtual.test;
+
+import java.io.File;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.virtual.plugins.context.jar.JarContext;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.spi.VFSContext;
+
+/**
+ * JARVirtualFileHandlerUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JARVirtualFileHandlerUnitTestCase extends AbstractVirtualFileHandlerTest
+{
+   public JARVirtualFileHandlerUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return new TestSuite(JARVirtualFileHandlerUnitTestCase.class);
+   }
+   
+   protected URL getRootResource(String name) throws Exception
+   {
+      if (name.endsWith(".jar"))
+         return getResource("/vfs/context/jar/" + name);
+      else
+         return getResource("/vfs/context/jar/" + name + ".jar");
+   }
+   
+   protected File getRealJarFile(String name) throws Exception
+   {
+      URL url = getRootResource(name);
+      File file = new File(url.getPath());
+      return file;
+   }
+   
+   protected JarEntry getRealJarEntry(String name, String path) throws Exception
+   {
+      URL url = getRootResource(name);
+      url = JarUtils.createJarURL(url);
+      JarURLConnection c = (JarURLConnection) url.openConnection();
+      JarFile jarFile = c.getJarFile();
+      JarEntry entry = jarFile.getJarEntry(path);
+      return entry;
+   }
+   
+   protected VFSContext getVFSContext(String name) throws Exception
+   {
+      URL url = getRootResource(name);
+      url = JarUtils.createJarURL(url);
+      return new JarContext(url);
+   }
+
+   protected String getRootName(String name) throws Exception
+   {
+      return name + ".jar";
+   }
+
+   protected long getRealLastModified(String name, String path) throws Exception
+   {
+      if (path != null)
+      {
+         JarEntry entry = getRealJarEntry(name, path);
+         return entry.getTime();
+      }
+      else
+      {
+         File file = getRealJarFile(name);
+         return file.lastModified();
+      }
+   }
+
+   protected long getRealSize(String name, String path) throws Exception
+   {
+      if (path != null)
+      {
+         JarEntry entry = getRealJarEntry(name, path);
+         return entry.getSize();
+      }
+      else
+      {
+         File file = getRealJarFile(name);
+         return file.length();
+      }
+   }
+}

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/VFSAllTestSuite.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/VFSAllTestSuite.java	2006-09-29 10:52:50 UTC (rev 57283)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/VFSAllTestSuite.java	2006-09-29 12:20:20 UTC (rev 57284)
@@ -46,6 +46,10 @@
       suite.addTest(VirtualFileUnitTestCase.suite());
       suite.addTest(FileVFSUnitTestCase.suite());
       suite.addTest(SundryVFSUnitTestCase.suite());
+      suite.addTest(FileVFSContextUnitTestCase.suite());
+      suite.addTest(FileVirtualFileHandlerUnitTestCase.suite());
+      suite.addTest(JARVFSContextUnitTestCase.suite());
+      suite.addTest(JARVirtualFileHandlerUnitTestCase.suite());
       
       return suite;
    }




More information about the jboss-cvs-commits mailing list