View Javadoc
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.vfs2;
18  
19  import java.util.Properties;
20  
21  import junit.framework.AssertionFailedError;
22  import junit.framework.Test;
23  import junit.framework.TestResult;
24  
25  public class RunTest {
26      public static void main(final String[] args) throws Exception {
27          final String ip = "192.168.0.128";
28  
29          final Properties props = System.getProperties();
30          props.setProperty("test.data.src", "src/test-data");
31          props.setProperty("test.basedir", "core/target/test-classes/test-data");
32          props.setProperty("test.basedir.res", "test-data");
33          props.setProperty("test.policy", "src/test-data/test.policy");
34          props.setProperty("test.secure", "false");
35          props.setProperty("test.smb.uri", "smb://HOME\\vfsusr:vfs%2f%25\\te:st@" + ip + "/vfsusr/vfstest");
36          props.setProperty("test.ftp.uri", "ftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");
37          props.setProperty("test.ftps.uri", "ftps://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");
38  
39          props.setProperty("test.http.uri", "http://" + ip + "/vfstest");
40          //props.setProperty("test.webdav.uri", "webdav://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");
41          props.setProperty("test.sftp.uri", "sftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");
42  
43          final Test[] tests = new Test[] {
44                  // LocalProviderTestCase.suite(),
45                  // FtpProviderTestCase.suite(),
46                  // UrlProviderHttpTestCase.suite(),
47                  // VirtualProviderTestCase.suite(),
48                  // TemporaryProviderTestCase.suite(),
49                  // UrlProviderTestCase.suite(),
50                  // ResourceProviderTestCase.suite(),
51                  // HttpProviderTestCase.suite(),
52                  // AbstractSftpProviderTestCase.suite(),
53                  // JarProviderTestCase.suite(),
54                  // NestedJarTestCase.suite(),
55                  // ZipProviderTestCase.suite(),
56                  // NestedZipTestCase.suite(),
57                  // TarProviderTestCase.suite(),
58                  // TgzProviderTestCase.suite(),
59                  // Tbz2ProviderTestCase.suite(),
60                  // NestedTarTestCase.suite(),
61                  // NestedTgzTestCase.suite(),
62                  // NestedTbz2TestCase.suite(),
63                  // RamProviderTestCase.suite(),
64  
65                  // SmbProviderTestCase.suite(),
66                  // WebdavProviderTestCase.suite(),
67          };
68  
69          final TestResult result = new TestResult() {
70              @Override
71              public synchronized void addError(final Test test, final Throwable throwable) {
72                  // throw new RuntimeException(throwable.getMessage());
73                  throwable.printStackTrace();
74              }
75  
76              @Override
77              public synchronized void addFailure(final Test test, final AssertionFailedError assertionFailedError) {
78                  // throw new RuntimeException(assertionFailedError.getMessage());
79                  assertionFailedError.printStackTrace();
80              }
81  
82              @Override
83              public void endTest(final Test test) {
84                  // System.err.println("end " + test);
85              }
86  
87              @Override
88              public void startTest(final Test test) {
89                  System.out.println("start " + test);
90                  System.out.flush();
91              }
92          };
93  
94          for (int i = 0; i < tests.length; i++) {
95              System.out.println("start test#" + i);
96              System.out.flush();
97  
98              final Test test = tests[i];
99              test.run(result);
100 
101             // break;
102         }
103     }
104 }