KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > functional > TestBidBuySample


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

28 public class TestBidBuySample extends TestCase {
29     static Log log =
30             LogFactory.getLog(TestBidBuySample.class.getName());
31
32     public TestBidBuySample(String JavaDoc name) {
33         super(name);
34     }
35     
36     public void doTestDeploy () throws Exception JavaDoc {
37         String JavaDoc[] args = { "samples/bidbuy/deploy.wsdd" };
38         AdminClient.main(args);
39     }
40     
41     public void doTest () throws Exception JavaDoc {
42         String JavaDoc[] args = { "http://localhost:8080" };
43         TestClient.main(args);
44     }
45     
46     public void testBidBuyService () throws Exception JavaDoc {
47         try {
48             log.info("Testing bidbuy sample.");
49             log.info("Testing deployment...");
50             doTestDeploy();
51             log.info("Testing service...");
52             doTest();
53             log.info("Test complete.");
54         }
55         catch( Exception JavaDoc e ) {
56             e.printStackTrace();
57             throw new Exception JavaDoc("Fault returned from test: "+e);
58         }
59     }
60
61     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
62         TestBidBuySample tester = new TestBidBuySample("test");
63         tester.testBidBuyService();
64     }
65 }
66
67
Popular Tags