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