KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > functional > TestEchoSample


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.echo.TestClient;
24
25 /** Test the stock sample code.
26  */

27 public class TestEchoSample extends TestCase {
28     static Log log =
29             LogFactory.getLog(TestEchoSample.class.getName());
30
31     public TestEchoSample(String JavaDoc name) {
32         super(name);
33     }
34
35     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
36         TestEchoSample tester = new TestEchoSample("tester");
37         tester.testEchoService();
38     }
39
40     public void testEchoService () throws Exception JavaDoc {
41         log.info("Testing echo interop sample.");
42
43         // deploy the echo service
44
String JavaDoc[] args = {"-l",
45                          "local:///AdminService",
46                          "samples/echo/deploy.wsdd"};
47         AdminClient.main(args);
48
49         // define the tests using JUnit assert facilities, and tell client to
50
// throw any exceptions it catches.
51
TestClient client = new TestClient(true) {
52             public void verify(String JavaDoc method, Object JavaDoc sent, Object JavaDoc gotBack) {
53                 assertTrue("What was sent was not received--" + method + ": " + gotBack, equals(sent, gotBack));
54             }
55         };
56
57         // run the tests using a local (in process) server
58
client.setURL("local:");
59         client.executeAll();
60
61         log.info("Test complete.");
62     }
63 }
64
65
Popular Tags