1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.zip;
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 NestedZipTestCase extends AbstractProviderTestConfig {
33
34
35
36
37 public static Test suite() throws Exception {
38 return new ProviderTestSuite(new NestedZipTestCase(), true);
39 }
40
41
42
43
44 @Override
45 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
46
47 final String zipFilePath = getTestResource("nested.zip").getAbsolutePath();
48 final String uri = "zip:file:" + zipFilePath + "!/test.zip";
49 final FileObject zipFile = manager.resolveFile(uri);
50
51
52 final FileObject nestedFS = manager.createFileSystem(zipFile);
53 return nestedFS.resolveFile("/");
54 }
55
56
57
58
59 @Override
60 public void prepare(final DefaultFileSystemManager manager) throws Exception {
61 manager.addProvider("zip", new ZipFileProvider());
62 manager.addExtensionMap("zip", "zip");
63 manager.addMimeTypeMap(MIME_TYPE_APPLICATION_ZIP, "zip");
64 }
65
66 }