1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.vfs;
18  
19  import junit.framework.AssertionFailedError;
20  import junit.framework.Test;
21  import junit.framework.TestResult;
22  import org.apache.commons.vfs.provider.http.test.HttpProviderTestCase;
23  import org.apache.commons.vfs.provider.jar.test.JarProviderTestCase;
24  import org.apache.commons.vfs.provider.jar.test.NestedJarTestCase;
25  import org.apache.commons.vfs.provider.sftp.test.SftpProviderTestCase;
26  import org.apache.commons.vfs.provider.tar.test.NestedTarTestCase;
27  import org.apache.commons.vfs.provider.tar.test.NestedTbz2TestCase;
28  import org.apache.commons.vfs.provider.tar.test.NestedTgzTestCase;
29  import org.apache.commons.vfs.provider.tar.test.TarProviderTestCase;
30  import org.apache.commons.vfs.provider.tar.test.Tbz2ProviderTestCase;
31  import org.apache.commons.vfs.provider.tar.test.TgzProviderTestCase;
32  import org.apache.commons.vfs.provider.zip.test.NestedZipTestCase;
33  import org.apache.commons.vfs.provider.zip.test.ZipProviderTestCase;
34  import org.apache.commons.vfs.provider.ftp.test.FtpProviderTestCase;
35  import org.apache.commons.vfs.provider.local.test.LocalProviderTestCase;
36  import org.apache.commons.vfs.provider.res.test.ResourceProviderTestCase;
37  import org.apache.commons.vfs.provider.temp.test.TemporaryProviderTestCase;
38  import org.apache.commons.vfs.provider.url.test.UrlProviderTestCase;
39  import org.apache.commons.vfs.provider.url.test.UrlProviderHttpTestCase;
40  import org.apache.commons.vfs.provider.test.VirtualProviderTestCase;
41  import org.apache.commons.vfs.provider.test.GenericFileNameTestCase;
42  import org.apache.commons.vfs.provider.ram.test.RamProviderTestCase;
43  
44  import java.util.Properties;
45  
46  public class RunTest
47  {
48  	public static void main(String[] args) throws Exception
49  	{
50  		Properties props = System.getProperties();
51  		props.setProperty("test.data.src", "src/test-data");
52  		props.setProperty("test.basedir", "core/target/test-classes/test-data");
53  		props.setProperty("test.basedir.res", "test-data");
54  		props.setProperty("test.policy", "src/test-data/test.policy");
55  		props.setProperty("test.secure", "false");
56  		props.setProperty("test.smb.uri",
57  				"smb://HOME//vfsusr:vfs%2f%25//te:st@172.16.110.129/vfsusr/vfstest");
58  		props.setProperty("test.ftp.uri",
59  				"ftp://vfsusr:vfs%2f%25//te:st@172.16.110.129/vfstest");
60  		props.setProperty("test.http.uri", "http://172.16.110.129/vfstest");
61  		props.setProperty("test.webdav.uri",
62  				"webdav://vfsusr:vfs%2f%25//te:st@172.16.110.129/vfstest");
63  		props.setProperty("test.sftp.uri",
64  				"sftp://vfsusr:vfs%2f%25//te:st@172.16.110.129/vfstest");
65  
66  		Test tests[] = new Test[]
67  		{
68  			RamProviderTestCase.suite(),
69  
70  			// SmbProviderTestCase.suite(),
71  
72  		// LocalProviderTestCase.suite(),
73  			
74  		// FtpProviderTestCase.suite(),
75  
76  		// UrlProviderHttpTestCase.suite(),
77  
78  		// VirtualProviderTestCase.suite(),
79  		// TemporaryProviderTestCase.suite(),
80  		// UrlProviderTestCase.suite(),
81  		// ResourceProviderTestCase.suite(),
82  
83  		// HttpProviderTestCase.suite(),
84  
85  		// WebdavProviderTestCase.suite(),
86  
87  		// SftpProviderTestCase.suite(),
88  
89  		// JarProviderTestCase.suite(),
90  //		NestedJarTestCase.suite(),
91  //		ZipProviderTestCase.suite(),
92  //		NestedZipTestCase.suite(),
93  //		TarProviderTestCase.suite(),
94  //		TgzProviderTestCase.suite(),
95  //		Tbz2ProviderTestCase.suite(),
96  //		NestedTarTestCase.suite(),
97  //		NestedTgzTestCase.suite(),
98  //		NestedTbz2TestCase.suite(),
99  		};
100 
101 		TestResult result = new TestResult()
102 		{
103 			public void startTest(Test test)
104 			{
105 				System.out.println("start " + test);
106 				System.out.flush();
107 			}
108 
109 			public void endTest(Test test)
110 			{
111 				// System.err.println("end " + test);
112 			}
113 
114 			public synchronized void addError(Test test, Throwable throwable)
115 			{
116 				// throw new RuntimeException(throwable.getMessage());
117 				throwable.printStackTrace();
118 			}
119 
120 			public synchronized void addFailure(Test test,
121 					AssertionFailedError assertionFailedError)
122 			{
123 				// throw new RuntimeException(assertionFailedError.getMessage());
124 				assertionFailedError.printStackTrace();
125 			}
126 		};
127 
128 		for (int i = 0; i < tests.length; i++)
129 		{
130 			System.out.println("start test#" + i);
131 			System.out.flush();
132 
133 			Test test = tests[i];
134 			test.run(result);
135 
136 			// break;
137 		}
138 	}
139 }