1 16 package org.apache.commons.vfs.provider.tar.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.tar.TarFileProvider; 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 31 public class NestedTbz2TestCase 32 extends AbstractProviderTestConfig 33 implements ProviderTestConfig 34 { 35 38 public static Test suite() throws Exception 39 { 40 return new ProviderTestSuite(new NestedTbz2TestCase()); 41 } 42 43 46 public void prepare(final DefaultFileSystemManager manager) 47 throws Exception 48 { 49 manager.addProvider("tbz2", new TarFileProvider()); 50 manager.addExtensionMap("tbz2", "tbz2"); 51 manager.addProvider("tar", new TarFileProvider()); 52 } 53 54 57 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception 58 { 59 final String tarFilePath = AbstractVfsTestCase.getTestResource("nested.tbz2").getAbsolutePath(); 61 String uri = "tbz2:" + tarFilePath + "!/test.tbz2"; 62 final FileObject tarFile = manager.resolveFile(uri); 63 64 final FileObject nestedFS = manager.createFileSystem(tarFile); 66 return nestedFS.resolveFile("/"); 67 } 68 } 69 | Popular Tags |