diff options
Diffstat (limited to 'branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java')
-rw-r--r-- | branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java b/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java index d52db8e812..c5c1d50bc1 100644 --- a/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java +++ b/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java @@ -22,6 +22,11 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; import org.apache.tuscany.sca.host.embedded.SCADomain; import org.junit.After; @@ -29,6 +34,10 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import yetanotherpackage.DBean; + +import anotherpackage.BBean; + /** * Tests that the helloworld server is available */ @@ -42,11 +51,54 @@ public class HttpTransportTestCase{ } @Test - public void testComponent1() throws IOException { + public void testComponent1SCA() throws IOException { HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent1/HelloWorldService"); assertNotNull(helloWorldService); + HelloWorldService helloWorldClient = scaDomain.getService(HelloWorldService.class, "HelloWorldClientComponent1/HelloWorldService"); + assertNotNull(helloWorldClient); + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + assertEquals("Hello Hello Smith", helloWorldClient.getGreetings("Smith")); + + BBean bbean = new BBean(); + bbean.setField1("1"); + bbean.setField2("2"); + + DBean abean = new DBean(); + abean.setField1("3"); + abean.setField2("4"); + abean.setField3(bbean); + + assertEquals("Hello Hello 3 4 1 2", helloWorldClient.getGreetingsDBean(abean)); + } + + @Test + public void testComponent1JAXWS() throws IOException { + + // talk to the service using JAXWS with WSDL generated from this service used wsgen + // the idea here is to demonstrate that the service is providing a JAXWS compliant + // interface + QName serviceName = new QName("http://helloworld/", "HelloWorldImplService"); + URL wsdlLocation = this.getClass().getClassLoader().getResource("wsdl/HelloWorldImplService.wsdl"); + Service webService = Service.create( wsdlLocation, serviceName ); + HelloWorldService wsProxy = (HelloWorldService) webService.getPort(HelloWorldService.class); + + assertEquals("Hello Fred", wsProxy.getGreetings("Fred")); + + BBean bbean = new BBean(); + bbean.setField1("1"); + bbean.setField2("2"); + + DBean abean = new DBean(); + abean.setField1("3"); + abean.setField2("4"); + abean.setField3(bbean); + + assertEquals("Hello 3 4 1 2", wsProxy.getGreetingsDBean(abean)); + + // repeat the JAXWS call with WSDL generated by tuscany + } |