[jboss-cvs] JBossAS SVN: r67243 - in projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 19 05:37:14 EST 2007


Author: alesj
Date: 2007-11-19 05:37:14 -0500 (Mon, 19 Nov 2007)
New Revision: 67243

Modified:
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
   projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
Log:
Simplyfy VirtualFile creation - to get past mvn test - since that's not what we're testing. ;-)

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java	2007-11-19 08:33:56 UTC (rev 67242)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java	2007-11-19 10:37:14 UTC (rev 67243)
@@ -21,8 +21,6 @@
 */
 package org.jboss.test.deployers.vfs.structure.file.support;
 
-import java.net.URI;
-
 import org.jboss.deployers.vfs.plugins.structure.file.FileMatcher;
 import org.jboss.virtual.VirtualFile;
 
@@ -35,9 +33,8 @@
    {
       try
       {
-         URI uri = file.toURI();
-         String toString = uri.toString();
-         return toString.endsWith(".bsh/");
+         String toString = file.getName();
+         return toString.endsWith(".bsh");
       }
       catch (Exception e)
       {

Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java	2007-11-19 08:33:56 UTC (rev 67242)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java	2007-11-19 10:37:14 UTC (rev 67243)
@@ -21,7 +21,13 @@
 */
 package org.jboss.test.deployers.vfs.structure.file.test;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -35,8 +41,9 @@
 import org.jboss.test.BaseTestCase;
 import org.jboss.test.deployers.vfs.structure.file.support.BshFileMatcher;
 import org.jboss.test.deployers.vfs.structure.file.support.TmpFileStructure;
-import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
 
 /**
  * FileMatcherTestCase.
@@ -55,6 +62,11 @@
       super(name);
    }
 
+   protected VirtualFile getVirtualFile() throws Throwable
+   {
+      return new MyVirtualFile();
+   }
+
    public void testMatcher() throws Throwable
    {
       BasicBootstrap bootstrap = new BasicBootstrap();
@@ -69,7 +81,7 @@
          TmpFileStructure fs = (TmpFileStructure)fsCC.getTarget();
          assertNotNull(fs);
 
-         VirtualFile file = VFS.getRoot(new URI("vfsmemory://somefile.bsh"));
+         VirtualFile file = getVirtualFile();
          assertFalse(fs.checkFileMatchers(file));
 
          BeanMetaData fmMD = new AbstractBeanMetaData("bshFileMatcher", BshFileMatcher.class.getName());
@@ -86,4 +98,113 @@
          controller.shutdown();
       }
    }
+
+   private static class MyVirtualFile extends VirtualFile
+   {
+      public MyVirtualFile()
+      {
+         super(getVirtualFileHandler());
+      }
+
+      private static VirtualFileHandler getVirtualFileHandler()
+      {
+         return new VirtualFileHandler()
+         {
+            public String getName()
+            {
+               return null;
+            }
+
+            public String getPathName()
+            {
+               return null;
+            }
+
+            public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+            {
+               return null;
+            }
+
+            public URI toURI() throws URISyntaxException
+            {
+               return null;
+            }
+
+            public URL toURL() throws MalformedURLException, URISyntaxException
+            {
+               return null;
+            }
+
+            public long getLastModified() throws IOException
+            {
+               return 0;
+            }
+
+            public boolean hasBeenModified() throws IOException
+            {
+               return false;
+            }
+
+            public long getSize() throws IOException
+            {
+               return 0;
+            }
+
+            public boolean exists() throws IOException
+            {
+               return false;
+            }
+
+            public boolean isLeaf() throws IOException
+            {
+               return false;
+            }
+
+            public boolean isHidden() throws IOException
+            {
+               return false;
+            }
+
+            public InputStream openStream() throws IOException
+            {
+               return null;
+            }
+
+            public VirtualFileHandler getParent() throws IOException
+            {
+               return null;
+            }
+
+            public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
+            {
+               return null;
+            }
+
+            public VirtualFileHandler findChild(String path) throws IOException
+            {
+               return null;
+            }
+
+            public VFSContext getVFSContext()
+            {
+               return null;
+            }
+
+            public VirtualFile getVirtualFile()
+            {
+               return null;
+            }
+
+            public void close()
+            {
+               
+            }
+         };
+      }
+
+      public String getName()
+      {
+         return "somefile.bsh";
+      }
+   }
 }




More information about the jboss-cvs-commits mailing list