1 7 package org.jboss.test.jbossnet.admindevel; 8 9 import junit.framework.Test; 10 import org.jboss.test.JBossTestCase; 11 12 17 public class ExampleTestCase extends JBossTestCase 18 { 19 private Hello helloPort; 20 21 public ExampleTestCase(String name) 22 { 23 super(name); 24 } 25 26 protected void setUp() throws Exception 27 { 28 super.setUp(); 29 HelloServiceLocator locator = new HelloServiceLocator(); 30 helloPort = locator.getHello(); 31 } 32 33 public void testHelloString() throws Exception 34 { 35 String retStr = helloPort.helloString("Kermit"); 36 assertEquals("Hello Kermit!", retStr); 37 } 38 39 public void testHelloBean() throws Exception 40 { 41 HelloObj ho = new HelloObj("Kermit"); 42 HelloReplyObj hro = helloPort.helloBean(ho); 43 assertEquals("Hello Kermit!", hro.getMsg()); 44 } 45 46 public void testHelloArray() throws Exception 47 { 48 HelloObj[] query = new HelloObj[3]; 49 HelloObj ho = new HelloObj(); 50 ho.setMsg("Kermit"); 51 query[0] = ho; 52 ho = new HelloObj(); 53 ho.setMsg("Piggy"); 54 query[1] = ho; 55 ho = new HelloObj(); 56 ho.setMsg("Fozzy"); 57 query[2] = ho; 58 59 Object [] reply = helloPort.helloArray(query); 60 for (int i = 0; i < reply.length; i++) 61 { 62 HelloReplyObj replyObj = (HelloReplyObj)reply[i]; 63 assertEquals("Hello " + query[i].getMsg() + "!", replyObj.getMsg()); 64 } 65 } 66 67 68 public static Test suite() throws Exception 69 { 70 return getDeploySetup(ExampleTestCase.class, "jbossnet-admindevel.ear"); 71 } 72 73 } 74 | Popular Tags |