From 574b17f369e247d6711421eeeaf6d4759e7fb2e1 Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 1 Oct 2009 15:23:45 +0000 Subject: TUSCANY-3283 - improve the wsdlgen test case to test the situation where a type with a namespace references a type without a namespace git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820686 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/helloworld/HttpTransportTestCase.java | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'branches/sca-java-1.x/itest/wsdlgen/src/test/java') 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 + } -- cgit v1.2.3