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 org.apache.commons.vfs2.AbstractProviderTestConfig;
20 import org.apache.commons.vfs2.AbstractVfsTestCase;
21 import org.apache.commons.vfs2.FileObject;
22 import org.apache.commons.vfs2.FileSystemManager;
23 import org.apache.commons.vfs2.ProviderTestSuite;
24 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
25
26 import junit.framework.Test;
27
28
29
30
31 public class NestedZipTestCase extends AbstractProviderTestConfig {
32
33
34
35 public static Test suite() throws Exception {
36 return new ProviderTestSuite(new NestedZipTestCase(), true);
37 }
38
39
40
41
42 @Override
43 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
44
45 final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath();
46 final String uri = "zip:file:" + zipFilePath + "!/test.zip";
47 final FileObject zipFile = manager.resolveFile(uri);
48
49
50 final FileObject nestedFS = manager.createFileSystem(zipFile);
51 return nestedFS.resolveFile("/");
52 }
53
54
55
56
57 @Override
58 public void prepare(final DefaultFileSystemManager manager) throws Exception {
59 manager.addProvider("zip", new ZipFileProvider());
60 manager.addExtensionMap("zip", "zip");
61 manager.addMimeTypeMap("application/zip", "zip");
62 }
63 }