1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.tar;
18
19 import static org.apache.commons.vfs2.VfsTestUtils.getTestResource;
20
21 import junit.framework.Test;
22
23 import org.apache.commons.vfs2.AbstractProviderTestConfig;
24 import org.apache.commons.vfs2.FileObject;
25 import org.apache.commons.vfs2.FileSystemManager;
26 import org.apache.commons.vfs2.ProviderTestSuite;
27 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
28
29
30
31
32 public class NestedTbz2TestCase extends AbstractProviderTestConfig {
33
34
35
36
37 public static Test suite() throws Exception {
38 return new ProviderTestSuite(new NestedTbz2TestCase(), true);
39 }
40
41
42
43
44 @Override
45 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
46
47 final String tarFilePath = getTestResource("nested.tbz2").getAbsolutePath();
48 final String uri = "tbz2:file:" + tarFilePath + "!/test.tbz2";
49 final FileObject tarFile = manager.resolveFile(uri);
50
51
52 final FileObject nestedFS = manager.createFileSystem(tarFile);
53 return nestedFS.resolveFile("/");
54 }
55
56
57
58
59 @Override
60 public void prepare(final DefaultFileSystemManager manager) throws Exception {
61 manager.addProvider("tbz2", new TarFileProvider());
62 manager.addExtensionMap("tbz2", "tbz2");
63 manager.addProvider("tar", new TarFileProvider());
64 }
65
66 }