KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > functional > TestProxySample


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package test.functional;
18
19 import junit.framework.TestCase;
20 import org.apache.axis.client.AdminClient;
21 import org.apache.axis.components.logger.LogFactory;
22 import org.apache.commons.logging.Log;
23 import samples.misc.TestClient;
24
25
26 /** Test the proxy sample code.
27  */

28 public class TestProxySample extends TestCase {
29     static Log log =
30             LogFactory.getLog(TestProxySample.class.getName());
31
32     public TestProxySample(String JavaDoc name) {
33         super(name);
34     }
35     
36     public void doTest () throws Exception JavaDoc {
37         String JavaDoc[] args = { "-d" };
38         TestClient.mainWithService(args, "ProxyService");
39     }
40     
41     // temp for debugging
42
public static void main (String JavaDoc[] args) throws Exception JavaDoc {
43         new TestProxySample("foo").doTest();
44     }
45     
46     public void testService () throws Exception JavaDoc {
47         try {
48             log.info("Testing proxy sample.");
49             
50             log.info("Testing deployment...");
51             
52             // deploy the proxy service
53
String JavaDoc[] args = { "samples/proxy/deploy.wsdd" };
54             AdminClient.main(args);
55             
56             log.info("Testing server-side client deployment...");
57             
58             // deploy the proxy service
59
String JavaDoc[] args2 = { "samples/proxy/client_deploy.xml" };
60             AdminClient.main(args2);
61             
62             log.info("Testing service...");
63             doTest();
64             log.info("Test complete.");
65         }
66         catch( Exception JavaDoc e ) {
67             e.printStackTrace();
68             throw new Exception JavaDoc("Fault returned from test: "+e);
69         }
70     }
71 }
72
73
Popular Tags