1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs.provider.tar.test;
18
19 import junit.framework.Test;
20 import org.apache.commons.AbstractVfsTestCase;
21 import org.apache.commons.vfs.FileObject;
22 import org.apache.commons.vfs.FileSystemManager;
23 import org.apache.commons.vfs.impl.DefaultFileSystemManager;
24 import org.apache.commons.vfs.provider.tar.TarFileProvider;
25 import org.apache.commons.vfs.test.AbstractProviderTestConfig;
26 import org.apache.commons.vfs.test.ProviderTestConfig;
27 import org.apache.commons.vfs.test.ProviderTestSuite;
28
29 import java.io.File;
30
31 /***
32 * Tests for the Tar file system.
33 */
34 public class TarProviderTestCase
35 extends AbstractProviderTestConfig
36 implements ProviderTestConfig
37 {
38 /***
39 * Creates the test suite for the tar file system.
40 */
41 public static Test suite() throws Exception
42 {
43 return new ProviderTestSuite(new TarProviderTestCase());
44 }
45
46 /***
47 * Prepares the file system manager.
48 */
49 public void prepare(final DefaultFileSystemManager manager) throws Exception
50 {
51 manager.addProvider("tar", new TarFileProvider());
52 manager.addMimeTypeMap("application/x-tar", "tar");
53 }
54
55 /***
56 * Returns the base folder for read tests.
57 */
58 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
59 {
60 final File tarFile = AbstractVfsTestCase.getTestResource("test.tar");
61 final String uri = "tar:" + tarFile.getAbsolutePath() + "!/";
62 return manager.resolveFile(uri);
63 }
64 }