[jboss-cvs] JBossAS SVN: r72194 - projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 14 12:38:19 EDT 2008


Author: alesj
Date: 2008-04-14 12:38:18 -0400 (Mon, 14 Apr 2008)
New Revision: 72194

Added:
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/PathQueryTestCase.java
Modified:
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java
Log:
Query test.

Added: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/PathQueryTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/PathQueryTestCase.java	                        (rev 0)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/PathQueryTestCase.java	2008-04-14 16:38:18 UTC (rev 72194)
@@ -0,0 +1,73 @@
+/*
+* 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.URI;
+import java.net.URL;
+import java.util.Map;
+
+import junit.framework.Test;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+
+/**
+ * Test the query in url/uri.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PathQueryTestCase extends AbstractVFSTest
+{
+   public PathQueryTestCase(String s)
+   {
+      super(s);
+   }
+
+   public static Test suite()
+   {
+      return suite(PathQueryTestCase.class);
+   }
+
+   protected void assertOption(String name) throws Throwable
+   {
+      URL url = getResource("/vfs/context/" + name);
+      URI uri = new URI(url.toExternalForm() + "?foobar=qwert&useNoCopyJarHandler=true");
+      VirtualFile vf = VFS.getRoot(uri);
+      assertOption(vf, "foobar", "qwert");
+      assertOption(vf, "useNoCopyJarHandler", "true");
+   }
+
+   protected void assertOption(VirtualFile vf, String key, String value)
+   {
+      VFSContext context = vf.getHandler().getVFSContext();
+      assertNotNull(context);
+      Map<String, String> options = context.getOptions();
+      assertNotNull(options);
+      assertEquals(value, options.get(key));
+   }
+
+   public void testURL() throws Throwable
+   {
+      assertOption("jar/simple.jar");
+      assertOption("file/simple/child");
+   }
+}

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java	2008-04-14 16:31:23 UTC (rev 72193)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java	2008-04-14 16:38:18 UTC (rev 72194)
@@ -59,6 +59,7 @@
       suite.addTest(new TestSuite(AssembledContextTest.class));
       suite.addTest(MemoryTestCase.suite());
       suite.addTest(new TestSuite(URLConnectionUnitTestCase.class));
+      suite.addTest(PathQueryTestCase.suite());
 
       return suite;
    }




More information about the jboss-cvs-commits mailing list