1 16 17 package test.functional; 18 19 import junit.framework.TestCase; 20 import org.apache.axis.AxisFault; 21 import org.apache.axis.client.AdminClient; 22 import org.apache.axis.components.logger.LogFactory; 23 import org.apache.commons.logging.Log; 24 import samples.transport.FileTest; 25 26 27 29 public class TestTransportSample extends TestCase { 30 static Log log = 31 LogFactory.getLog(TestTransportSample.class.getName()); 32 33 public TestTransportSample(String name) { 34 super(name); 35 } 36 37 public void doTestDeploy () throws Exception { 38 String [] args = { "-llocal:", "samples/transport/deploy.wsdd" }; 39 AdminClient.main(args); 40 } 41 42 45 46 public void doTestIBM () throws Exception { 47 String [] args = { "IBM" }; 48 try { 49 FileTest.main(args); 50 } catch (AxisFault e) { 51 String fault = e.getFaultString(); 52 if (fault == null) throw e; 53 if (fault.indexOf("java.net.UnknownHost")<0) { 54 int start = fault.indexOf(": "); 55 log.info(fault.substring(start+2)); 56 } else if (fault.equals("timeout")) { 57 log.info("timeout"); 58 } else { 59 throw e; 60 } 61 } 62 } 63 64 public void doTestXXX () throws Exception { 65 String [] args = { "XXX" }; 66 FileTest.main(args); 67 } 68 69 public void testService () throws Exception { 70 try { 71 log.info("Testing transport sample."); 72 log.info("Testing deployment..."); 73 doTestDeploy(); 74 log.info("Testing service with symbol IBM..."); 75 doTestIBM(); 76 log.info("Testing service with symbol XXX..."); 77 doTestXXX(); 78 log.info("Test complete."); 79 } 80 catch( Exception e ) { 81 e.printStackTrace(); 82 throw new Exception ("Fault returned from test: "+e); 83 } 84 } 85 86 89 public static void main (String [] args) throws Exception { 90 new TestTransportSample("foo").testService(); 91 } 92 } 93 94 | Popular Tags |