[jboss-cvs] JBossAS SVN: r75167 - in projects/vfs/trunk/src: test/java/org/jboss/test/virtual/test and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Jun 28 09:34:03 EDT 2008
Author: alesj
Date: 2008-06-28 09:34:03 -0400 (Sat, 28 Jun 2008)
New Revision: 75167
Added:
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CustomTestCase.java
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/application.xml
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/jboss-app.xml
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/lib/
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/lib/spring-beans.jar
projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/spring-ejb.jar
Modified:
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java
Log:
[JBVFS-41]; fix nested dir lookup.
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java 2008-06-27 18:00:42 UTC (rev 75166)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java 2008-06-28 13:34:03 UTC (rev 75167)
@@ -312,12 +312,16 @@
while((entry = zis.getNextEntry()) != null)
{
String entryName = entry.getName();
- if (relative.startsWith(entryName))
+ String match = entryName;
+ if (entry.isDirectory())
+ match = match.substring(0, match.length() - 1);
+
+ if (relative.startsWith(match))
{
- if (entryName.equals(relative))
+ if (match.equals(relative))
{
// directories and non archives
- if (entry.isDirectory() || JarUtils.isArchive(entryName) == false)
+ if (entry.isDirectory() || JarUtils.isArchive(match) == false)
{
return new ZipEntryWrapper(zis, entryName, System.currentTimeMillis());
}
@@ -327,7 +331,7 @@
if (longestNameMatch == null || longestNameMatch.length() < entryName.length())
{
- longestNameMatch = entryName;
+ longestNameMatch = entryName; // keep entry name
}
}
}
Copied: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CustomTestCase.java (from rev 75105, projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/JAREntryTestCase.java)
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CustomTestCase.java (rev 0)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CustomTestCase.java 2008-06-28 13:34:03 UTC (rev 75167)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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 org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Custom tests - ported from issues found.
+ *
+ * @author Ales.Justin at jboss.org
+ */
+public class CustomTestCase extends AbstractVFSTest
+{
+ public CustomTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected CustomTestCase(String name, boolean forceCopy)
+ {
+ super(name, forceCopy);
+ }
+
+ public static Test suite()
+ {
+ return suite(CustomTestCase.class);
+ }
+
+ public void testNestedDirLookup() throws Exception
+ {
+ URL url = getResource("/vfs/test/spring-ear.ear");
+ String urlString = url.toExternalForm();
+ int p = urlString.indexOf(":/");
+ url = new URL("vfszip" + urlString.substring(p) + "/lib/spring-beans.jar/org/jboss/test/spring/");
+ VirtualFile file = VFS.getRoot(url);
+ assertNotNull(file);
+ }
+}
\ No newline at end of file
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-06-27 18:00:42 UTC (rev 75166)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSAllTestSuite.java 2008-06-28 13:34:03 UTC (rev 75167)
@@ -83,6 +83,8 @@
suite.addTest(VisitorUnitTestCase.suite());
// utils
suite.addTest(VFSUtilTestCase.suite());
+ // custom
+ suite.addTest(CustomTestCase.suite());
return suite;
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java 2008-06-27 18:00:42 UTC (rev 75166)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ZipEntryVFSContextUnitTestCase.java 2008-06-28 13:34:03 UTC (rev 75167)
@@ -26,7 +26,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
-import java.util.Map;
import junit.framework.Test;
import org.jboss.virtual.VFS;
@@ -44,8 +43,6 @@
*/
public class ZipEntryVFSContextUnitTestCase extends JARVFSContextUnitTestCase
{
- private Map ctxCacheMap;
-
public ZipEntryVFSContextUnitTestCase(String name)
{
super(name);
@@ -58,25 +55,6 @@
return suite(ZipEntryVFSContextUnitTestCase.class);
}
-/*
- protected void setUp() throws Exception
- {
- super.setUp();
-
- SecurityManager sm = System.getSecurityManager();
- System.setSecurityManager(null);
- try
- {
- Field field = ZipEntryContextFactory.class.getDeclaredField("ctxCache");
- ctxCacheMap = (Map)field.get(ZipEntryContextFactory.getInstance());
- }
- finally
- {
- System.setSecurityManager(sm);
- }
- }
-*/
-
protected VFSContext getVFSContext(String name) throws Exception
{
URL url = getResource("/vfs/context/jar/" + name + ".jar");
Added: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/application.xml
===================================================================
--- projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/application.xml (rev 0)
+++ projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/application.xml 2008-06-28 13:34:03 UTC (rev 75167)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
+ version="1.4">
+
+ <display-name>JBoss Spring Test</display-name>
+
+ <module><ejb>spring-ejb.jar</ejb></module>
+
+</application>
Added: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/jboss-app.xml
===================================================================
--- projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/jboss-app.xml (rev 0)
+++ projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/jboss-app.xml 2008-06-28 13:34:03 UTC (rev 75167)
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd"
+>
+
+<jboss-app>
+</jboss-app>
Added: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/lib/spring-beans.jar
===================================================================
(Binary files differ)
Property changes on: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/lib/spring-beans.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/spring-ejb.jar
===================================================================
(Binary files differ)
Property changes on: projects/vfs/trunk/src/test/resources/vfs/test/spring-ear.ear/spring-ejb.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-cvs-commits
mailing list