1 22 package org.jboss.test.webservice.admindevel; 23 24 import junit.framework.Test; 25 import org.jboss.test.webservice.WebserviceTestBase; 26 27 import javax.naming.InitialContext ; 28 import javax.xml.rpc.Service ; 29 30 35 public class ExampleTestCase extends WebserviceTestBase 36 { 37 private static Hello helloPort; 38 39 public ExampleTestCase(String name) 40 { 41 super(name); 42 } 43 44 45 public static Test suite() throws Exception 46 { 47 return getDeploySetup(ExampleTestCase.class, "ws4ee-admindevel.jar, ws4ee-admindevel-client.jar"); 48 } 49 50 protected void setUp() throws Exception 51 { 52 super.setUp(); 53 if (helloPort == null) 54 { 55 InitialContext iniCtx = getClientContext(); 56 Service service = (Service )iniCtx.lookup("java:comp/env/service/HelloService"); 57 helloPort = (Hello)service.getPort(Hello.class); 58 } 59 } 60 61 public void testHelloString() throws Exception 62 { 63 64 String retStr = helloPort.helloString("Kermit"); 65 assertEquals("Hello Kermit!", retStr); 66 } 67 68 public void testHelloBean() throws Exception 69 { 70 HelloObj ho = new HelloObj("Kermit"); 71 HelloObj hro = helloPort.helloBean(ho); 72 assertEquals("Hello Kermit!", hro.getMsg()); 73 } 74 75 public void testHelloArray() throws Exception 76 { 77 HelloObj[] query = new HelloObj[3]; 78 HelloObj ho = new HelloObj(); 79 ho.setMsg("Kermit"); 80 query[0] = ho; 81 ho = new HelloObj(); 82 ho.setMsg("Piggy"); 83 query[1] = ho; 84 ho = new HelloObj(); 85 ho.setMsg("Fozzy"); 86 query[2] = ho; 87 88 HelloObj[] reply = helloPort.helloArray(query); 89 for (int i = 0; i < reply.length; i++) 90 { 91 HelloObj replyObj = reply[i]; 92 assertEquals("Hello " + query[i].getMsg() + "!", replyObj.getMsg()); 93 } 94 } 95 } 96 | Popular Tags |