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 TgzProviderTestCase
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 TgzProviderTestCase());
44 }
45
46 /***
47 * Prepares the file system manager.
48 */
49 public void prepare(final DefaultFileSystemManager manager) throws Exception
50 {
51
52 manager.addProvider("tgz", new TarFileProvider());
53 manager.addProvider("tar", new TarFileProvider());
54 }
55
56 /***
57 * Returns the base folder for read tests.
58 */
59 public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
60 {
61 final File tarFile = AbstractVfsTestCase.getTestResource("test.tgz");
62 final String uri = "tgz:" + tarFile.getAbsolutePath() + "!/";
63 return manager.resolveFile(uri);
64 }
65 }