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.message.TestMsg; 24 25 26 28 public class TestMessageSample extends TestCase { 29 static Log log = 30 LogFactory.getLog(TestMessageSample.class.getName()); 31 32 public TestMessageSample(String name) { 33 super(name); 34 } 35 36 public void doTestDeploy() throws Exception { 37 String [] args = { "samples/message/deploy.wsdd" }; 38 AdminClient.main(args); 39 } 40 41 public void doTestMessage() throws Exception { 42 String [] args = { }; 43 String res = (new TestMsg()).doit(args); 44 String expected="Res elem[0]=<ns1:e1 xmlns:ns1=\"urn:foo\">Hello</ns1:e1>" 45 +"Res elem[1]=<ns2:e1 xmlns:ns2=\"urn:foo\">World</ns2:e1>" 46 +"Res elem[2]=<ns3:e3 xmlns:ns3=\"urn:foo\">" 47 +"<![CDATA[" 48 +"Text with\n\tImportant <b> whitespace </b> and tags! " 49 +"]]>" 50 +"</ns3:e3>"; 51 assertEquals("test result elements", expected, res); 52 } 53 54 public void doTestUndeploy () throws Exception { 55 String [] args = { "samples/message/undeploy.wsdd" }; 56 AdminClient.main(args); 57 } 58 59 public static void main(String args[]) throws Exception { 60 TestMessageSample tester = new TestMessageSample("tester"); 61 tester.testMessageService(); 62 } 63 64 public void testMessageService () throws Exception { 65 try { 66 log.info("Testing message sample."); 67 log.info("Testing deployment..."); 68 doTestDeploy(); 69 log.info("Testing service..."); 70 doTestMessage(); 71 doTestUndeploy(); 72 log.info("Test complete."); 73 } 74 catch( Exception e ) { 75 e.printStackTrace(); 76 throw new Exception ("Fault returned from test: "+e); 77 } 78 } 79 80 } 81 82 83 | Popular Tags |