Debian Codegraph @

test/functional/TestJAXRPCSamples.java

raw
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.jaxrpc.GetInfo;
24 import samples.jaxrpc.GetQuote1;
25
26
27 /**
28 * Test the JAX-RPC compliance samples.
29 */
30 public class TestJAXRPCSamples extends TestCase {
31 static Log log = LogFactory.getLog(TestJAXRPCSamples.class.getName());
32
33 public TestJAXRPCSamples(String name) {
34 super(name);
35 } // ctor
36
37 public void doTestDeploy() throws Exception {
38 String[] args = {"samples/stock/deploy.wsdd"};
39 AdminClient.main(args);
40 } // doTestDeploy
41
42 public void doTestGetQuoteXXX() throws Exception {
43 String[] args = {"-uuser1", "-wpass1", "XXX"};
44 float val = new GetQuote1().getQuote1(args);
45 assertEquals("Stock price is not the expected 55.25 +/- 0.01", val,
46 55.25, 0.01);
47 } // doTestGetQuoteXXX
48
49 public void doTestGetQuoteMain() throws Exception {
50 String[] args = {"-uuser1", "-wpass1", "XXX"};
51 GetQuote1.main(args);
52 } // doTestGetQuoteMain
53
54 public void doTestUndeploy() throws Exception {
55 String[] args = {"samples/stock/undeploy.wsdd"};
56 AdminClient.main(args);
57 } // doTestStockNoAction
58
59 // public void testGetQuote() throws Exception {
60 // try {
61 // log.info("Testing JAX-RPC GetQuote1 sample.");
62 // log.info("Testing deployment...");
63 // doTestDeploy();
64 // log.info("Testing service...");
65 // doTestGetQuoteXXX();
66 // doTestGetQuoteMain();
67 // log.info("Testing undeployment...");
68 // doTestUndeploy();
69 // log.info("Test complete.");
70 // }
71 // catch (Throwable t) {
72 // t.printStackTrace();
73 // throw new Exception("Fault returned from test: " + t);
74 // }
75 // } // testGetQuote
76
77 public void testGetInfo() throws Exception {
78 log.info("Testing JAX-RPC GetInfo sample.");
79 log.info("Testing deployment...");
80 doTestDeploy();
81 log.info("Testing service...");
82 String[] args = {"-uuser3", "-wpass3", "IBM", "symbol"};
83 GetInfo.main(args);
84 args = new String[] {"-uuser3", "-wpass3", "MACR", "name"};
85 GetInfo.main(args);
86 args = new String[] {"-uuser3", "-wpass3", "CSCO", "address"};
87 GetInfo.main(args);
88 log.info("Testing undeployment...");
89 doTestUndeploy();
90 log.info("Test complete.");
91 } // testGetInfo
92
93 public void testHello() throws Exception {
94 log.info("Testing JAX-RPC hello sample.");
95 samples.jaxrpc.hello.HelloClient.main(new String[]{});
96 log.info("Test complete.");
97 }
98
99 public void testAddress() throws Exception {
100 log.info("Testing JAX-RPC Address sample.");
101 samples.jaxrpc.address.AddressClient.main(new String[]{});
102 log.info("Test complete.");
103 }
104
105 public static void main(String args[]) throws Exception {
106 TestJAXRPCSamples tester = new TestJAXRPCSamples("tester");
107 tester.testHello();
108 tester.testAddress();
109 } // main
110 }
111
112