1 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 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 } 37 public void doTestDeploy() throws Exception { 38 String [] args = {"samples/stock/deploy.wsdd"}; 39 AdminClient.main(args); 40 } 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 } 49 public void doTestGetQuoteMain() throws Exception { 50 String [] args = {"-uuser1", "-wpass1", "XXX"}; 51 GetQuote1.main(args); 52 } 54 public void doTestUndeploy() throws Exception { 55 String [] args = {"samples/stock/undeploy.wsdd"}; 56 AdminClient.main(args); 57 } 59 77 public void testGetInfo() throws Exception { 78 try { 79 log.info("Testing JAX-RPC GetInfo sample."); 80 log.info("Testing deployment..."); 81 doTestDeploy(); 82 log.info("Testing service..."); 83 String [] args = {"-uuser3", "-wpass3", "IBM", "symbol"}; 84 GetInfo.main(args); 85 args = new String [] {"-uuser3", "-wpass3", "MACR", "name"}; 86 GetInfo.main(args); 87 args = new String [] {"-uuser3", "-wpass3", "CSCO", "address"}; 88 GetInfo.main(args); 89 log.info("Testing undeployment..."); 90 doTestUndeploy(); 91 log.info("Test complete."); 92 } 93 catch (Throwable t) { 94 t.printStackTrace(); 95 throw new Exception ("Fault returned from test: " + t); 96 } 97 } 99 public void testHello() throws Exception { 100 try { 101 log.info("Testing JAX-RPC hello sample."); 102 samples.jaxrpc.hello.HelloClient.main(new String []{}); 103 log.info("Test complete."); 104 } 105 catch (Throwable t) { 106 t.printStackTrace(); 107 throw new Exception ("Fault returned from test: " + t); 108 } 109 } 110 111 public void testAddress() throws Exception { 112 try { 113 log.info("Testing JAX-RPC Address sample."); 114 samples.jaxrpc.address.AddressClient.main(new String []{}); 115 log.info("Test complete."); 116 } 117 catch (Throwable t) { 118 t.printStackTrace(); 119 throw new Exception ("Fault returned from test: " + t); 120 } 121 } 122 123 public static void main(String args[]) throws Exception { 124 TestJAXRPCSamples tester = new TestJAXRPCSamples("tester"); 125 tester.testHello(); 126 tester.testAddress(); 127 } } 129 130 131 | Popular Tags |