[jboss-cvs] JBossAS SVN: r84161 - in projects/vfs/trunk/src: test/java/org/jboss/test/virtual/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 13 05:08:29 EST 2009
Author: alesj
Date: 2009-02-13 05:08:29 -0500 (Fri, 13 Feb 2009)
New Revision: 84161
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/FileCleanupUnitTest.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
Log:
Fix how we handle "/" in non-leaf handlers.
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 2009-02-13 09:35:49 UTC (rev 84160)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java 2009-02-13 10:08:29 UTC (rev 84161)
@@ -252,7 +252,7 @@
// init initial root EntryInfo that will be overwritten
// if zip entry exists for rootEntryPath
- entries.put("", new EntryInfo(new ZipEntryHandler(this, null, name, true), null));
+ entries.put("", new EntryInfo(new ZipEntryHandler(this, null, name, false), null));
// It's lazy init now
//initEntries();
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java 2009-02-13 09:35:49 UTC (rev 84160)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java 2009-02-13 10:08:29 UTC (rev 84161)
@@ -291,16 +291,27 @@
VirtualFile ear = root.getChild("level1.zip");
VirtualFile earCopy = modify(ear);
+ assertEquals(ear.toURL(), earCopy.toURL());
assertEquals(getProtocol() + urlString + "level1.zip/", earCopy.toURL().toExternalForm());
+ VirtualFile o2 = ear.getChild("level2.zip");
VirtualFile l2 = earCopy.getChild("level2.zip");
+ assertEquals(o2.toURL(), l2.toURL());
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/", l2.toURL().toExternalForm());
+
+ VirtualFile o2sub = o2.getChild("test2.txt");
VirtualFile l2sub = l2.getChild("test2.txt");
+ assertEquals(o2sub.toURL(), l2sub.toURL());
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/test2.txt", l2sub.toURL().toExternalForm());
+ VirtualFile o3 = o2.getChild("level3.zip");
VirtualFile l3 = l2.getChild("level3.zip");
+ assertEquals(o3.toURL(), l3.toURL());
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/level3.zip/", l3.toURL().toExternalForm());
+
+ VirtualFile o3sub = o3.getChild("test3.txt");
VirtualFile l3sub = l3.getChild("test3.txt");
+ assertEquals(o3sub.toURL(), l3sub.toURL());
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/level3.zip/test3.txt", l3sub.toURL().toExternalForm());
ear.cleanup();
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java 2009-02-13 09:35:49 UTC (rev 84160)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java 2009-02-13 10:08:29 UTC (rev 84161)
@@ -860,7 +860,7 @@
String name = tmpJar.getName();
String vfsPath = tmpJar.getPath();
vfsPath = vfsPath.substring(tmpRoot.getPath().length()+1);
- URL url = new URL("vfs" + tmpJar.toURL());
+ URL url = new URL("vfs" + tmpJar.toURL() + "/");
//url = JarUtils.createJarURL(url);
log.debug("name: "+name);
log.debug("vfsPath: "+vfsPath);
@@ -1195,10 +1195,9 @@
log.debug("outerURL: "+outerURL);
assertTrue(outerURL+" ends in '/'", outerURL.getPath().endsWith("/"));
// Validate that jar1 is under unpacked-outer.jar
- URL jar1URL = new URL(outerURL, "jar1.jar");
+ URL jar1URL = new URL(outerURL, "jar1.jar/");
log.debug("jar1URL: "+jar1URL+", path="+jar1URL.getPath());
- assertTrue("jar1URL path ends in unpacked-outer.jar/jar1.jar!/",
- jar1URL.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
+ assertTrue("jar1URL path ends in unpacked-outer.jar/jar1.jar!/", jar1URL.getPath().endsWith("unpacked-outer.jar/jar1.jar/"));
VirtualFile jar1 = outerJar.findChild("jar1.jar");
assertEquals(jar1URL.getPath(), jar1.toURL().getPath());
@@ -1224,17 +1223,15 @@
log.debug("outerURI: "+outerURI);
assertTrue(outerURI+" ends in '/'", outerURI.getPath().endsWith("/"));
// Validate that jar1 is under unpacked-outer.jar
- URI jar1URI = new URI(outerURI+"jar1.jar");
+ URI jar1URI = new URI(outerURI+"jar1.jar/");
log.debug("jar1URI: "+jar1URI+", path="+jar1URI.getPath());
- assertTrue("jar1URI path ends in unpacked-outer.jar/jar1.jar!/",
- jar1URI.getPath().endsWith("unpacked-outer.jar/jar1.jar"));
+ assertTrue("jar1URI path ends in unpacked-outer.jar/jar1.jar!/", jar1URI.getPath().endsWith("unpacked-outer.jar/jar1.jar/"));
VirtualFile jar1 = outerJar.findChild("jar1.jar");
assertEquals(jar1URI.getPath(), jar1.toURI().getPath());
VirtualFile packedJar = vfs.findChild("jar1.jar");
jar1URI = packedJar.findChild("org/jboss/test/vfs/support").toURI();
- assertTrue("Jar directory entry URLs must end in /: " + jar1URI.toString(),
- jar1URI.toString().endsWith("/"));
+ assertTrue("Jar directory entry URLs must end in /: " + jar1URI.toString(), jar1URI.toString().endsWith("/"));
}
/**
@@ -1391,8 +1388,8 @@
VirtualFile tstjar = vfs.findChild("path with spaces/tst.jar");
assertNotNull("tstjar != null", tstjar);
URI uri = tstjar.toURI();
- URI expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst.jar");
- assertEquals(uri.getPath(), expectedURI.getPath());
+ URI expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst.jar/");
+ assertEquals(expectedURI.getPath(), uri.getPath());
InputStream is = uri.toURL().openStream();
is.close();
@@ -1400,8 +1397,8 @@
tstjar = vfs.findChild("path with spaces/tst%20nospace.jar");
assertNotNull("tstjar != null", tstjar);
uri = tstjar.toURI();
- expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst%2520nospace.jar");
- assertEquals(uri.getPath(), expectedURI.getPath());
+ expectedURI = new URI("vfs"+rootURL.toString()+"/path%20with%20spaces/tst%2520nospace.jar/");
+ assertEquals(expectedURI.getPath(), uri.getPath());
is = uri.toURL().openStream();
is.close();
More information about the jboss-cvs-commits
mailing list