1 16 package org.apache.commons.vfs.provider.zip.test; 17 18 import junit.framework.Test; 19 import org.apache.commons.AbstractVfsTestCase; 20 import org.apache.commons.vfs.FileObject; 21 import org.apache.commons.vfs.FileSystemManager; 22 import org.apache.commons.vfs.impl.DefaultFileSystemManager; 23 import org.apache.commons.vfs.provider.zip.ZipFileProvider; 24 import org.apache.commons.vfs.test.AbstractProviderTestConfig; 25 import org.apache.commons.vfs.test.ProviderTestConfig; 26 import org.apache.commons.vfs.test.ProviderTestSuite; 27 28 33 public class NestedZipTestCase 34 extends AbstractProviderTestConfig 35 implements ProviderTestConfig 36 { 37 40 public static Test suite() throws Exception 41 { 42 return new ProviderTestSuite(new NestedZipTestCase()); 43 } 44 45 48 public void prepare(final DefaultFileSystemManager manager) 49 throws Exception 50 { 51 manager.addProvider("zip", new ZipFileProvider()); 52 manager.addExtensionMap("zip", "zip"); 53 manager.addMimeTypeMap("application/zip", "zip"); 54 } 55 56 59 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception 60 { 61 final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath(); 63 String uri = "zip:" + zipFilePath + "!/test.zip"; 64 final FileObject zipFile = manager.resolveFile(uri); 65 66 final FileObject nestedFS = manager.createFileSystem(zipFile); 68 return nestedFS.resolveFile("/"); 69 } 70 } 71 | Popular Tags |