1 22 package org.jboss.test.webservice.ws4eesimple; 23 24 import junit.framework.Test; 25 import org.jboss.test.webservice.WebserviceTestBase; 26 27 import javax.naming.Context ; 28 import javax.xml.rpc.Service ; 29 import javax.xml.rpc.Stub ; 30 31 37 public class ClientStubTestCase extends WebserviceTestBase 38 { 39 42 public ClientStubTestCase(String name) 43 { 44 super(name); 45 } 46 47 50 public static Test suite() throws Exception 51 { 52 return getDeploySetup(ClientStubTestCase.class, "ws4ee-simple.jar, ws4ee-simple-client.ear"); 53 } 54 55 58 public void testClientStub() throws Exception 59 { 60 Context iniCtx = getClientContext(); 61 Service service = (Service )iniCtx.lookup("java:comp/env/service/HelloService"); 62 HelloWs port = (HelloWs)service.getPort(HelloWs.class); 63 64 String res = port.sayHello("Hello"); 65 assertEquals("'Hello' to you too!", res); 66 67 Stub stub = (Stub )port; 68 stub._setProperty(Stub.USERNAME_PROPERTY, "kermit"); 69 assertEquals("kermit", stub._getProperty(Stub.USERNAME_PROPERTY)); 70 71 stub._setProperty(Stub.PASSWORD_PROPERTY, "thefrog"); 72 assertEquals("thefrog", stub._getProperty(Stub.PASSWORD_PROPERTY)); 73 74 Boolean sessionMaintain = (Boolean )stub._getProperty(Stub.SESSION_MAINTAIN_PROPERTY); 75 assertTrue(sessionMaintain == null || sessionMaintain.booleanValue() == false); 76 stub._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, new Boolean (true)); 77 assertTrue(((Boolean )stub._getProperty(Stub.SESSION_MAINTAIN_PROPERTY)).booleanValue()); 78 79 assertEquals("http://" + getServerHost() + ":8080/ws4ee-simple/HelloEjb", stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY)); 80 stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://" + getServerHost() + ":8080/ws4ee-simple/DummyService"); 81 assertEquals("http://" + getServerHost() + ":8080/ws4ee-simple/DummyService", stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY)); 82 } 83 } 84 | Popular Tags |