[jboss-cvs] JBossAS SVN: r94702 - in projects/vfs/branches/dml-zip-rework/src: main/java/org/jboss/vfs/protocol and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 12 19:14:01 EDT 2009
Author: johnbailey
Date: 2009-10-12 19:14:00 -0400 (Mon, 12 Oct 2009)
New Revision: 94702
Modified:
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/AssemblyFileSystemTest.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/FileVFSUnitTestCase.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/JARSerializationUnitTestCase.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/URLConnectionUnitTestCase.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/VirtualJarInputStreamTest.java
projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/support/VirtualFileAdaptor.java
Log:
Removed getInstance from VFS and moved towards a single static VFS
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFS.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -38,9 +38,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Enumeration;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipEntry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -52,7 +49,6 @@
import org.jboss.vfs.spi.FileSystem;
import org.jboss.vfs.spi.RealFileSystem;
import org.jboss.vfs.spi.JavaZipFileSystem;
-import org.jboss.vfs.util.PathTokenizer;
import org.jboss.logging.Logger;
/**
@@ -69,14 +65,12 @@
public static final boolean LEAK_DEBUGGING;
- private final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = new ConcurrentHashMap<VirtualFile, Map<String, Mount>>();
- private final VirtualFile rootVirtualFile;
- private final Mount rootMount;
+ private static final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = new ConcurrentHashMap<VirtualFile, Map<String, Mount>>();
+ private static final VirtualFile rootVirtualFile = new VirtualFile("", null);
+ private static final Mount rootMount = new Mount(RealFileSystem.ROOT_INSTANCE, rootVirtualFile);
- static VFS instance = new VFS();
// todo - LRU VirtualFiles?
// todo - LRU String intern?
-
static {
init();
LEAK_DEBUGGING = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@@ -87,67 +81,15 @@
}
/**
- * Get the "global" instance.
- *
- * @return the VFS instance
+ * Do not allow construction
*/
- public static VFS getInstance() {
- return instance;
+ private VFS() {
}
-
+
/**
- * Create a new instance.
- */
- public VFS() {
- // By default, there's a root mount which points to the "real" FS
- //noinspection ThisEscapedInObjectConstruction
- rootVirtualFile = new VirtualFile("", null);
- rootMount = new Mount(RealFileSystem.ROOT_INSTANCE, rootVirtualFile);
- }
-
- /**
- * Get file. Backcompatibility method.
- *
- * @param url the url
- *
- * @return the file matching url
- *
- * @throws IOException if there is a problem accessing the VFS
- * @deprecated use {@link #getChild(URL)} instead
- */
- @Deprecated
- @SuppressWarnings("deprecation")
- public static VirtualFile getRoot(URL url) throws IOException {
- try {
- return getRoot(url.toURI());
- }
- catch (URISyntaxException e) {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- /**
- * Get file. Backcompatibility method.
- *
- * @param uri the uri
- *
- * @return the file matching uri
- *
- * @throws IOException if there is a problem accessing the VFS
- * @deprecated use {@link #getChild(URI)} instead
- */
- @Deprecated
- public static VirtualFile getRoot(URI uri) throws IOException {
- return getInstance().getChild(uri.getPath());
- }
-
- /**
* Initialize VFS protocol handlers package property.
*/
- @SuppressWarnings({ "deprecation", "unchecked" })
- public static void init() {
+ private static void init() {
// A small hack that allows us to replace file for now
URL.setURLStreamHandlerFactory(null);
String pkgs = System.getProperty("java.protocol.handler.pkgs");
@@ -171,17 +113,14 @@
*
* @throws IOException if an I/O error occurs, such as a filesystem already being mounted at the given mount point
*/
- public Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException {
- if (mountPoint.getVFS() != this) {
- throw new IOException("VirtualFile does not match VFS instance");
- }
+ public static Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws IOException {
final VirtualFile parent = mountPoint.getParent();
if (parent == null) {
throw new IOException("Root filsystem already mounted");
}
final String name = mountPoint.getName();
final Mount mount = new Mount(fileSystem, mountPoint);
- final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
+ final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts;
for (; ;) {
Map<String, Mount> childMountMap = mounts.get(parent);
Map<String, Mount> newMap;
@@ -210,7 +149,7 @@
*
* @throws IllegalArgumentException if the path is null
*/
- public VirtualFile getChild(URL url) throws URISyntaxException {
+ public static VirtualFile getChild(URL url) throws URISyntaxException {
return getChild(url.toURI());
}
@@ -223,7 +162,7 @@
*
* @throws IllegalArgumentException if the path is null
*/
- public VirtualFile getChild(URI uri) {
+ public static VirtualFile getChild(URI uri) {
return getChild(uri.getPath());
}
@@ -236,10 +175,10 @@
*
* @throws IllegalArgumentException if the path is null
*/
- public VirtualFile getChild(String path) {
+ public static VirtualFile getChild(String path) {
if (path == null)
throw new IllegalArgumentException("Null path");
- return rootVirtualFile.getChild(path);
+ return getRootVirtualFile().getChild(path);
}
/**
@@ -247,7 +186,7 @@
*
* @return the root virtual file
*/
- public VirtualFile getRootVirtualFile() {
+ public static VirtualFile getRootVirtualFile() {
return rootVirtualFile;
}
@@ -258,7 +197,7 @@
*
* @throws IOException for any problem accessing the virtual file system
*/
- public List<VirtualFile> getChildren() throws IOException {
+ public static List<VirtualFile> getChildren() throws IOException {
return getRootVirtualFile().getChildren(null);
}
@@ -271,7 +210,7 @@
*
* @throws IOException for any problem accessing the virtual file system
*/
- public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException {
+ public static List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException {
return getRootVirtualFile().getChildren(filter);
}
@@ -284,7 +223,7 @@
*
* @throws IOException for any problem accessing the virtual file system
*/
- public List<VirtualFile> getChildrenRecursively() throws IOException {
+ public static List<VirtualFile> getChildrenRecursively() throws IOException {
return getRootVirtualFile().getChildrenRecursively(null);
}
@@ -299,7 +238,7 @@
*
* @throws IOException for any problem accessing the virtual file system
*/
- public List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException {
+ public static List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException {
return getRootVirtualFile().getChildrenRecursively(filter);
}
@@ -311,8 +250,8 @@
* @throws IOException for any problem accessing the VFS
* @throws IllegalArgumentException if the visitor is null
*/
- public void visit(VirtualFileVisitor visitor) throws IOException {
- visitor.visit(rootVirtualFile);
+ public static void visit(VirtualFileVisitor visitor) throws IOException {
+ visitor.visit(getRootVirtualFile());
}
/**
@@ -324,16 +263,14 @@
* @throws IOException for any problem accessing the VFS
* @throws IllegalArgumentException if the file or visitor is null
*/
- protected void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException {
+ protected static void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException {
if (file == null)
throw new IllegalArgumentException("Null file");
- if (file.getVFS() != this)
- throw new IllegalArgumentException("Virtual file from foreign VFS");
visitor.visit(file);
}
- Mount getMount(VirtualFile virtualFile) {
- final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
+ static Mount getMount(VirtualFile virtualFile) {
+ final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts;
for (; ;) {
final VirtualFile parent = virtualFile.getParent();
if (parent == null) {
@@ -360,8 +297,8 @@
*
* @return the collection of present mount (simple) names
*/
- Set<String> getSubmounts(VirtualFile virtualFile) {
- final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = this.mounts;
+ static Set<String> getSubmounts(VirtualFile virtualFile) {
+ final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts;
final Map<String, Mount> mountMap = mounts.get(virtualFile);
if (mountMap == null) {
return emptyRemovableSet();
@@ -372,7 +309,7 @@
private static Closeable doMount(final FileSystem fileSystem, final VirtualFile mountPoint) throws IOException {
boolean ok = false;
try {
- final Closeable mountHandle = getInstance().mount(mountPoint, fileSystem);
+ final Closeable mountHandle = mount(mountPoint, fileSystem);
final Closeable closeable = new Closeable() {
public void close() throws IOException {
VFSUtils.safeClose(mountHandle);
@@ -523,7 +460,7 @@
final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
try {
final File rootFile = tempDir.getRoot();
- unzip(zipFile, rootFile);
+ VFSUtils.unzip(zipFile, rootFile);
final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
ok = true;
return new Closeable() {
@@ -570,7 +507,7 @@
VFSUtils.safeClose(os);
}
final File rootFile = tempDir.getRoot();
- unzip(zipFile, rootFile);
+ VFSUtils.unzip(zipFile, rootFile);
final Closeable closeable = doMount(new RealFileSystem(rootFile), mountPoint);
ok = true;
return new Closeable() {
@@ -622,66 +559,13 @@
return doMount(new AssemblyFileSystem(assembly), mountPoint);
}
- /**
- * Expand a zip file to a destination directory. The directory must exist. If an error occurs, the destination
- * directory may contain a partially-extracted archive, so cleanup is up to the caller.
- *
- * @param zipFile the zip file
- * @param destDir the destination directory
- *
- * @throws IOException if an error occurs
- */
- public static void unzip(File zipFile, File destDir) throws IOException {
- final ZipFile zip = new ZipFile(zipFile);
- try {
- final Set<File> createdDirs = new HashSet<File>();
- final Enumeration<? extends ZipEntry> entries = zip.entries();
- FILES_LOOP:
- while (entries.hasMoreElements()) {
- final ZipEntry zipEntry = entries.nextElement();
- final String name = zipEntry.getName();
- final List<String> tokens = PathTokenizer.getTokens(name);
- final Iterator<String> it = tokens.iterator();
- File current = destDir;
- while (it.hasNext()) {
- String token = it.next();
- if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
- // invalid file; skip it!
- continue FILES_LOOP;
- }
- current = new File(current, token);
- if ((it.hasNext() || zipEntry.isDirectory()) && createdDirs.add(current)) {
- current.mkdir();
- }
- }
- if (!zipEntry.isDirectory()) {
- final InputStream is = zip.getInputStream(zipEntry);
- try {
- final FileOutputStream os = new FileOutputStream(current);
- try {
- VFSUtils.copyStream(is, os);
- // allow an error on close to terminate the unzip
- is.close();
- os.close();
- } finally {
- VFSUtils.safeClose(os);
- }
- } finally {
- VFSUtils.safeClose(is);
- }
- }
- }
- } finally {
- VFSUtils.safeClose(zip);
- }
- }
-
@SuppressWarnings({ "unchecked" })
private static <E> Set<E> emptyRemovableSet() {
return EMPTY_REMOVABLE_SET;
}
- private static final Set EMPTY_REMOVABLE_SET = new EmptyRemovableSet();
+ @SuppressWarnings("unchecked")
+ private static final Set EMPTY_REMOVABLE_SET = new EmptyRemovableSet();
private static final class EmptyRemovableSet<E> extends AbstractSet<E> {
@@ -710,7 +594,7 @@
* backing filesystem implementation; the same {@code FileSystem} may be mounted in more than one place, however only
* one {@code FileSystem} may be bound to a specific path at a time.
*/
- final class Mount implements Closeable {
+ final static class Mount implements Closeable {
private final FileSystem fileSystem;
private final VirtualFile mountPoint;
@@ -729,7 +613,7 @@
}
final String name = mountPoint.getName();
final VirtualFile parent = mountPoint.getParent();
- final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.this.mounts;
+ final ConcurrentMap<VirtualFile, Map<String, Mount>> mounts = VFS.mounts;
for (; ;) {
final Map<String, Mount> parentMounts = mounts.get(parent);
if (parentMounts == null) {
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -35,10 +35,15 @@
import java.net.URL;
import java.net.URLDecoder;
import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
+import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
@@ -46,6 +51,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.collection.CollectionsFactory;
+import org.jboss.vfs.util.PathTokenizer;
/**
* VFS Utilities
@@ -717,4 +723,58 @@
collectPathParts(mountPoint, current.getParent(), pathParts);
pathParts.add(current.getName());
}
+
+ /**
+ * Expand a zip file to a destination directory. The directory must exist. If an error occurs, the destination
+ * directory may contain a partially-extracted archive, so cleanup is up to the caller.
+ *
+ * @param zipFile the zip file
+ * @param destDir the destination directory
+ *
+ * @throws IOException if an error occurs
+ */
+ public static void unzip(File zipFile, File destDir) throws IOException {
+ final ZipFile zip = new ZipFile(zipFile);
+ try {
+ final Set<File> createdDirs = new HashSet<File>();
+ final Enumeration<? extends ZipEntry> entries = zip.entries();
+ FILES_LOOP:
+ while (entries.hasMoreElements()) {
+ final ZipEntry zipEntry = entries.nextElement();
+ final String name = zipEntry.getName();
+ final List<String> tokens = PathTokenizer.getTokens(name);
+ final Iterator<String> it = tokens.iterator();
+ File current = destDir;
+ while (it.hasNext()) {
+ String token = it.next();
+ if (PathTokenizer.isCurrentToken(token) || PathTokenizer.isReverseToken(token)) {
+ // invalid file; skip it!
+ continue FILES_LOOP;
+ }
+ current = new File(current, token);
+ if ((it.hasNext() || zipEntry.isDirectory()) && createdDirs.add(current)) {
+ current.mkdir();
+ }
+ }
+ if (!zipEntry.isDirectory()) {
+ final InputStream is = zip.getInputStream(zipEntry);
+ try {
+ final FileOutputStream os = new FileOutputStream(current);
+ try {
+ VFSUtils.copyStream(is, os);
+ // allow an error on close to terminate the unzip
+ is.close();
+ os.close();
+ } finally {
+ VFSUtils.safeClose(os);
+ }
+ } finally {
+ VFSUtils.safeClose(is);
+ }
+ }
+ }
+ } finally {
+ VFSUtils.safeClose(zip);
+ }
+ }
}
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFile.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -126,7 +126,7 @@
* @throws IOException for any problem accessing the virtual file system
*/
public long getLastModified() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().getLastModified(mount.getMountPoint(), this);
}
@@ -138,7 +138,7 @@
* @throws IOException for any problem accessing the virtual file system
*/
public long getSize() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().getSize(mount.getMountPoint(), this);
}
@@ -150,7 +150,7 @@
* @throws IOException - thrown on failure to detect existence.
*/
public boolean exists() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().exists(mount.getMountPoint(), this);
}
@@ -175,7 +175,7 @@
* @throws IOException if an I/O error occurs
*/
public boolean isDirectory() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().isDirectory(mount.getMountPoint(), this);
}
@@ -190,7 +190,7 @@
if(isDirectory()) {
return new VirtualJarInputStream(this);
}
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().openInputStream(mount.getMountPoint(), this);
}
@@ -202,7 +202,7 @@
* @throws IOException if an error occurs
*/
public boolean delete() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().delete(mount.getMountPoint(), this);
}
@@ -217,20 +217,11 @@
* @throws IOException if an I/O error occurs while producing the physical file
*/
public File getPhysicalFile() throws IOException {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().getFile(mount.getMountPoint(), this);
}
/**
- * Get the VFS instance for this virtual file
- *
- * @return the VFS
- */
- public VFS getVFS() {
- return VFS.instance;
- }
-
- /**
* Get a {@code VirtualFile} which represents the parent of this instance.
*
* @return the parent or {@code null} if there is no parent
@@ -281,9 +272,8 @@
public List<VirtualFile> getChildren() {
if (!isDirectory())
return Collections.emptyList();
- VFS vfs = VFS.instance;
- final VFS.Mount mount = vfs.getMount(this);
- final Set<String> submounts = vfs.getSubmounts(this);
+ final VFS.Mount mount = VFS.getMount(this);
+ final Set<String> submounts = VFS.getSubmounts(this);
final List<String> names = mount.getFileSystem().getDirectoryEntries(mount.getMountPoint(), this);
final List<VirtualFile> virtualFiles = new ArrayList<VirtualFile>(names.size() + submounts.size());
for (String name : names) {
@@ -432,7 +422,7 @@
* @throws IOException
*/
public CodeSigner[] getCodeSigners() {
- final VFS.Mount mount = VFS.instance.getMount(this);
+ final VFS.Mount mount = VFS.getMount(this);
return mount.getFileSystem().getCodeSigners(mount.getMountPoint(), this);
}
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VirtualFileAssembly.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -51,7 +51,7 @@
private final List<Closeable> mountHandles = new CopyOnWriteArrayList<Closeable>();
- private final VirtualFile mountRoot = VFS.getInstance().getChild("assembly-mounts").getChild(getAssemblyId());
+ private final VirtualFile mountRoot = VFS.getChild("assembly-mounts").getChild(getAssemblyId());
private TempFileProvider tempFileProvider;
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -46,7 +46,7 @@
public VirtualFileURLConnection(URL url) throws IOException {
super(url);
- file = VFS.getInstance().getChild(URLDecoder.decode(url.getPath(), "UTF-8"));
+ file = VFS.getChild(URLDecoder.decode(url.getPath(), "UTF-8"));
}
public void connect() throws IOException {
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/AssemblyFileSystemTest.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/AssemblyFileSystemTest.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/AssemblyFileSystemTest.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -22,7 +22,7 @@
public void testBuildAssembly() throws Exception {
VirtualFileAssembly earAssembly = new VirtualFileAssembly();
- VirtualFile earAssemblyLocation = VFS.getInstance().getChild("assembly.ear");
+ VirtualFile earAssemblyLocation = VFS.getChild("assembly.ear");
Closeable earAssemblyHandle = VFS.mountAssembly(earAssembly, earAssemblyLocation);
VirtualFileAssembly warAssembly = new VirtualFileAssembly();
@@ -31,7 +31,7 @@
try {
URL rootURL = getResource("/vfs/test");
- VirtualFile testDir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testDir = VFS.getChild(rootURL.getPath());
earAssembly.add("assembly.war", warAssemblyLocation);
@@ -44,14 +44,14 @@
warAssembly.add("WEB-INF/lib/jar1.jar/META-INF/Manifest.mf", testDir.getChild("jar1-filesonly.mf"));
warAssembly.add("WEB-INF/web.xml", testDir.getChild("web.xml"));
- assertMapped(testDir.getChild("nested/nested.jar"), VFS.getInstance().getChild(
+ assertMapped(testDir.getChild("nested/nested.jar"), VFS.getChild(
"assembly.ear/assembly.war/WEB-INF/lib/nested.jar"));
- assertMapped(testDir.getChild("nested/nested_copy.jar"), VFS.getInstance().getChild(
+ assertMapped(testDir.getChild("nested/nested_copy.jar"), VFS.getChild(
"assembly.ear/assembly.war/WEB-INF/lib/nested_copy.jar"));
- assertMapped(testDir.getChild("jar1-filesonly.mf"), VFS.getInstance().getChild("assembly.ear").getChild(
+ assertMapped(testDir.getChild("jar1-filesonly.mf"), VFS.getChild("assembly.ear").getChild(
"assembly.war").getChild("WEB-INF").getChild("lib").getChild("jar1.jar").getChild("META-INF").getChild(
"Manifest.mf"));
- assertTrue(VFS.getInstance().getChild(
+ assertTrue(VFS.getChild(
"assembly.ear/assembly.war/WEB-INF/lib/jar1.jar/org/jboss/test/vfs/support/jar1/ClassInJar1.class")
.exists());
}
@@ -63,7 +63,7 @@
@Test
public void testGetNonExistentFile() throws Exception {
- VirtualFile assemblyLocation = VFS.getInstance().getChild("/assembly");
+ VirtualFile assemblyLocation = VFS.getChild("/assembly");
VirtualFileAssembly assembly = new VirtualFileAssembly();
Closeable assemblyHandle = VFS.mountAssembly(assembly, assemblyLocation);
try {
@@ -78,7 +78,7 @@
@Test
public void testDelete() throws Exception {
- VirtualFile assemblyLocation = VFS.getInstance().getChild("/assembly");
+ VirtualFile assemblyLocation = VFS.getChild("/assembly");
VirtualFileAssembly assembly = new VirtualFileAssembly();
Closeable assemblyHandle = VFS.mountAssembly(assembly, assemblyLocation);
try {
@@ -93,7 +93,7 @@
@Test
public void testGetChildren() throws Exception {
VirtualFileAssembly assembly = new VirtualFileAssembly();
- VirtualFile assemblyLocation = VFS.getInstance().getChild("/assembly");
+ VirtualFile assemblyLocation = VFS.getChild("/assembly");
Closeable assemblyHandle = VFS.mountAssembly(assembly, assemblyLocation);
try {
URL jar1URL = getResource("/vfs/test/jar1.jar");
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/FileVFSUnitTestCase.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/FileVFSUnitTestCase.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/FileVFSUnitTestCase.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -25,7 +25,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -36,7 +35,6 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
@@ -48,7 +46,6 @@
import org.jboss.test.vfs.support.ClassPathIterator;
import org.jboss.test.vfs.support.ClassPathIterator.ClassPathEntry;
-import org.jboss.vfs.TempFileProvider;
import org.jboss.vfs.VFS;
import org.jboss.vfs.VFSUtils;
import org.jboss.vfs.VirtualFile;
@@ -93,9 +90,8 @@
public void testVFSFileURIFactory() throws Exception
{
URL rootURL = getClass().getProtectionDomain().getCodeSource().getLocation();
- VFS rootVFS = VFS.getInstance();
- VirtualFile root0 = rootVFS.getChild(rootURL.getPath());
- VirtualFile root1 = rootVFS.getChild(root0.toURI().getPath());
+ VirtualFile root0 = VFS.getChild(rootURL.getPath());
+ VirtualFile root1 = VFS.getChild(root0.toURI().getPath());
assertEquals(root0, root1);
}
@@ -106,8 +102,7 @@
public void testInnerJarFile() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerjar = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outerjar);
@@ -150,7 +145,7 @@
public void testFindResource() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(jar);
try
@@ -180,7 +175,7 @@
public void testFindResourceUsingURLStream() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(jar);
try
@@ -227,7 +222,7 @@
public void testFindResourceInFilesOnlyJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1-filesonly.jar");
List<Closeable> mounts = recursiveMount(jar);
try
@@ -272,7 +267,7 @@
public void testFindResourceInFilesOnlyWar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile war2 = testdir.getChild("WarDeployApp_web.war");
List<Closeable> mounts = recursiveMount(war2);
try
@@ -337,7 +332,7 @@
public void testFindClassesInFilesOnlyWar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile war = testdir.getChild("filesonly.war");
List<Closeable> mounts = recursiveMount(war);
@@ -369,7 +364,7 @@
public void testFindResourceUnpackedJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("unpacked-outer.jar");
assertTrue("unpacked-outer.jar != null", jar != null);
@@ -397,7 +392,7 @@
{
log.info("+++ testResolveFile, cwd=" + (new File(".").getCanonicalPath()));
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
// Check resolving the root file
VirtualFile root = testdir.getChild("");
@@ -441,7 +436,7 @@
{
log.info("+++ testResolveFile, cwd=" + (new File(".").getCanonicalPath()));
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
// Find ClassInJar1.class
VirtualFile vf = testdir.getChild("jar1.jar");
@@ -474,7 +469,7 @@
{
log.info("+++ testResolveFileInUnpackedJar, cwd=" + (new File(".").getCanonicalPath()));
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
// Check resolving the root file
VirtualFile root = testdir.getChild("");
@@ -501,7 +496,7 @@
public void testFileNotFoundInUnpackedJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
// Find the outer.jar
VirtualFile outerJar = testdir.getChild("unpacked-outer.jar");
@@ -526,7 +521,7 @@
public void testInnerJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outer = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outer);
try
@@ -559,7 +554,7 @@
public void testInnerJarUsingURLStream() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outer = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outer);
try
@@ -596,7 +591,7 @@
public void testClassScan() throws Exception
{
URL rootURL = getResource("/vfs/test/outer.jar");
- VirtualFile outer = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile outer = VFS.getChild(rootURL.getPath());
List<Closeable> mounts = recursiveMount(outer);
try
{
@@ -636,7 +631,7 @@
public void testClassScanUnpacked() throws Exception
{
URL rootURL = getResource("/vfs/test/unpacked-outer.jar");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
List<Closeable> mounts = recursiveMount(testdir);
try
{
@@ -675,7 +670,7 @@
public void testClassScanFilesonly() throws Exception
{
URL rootURL = getResource("/vfs/test/jar1-filesonly.jar");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
List<Closeable> mounts = recursiveMount(testdir);
try
{
@@ -734,7 +729,7 @@
public void testFilesOnlyJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1-filesonly.jar");
List<Closeable> mounts = recursiveMount(jar);
@@ -780,7 +775,7 @@
tmp.deleteOnExit();
log.info("+++ testVFSerialization, tmp=" + tmp.getCanonicalPath());
URL rootURL = tmpRoot.toURI().toURL();
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tmpVF = testdir.getChild("vfs.ser");
FileOutputStream fos = new FileOutputStream(tmp);
ObjectOutputStream oos = new ObjectOutputStream(fos);
@@ -847,7 +842,7 @@
log.info("+++ testVFJarSerialization, tmp=" + tmpJar.getCanonicalPath());
URI rootURI = tmpRoot.toURI();
- VirtualFile tmp = VFS.getInstance().getChild(rootURI.getPath());
+ VirtualFile tmp = VFS.getChild(rootURI.getPath());
File vfsSer = new File(tmpRoot, "vfs.ser");
vfsSer.createNewFile();
vfsSer.deleteOnExit();
@@ -903,7 +898,7 @@
{
// this expects to be run with a working dir of the container root
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outer = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outer);
try
@@ -959,7 +954,7 @@
public void testDirURLs() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerJar = testdir.getChild("unpacked-outer.jar");
URL outerURL = outerJar.toURL();
@@ -996,7 +991,7 @@
public void testDirURIs() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerJar = testdir.getChild("unpacked-outer.jar");
URI outerURI = outerJar.toURI();
@@ -1031,7 +1026,7 @@
public void testCopyJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("outer.jar");
assertTrue("outer.jar != null", jar != null);
File tmpJar = File.createTempFile("testCopyJar", ".jar");
@@ -1074,7 +1069,7 @@
public void testCopyInnerJar() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerjar = testdir.getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outerjar);
try
@@ -1118,7 +1113,7 @@
public void testManifestClasspath() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerjar = testdir.getChild("outermf.jar");
List<Closeable> mounts = recursiveMount(outerjar);
try
@@ -1148,7 +1143,7 @@
public void testInnerManifestClasspath() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile outerjar = testdir.getChild("withalong/rootprefix/outermf.jar");
assertNotNull(outerjar);
List<Closeable> mounts = recursiveMount(outerjar);
@@ -1183,7 +1178,7 @@
public void testJarWithSpacesInPath() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tstjar = testdir.getChild("path with spaces/tst.jar");
List<Closeable> mounts = recursiveMount(tstjar);
try
@@ -1215,7 +1210,7 @@
public void testJarWithSpacesInContext() throws Exception
{
URL rootURL = getResource("/vfs/test/path with spaces");
- VirtualFile testdir = VFS.getInstance().getChild(URLDecoder.decode(rootURL.getPath(), "UTF-8"));
+ VirtualFile testdir = VFS.getChild(URLDecoder.decode(rootURL.getPath(), "UTF-8"));
VirtualFile tstear = testdir.getChild("spaces.ear");
List<Closeable> mounts = recursiveMount(tstear);
try
@@ -1263,7 +1258,7 @@
public void testUnpackedJarWithSpacesInPath() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tstjar = testdir.getChild("path with spaces/unpacked-tst.jar");
assertNotNull("tstjar != null", tstjar);
URI uri = tstjar.toURI();
@@ -1294,7 +1289,7 @@
// private void testGetMetaDataFromJar(String name) throws Exception
// {
// URL rootURL = getResource("/vfs/test");
- // VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ // VirtualFile testdir = VFS.getChild(rootURL.getPath());
//
// VirtualFile jar = testdir.getChild(name);
// assertNotNull(jar);
@@ -1320,7 +1315,7 @@
public void testURLClassLoaderFindResourceFailure() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
URL[] cp = { testdir.toURL() };
URLClassLoader ucl = new URLClassLoader(cp);
// Search for a non-existent resource
@@ -1344,7 +1339,7 @@
log.info("+++ testFileExists, tmp=" + tmp.getCanonicalPath());
URL rootURL = tmpRoot.toURI().toURL();
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tmpVF = testdir.getChild(tmp.getName());
assertTrue(tmpVF.getPathName() + ".exists()", tmpVF.exists());
assertTrue("tmp.delete()", tmpVF.delete());
@@ -1368,7 +1363,7 @@
log.info("+++ testDirFileExists, tmp=" + tmp.getCanonicalPath());
URL rootURL = tmpRoot.toURI().toURL();
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tmpVF = testdir.getChild(tmp.getName());
assertTrue(tmpVF.getPathName() + ".exists()", tmpVF.exists());
assertFalse(tmpVF.getPathName() + ".isLeaf()", tmpVF.isLeaf());
@@ -1398,7 +1393,7 @@
jos.close();
URL rootURL = tmpRoot.toURI().toURL();
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tmpVF = testdir.getChild(tmpJar.getName());
assertTrue(tmpVF.getPathName() + ".exists()", tmpVF.exists());
assertTrue(tmpVF.getPathName() + ".size() > 0", tmpVF.getSize() > 0);
@@ -1423,7 +1418,7 @@
log.info("+++ testDirJarExists, tmp=" + tmp.getCanonicalPath());
URL rootURL = tmpRoot.toURI().toURL();
- VirtualFile testdir = VFS.getInstance().getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile tmpVF = testdir.getChild(tmp.getName());
log.info(tmpVF);
assertTrue(tmpVF.getPathName() + ".exists()", tmpVF.exists());
@@ -1441,7 +1436,7 @@
public void testFileDelete() throws Exception
{
File tmpRoot = File.createTempFile("vfs", ".root");
- VirtualFile root = VFS.getInstance().getChild(tmpRoot.getPath());
+ VirtualFile root = VFS.getChild(tmpRoot.getPath());
// non-existent directory - exists() not
tmpRoot.delete();
@@ -1458,7 +1453,7 @@
assertTrue(tmp.mkdir());
File tmp2 = File.createTempFile("testFileDelete2", ".jar", tmp);
assertTrue(tmp2.exists());
- VirtualFile tmpDeletable = VFS.getRoot(tmp.toURI());
+ VirtualFile tmpDeletable = VFS.getChild(tmp.toURI());
assertFalse(tmpRoot + ".delete() == false", tmpDeletable.delete());
// children() exist
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/JARSerializationUnitTestCase.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/JARSerializationUnitTestCase.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/JARSerializationUnitTestCase.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -45,7 +45,6 @@
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
- at SuppressWarnings("deprecation")
public class JARSerializationUnitTestCase extends AbstractVFSTest
{
public JARSerializationUnitTestCase(String name)
@@ -65,7 +64,7 @@
public void testInnerJarFile() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile outerjar = VFS.getInstance().getChild(rootURL).getChild("outer.jar");
+ VirtualFile outerjar = VFS.getChild(rootURL).getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outerjar);
try
{
@@ -102,7 +101,7 @@
public void testInnerJarFileSerialization() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile outerjar = VFS.getInstance().getChild(rootURL).getChild("outer.jar");
+ VirtualFile outerjar = VFS.getChild(rootURL).getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outerjar);
try
{
@@ -141,7 +140,7 @@
public void testInnerJarFilesOnlyFileSerialization() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile outerjar =VFS.getInstance().getChild(rootURL).getChild("outer.jar");
+ VirtualFile outerjar =VFS.getChild(rootURL).getChild("outer.jar");
List<Closeable> mounts = recursiveMount(outerjar);
try
{
@@ -179,7 +178,7 @@
public void testLevelZips() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile root = VFS.getInstance().getChild(rootURL);
+ VirtualFile root = VFS.getChild(rootURL);
VirtualFile one = root.getChild("level1.zip");
List<Closeable> mounts = recursiveMount(one);
try
@@ -237,7 +236,7 @@
public void test2ndLevelRead() throws Exception
{
URL rootURL = getResource("/vfs/test/level1.zip");
- VirtualFile root = VFS.getInstance().getChild(rootURL);
+ VirtualFile root = VFS.getChild(rootURL);
List<Closeable> mounts = recursiveMount(root);
try
{
@@ -255,7 +254,7 @@
public void testEarsInnerJarChild() throws Exception
{
URL rootURL = getResource("/vfs/test/interop_W2JREMarshallTest_appclient_vehicle.ear");
- VirtualFile root = VFS.getInstance().getChild(rootURL);
+ VirtualFile root = VFS.getChild(rootURL);
List<Closeable> mounts = recursiveMount(root);
try
{
@@ -280,7 +279,7 @@
public void testVirtualFileAdaptor() throws Exception
{
URL rootURL = getResource("/vfs/test/interop_W2JREMarshallTest_appclient_vehicle.ear");
- VirtualFile root = VFS.getInstance().getChild(rootURL);
+ VirtualFile root = VFS.getChild(rootURL);
VirtualFile file = root.getChild("interop_W2JREMarshallTest_appclient_vehicle_client.jar");
VirtualFile same = file.getChild("");
// serialize
@@ -290,7 +289,7 @@
public void testDeepVFAMechanism() throws Exception
{
URL rootURL = getResource("/vfs/test");
- VirtualFile root = VFS.getInstance().getChild(rootURL);
+ VirtualFile root = VFS.getChild(rootURL);
VirtualFile one = root.getChild("level1.zip");
testVirtualFileAdaptor(one, "test1.txt");
VirtualFile textOne = one.getChild("test1.txt");
@@ -349,11 +348,11 @@
URL url = getResource("/vfs/test/spring-ear.ear");
String urlString = url.toExternalForm();
int p = urlString.indexOf(":/");
- List<Closeable> mounts = recursiveMount(VFS.getInstance().getChild(url));
+ List<Closeable> mounts = recursiveMount(VFS.getChild(url));
try
{
url = new URL("file" + urlString.substring(p) + "/lib/spring-beans.jar/org/jboss/test/spring");
- VirtualFile file = VFS.getInstance().getChild(url);
+ VirtualFile file = VFS.getChild(url);
assertNotNull("No beans dir", file.getChild("beans"));
testVirtualFileAdaptor(file, "beans");
}
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/URLConnectionUnitTestCase.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/URLConnectionUnitTestCase.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/URLConnectionUnitTestCase.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -58,7 +58,7 @@
protected VirtualFile getFile() throws Exception
{
URL url = getResource("/vfs/test/");
- VirtualFile root = VFS.getInstance().getChild(url);
+ VirtualFile root = VFS.getChild(url);
VirtualFile file = root.getChild(getFileName());
assertNotNull(file);
return file;
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/VirtualJarInputStreamTest.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/VirtualJarInputStreamTest.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/VirtualJarInputStreamTest.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -67,8 +67,7 @@
@Test
public void testIteration() throws Exception {
URL rootURL = getResource("/vfs/test/");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1.jar");
Closeable mount = VFS.mountZip(jar, jar, provider);
@@ -95,8 +94,7 @@
@Test
public void testIterationNonJar() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1");
Closeable mount = VFS.mountReal(jar.getPhysicalFile(), jar);
@@ -120,8 +118,7 @@
@Test
public void testRead() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1.jar");
Closeable mount = VFS.mountZip(jar, jar, provider);
@@ -149,8 +146,7 @@
@Test
public void testReadNonJar() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1");
Closeable mount = VFS.mountReal(jar.getPhysicalFile(), jar);
@@ -178,8 +174,7 @@
@Test
public void testReadClosed() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1.jar");
Closeable mount = VFS.mountZip(jar, jar, provider);
@@ -204,8 +199,7 @@
@Test
public void testGetManifest() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1.jar");
Closeable mount = VFS.mountZip(jar, jar, provider);
@@ -223,8 +217,7 @@
@Test
public void testGetManifestNonJar() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1");
Closeable mount = VFS.mountReal(jar.getPhysicalFile(), jar);
@@ -242,8 +235,7 @@
@Test
public void testGetAttributes() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1.jar");
Closeable mount = VFS.mountZip(jar, jar, provider);
@@ -266,8 +258,7 @@
@Test
public void testGetAttributesNonJar() throws Exception {
URL rootURL = getResource("/vfs/test");
- VFS vfs = VFS.getInstance();
- VirtualFile testdir = vfs.getChild(rootURL.getPath());
+ VirtualFile testdir = VFS.getChild(rootURL.getPath());
VirtualFile jar = testdir.getChild("jar1");
Closeable mount = VFS.mountReal(jar.getPhysicalFile(), jar);
Modified: projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/support/VirtualFileAdaptor.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/support/VirtualFileAdaptor.java 2009-10-12 23:00:22 UTC (rev 94701)
+++ projects/vfs/branches/dml-zip-rework/src/test/java/org/jboss/test/vfs/support/VirtualFileAdaptor.java 2009-10-12 23:14:00 UTC (rev 94702)
@@ -74,7 +74,7 @@
{
if (file == null)
{
- file = VFS.getInstance().getChild(path);
+ file = VFS.getChild(path);
}
return file;
}
More information about the jboss-cvs-commits
mailing list