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.axis.transport.http.SimpleAxisWorker; 23 import org.apache.axis.utils.NetworkUtils; 24 import org.apache.commons.logging.Log; 25 import samples.encoding.TestElem; 26 27 28 30 public class TestElementSample extends TestCase { 31 static Log log = 32 LogFactory.getLog(TestElementSample.class.getName()); 33 34 public TestElementSample(String name) { 35 super(name); 36 } 37 38 public void doTestElement () throws Exception { 39 String thisHost = NetworkUtils.getLocalHostname(); 40 String thisPort = System.getProperty("test.functional.ServicePort","8080"); 41 42 String [] args = {thisHost,thisPort}; 43 String xml = "<x:hello xmlns:x=\"urn:foo\">a string</x:hello>"; 44 System.out.println("Sending : " + xml ); 45 String res = TestElem.doit(args, xml); 46 System.out.println("Received: " + res ); 47 assertEquals("TestElementSample.doit(): xml must match", res, xml); 48 } 49 50 public void doTestDeploy () throws Exception { 51 String [] args = { "samples/encoding/deploy.wsdd" }; 52 AdminClient.main(args); 53 } 54 55 public void doTestUndeploy () throws Exception { 56 String [] args = { "samples/encoding/undeploy.wsdd" }; 57 AdminClient.main(args); 58 } 59 60 public static void main(String args[]) throws Exception { 61 TestElementSample tester = new TestElementSample("tester"); 62 tester.testElementService(); 63 } 64 65 public void testElementService () throws Exception { 66 log.info("Testing element sample."); 67 log.info("Testing deployment..."); 68 doTestDeploy(); 69 log.info("Testing service..."); 70 doTestElement(); 71 log.info("Testing undeployment..."); 72 doTestUndeploy(); 73 log.info("Test complete."); 74 } 75 } 76 77 78 | Popular Tags |