KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > interop3 > Interop3TestCase


1 package test.wsdl.interop3;
2
3 import junit.framework.TestSuite;
4 import junit.textui.TestRunner;
5 import org.apache.axis.utils.ClassUtils;
6
7 import java.io.FileInputStream JavaDoc;
8 import java.lang.reflect.Field JavaDoc;
9 import java.net.URL JavaDoc;
10 import java.util.Iterator JavaDoc;
11 import java.util.Properties JavaDoc;
12
13 public class Interop3TestCase {
14
15     public static void usage() {
16         System.out.println("java test.wsdl.interop3.Interop3TestCase <URL property file>");
17     } // usage
18

19     public static void main(String JavaDoc[] args) {
20         try {
21             if (args.length != 1) {
22                 usage();
23                 System.exit(0);
24             }
25             Properties JavaDoc props = new Properties JavaDoc();
26             props.load(new FileInputStream JavaDoc(args[0]));
27             Iterator JavaDoc it = props.keySet().iterator();
28             while (it.hasNext()) {
29                 String JavaDoc key = (String JavaDoc) it.next();
30                 URL JavaDoc value = new URL JavaDoc((String JavaDoc) props.get(key));
31                 try {
32                     Class JavaDoc test = ClassUtils.forName(key);
33                     Field JavaDoc urlField = test.getField("url");
34                     urlField.set(null, value);
35                     TestRunner.run(new TestSuite(test));
36                 }
37                 catch (Throwable JavaDoc t) {
38                     System.err.println("Failure running " + key);
39                     t.printStackTrace();
40                 }
41             }
42         }
43         catch (Throwable JavaDoc t) {
44         }
45     } // main
46
} // class Interop3TestCase
47

48
Popular Tags