From 7c15e6611d5681311b318db073ac7651a72adf21 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 10 Nov 2010 12:37:38 +0000 Subject: TUSCANY-3778 - changes to demonstrate the issues described in the JIRA. The failing tests are commented out. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1033436 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/helloworld/HelloWorldClientImpl.java | 11 +- .../src/main/java/helloworld/HelloWorldImpl.java | 12 +- .../main/java/helloworld/HelloWorldService.java | 12 +- .../yetanotherpackage/HelloWorldException.java | 44 ++++ .../wsdl/HelloWorldService_TuscanyGen.wsdl | 260 +++++++++++++++------ .../java/helloworld/HttpTransportTestCase.java | 27 ++- .../test/resources/wsdl/HelloWorldImplService.wsdl | 49 +++- .../wsdl/HelloWorldImplService_schema2.xsd | 40 ++++ 8 files changed, 368 insertions(+), 87 deletions(-) create mode 100644 sca-java-1.x/trunk/itest/wsdlgen/src/main/java/yetanotherpackage/HelloWorldException.java (limited to 'sca-java-1.x/trunk/itest') diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java index 04fbe6934a..4ee6056438 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java @@ -23,6 +23,7 @@ import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Service; import yetanotherpackage.DBean; +import yetanotherpackage.HelloWorldException; import anotherpackage.BBean; import anotherpackage.CBean; @@ -64,5 +65,13 @@ public class HelloWorldClientImpl implements HelloWorldService { public String getGreetingsDBean(DBean bean){ return "Hello " + hwService.getGreetingsDBean(bean); - } + } + + public String getGreetingsException(String input) throws HelloWorldException { + return hwService.getGreetingsException(input); + } + + public byte[] getGreetingsByteArray(byte[] input) { + return input; + } } diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java index a92a819aaf..7dc779c930 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java @@ -23,6 +23,7 @@ import javax.jws.WebService; import org.osoa.sca.annotations.Service; import yetanotherpackage.DBean; +import yetanotherpackage.HelloWorldException; import anotherpackage.BBean; import anotherpackage.CBean; @@ -65,5 +66,14 @@ public class HelloWorldImpl implements HelloWorldService { return "Hello " + bean.getField1() + " " + bean.getField2() + " " + bean.getField3().getField1() + " " + bean.getField3().getField2(); - } + } + + public String getGreetingsException(String input) throws HelloWorldException { + throw new HelloWorldException("Hello " + input); + } + + public byte[] getGreetingsByteArray(byte[] input){ + System.out.println(String.valueOf(input)); + return input; + } } diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java index 6b0425d473..f62a998df2 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java @@ -23,6 +23,7 @@ import javax.jws.WebService; import org.osoa.sca.annotations.Remotable; import yetanotherpackage.DBean; +import yetanotherpackage.HelloWorldException; import anotherpackage.BBean; import anotherpackage.CBean; @@ -33,13 +34,20 @@ import anotherpackage.CBean; @WebService @Remotable public interface HelloWorldService { + + // primitives + public String getGreetings(String name); + byte[] getGreetingsByteArray(byte[] input); + String getGreetingsException(String input) throws HelloWorldException; - public String getGreetings(String name); + // beans public String getGreetingsBean(ABean bean); public String getGreetingsBeanArray(ABean[] bean); - //public String getGreetingsBeanVector(Vector bean); public String getGreetingsBBean(BBean bean); public String getGreetingsCBean(CBean bean); public String getGreetingsDBean(DBean bean); + + // collections + //public String getGreetingsBeanVector(Vector bean); } diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/yetanotherpackage/HelloWorldException.java b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/yetanotherpackage/HelloWorldException.java new file mode 100644 index 0000000000..caf0c357bb --- /dev/null +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/main/java/yetanotherpackage/HelloWorldException.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package yetanotherpackage; + +public class HelloWorldException extends Exception { + + public HelloWorldException() { + } + + public HelloWorldException(String message) { + super(message); + } + + public HelloWorldException(Throwable cause) { + super(cause); + } + + public HelloWorldException(String message, Throwable cause) { + super(message, cause); + } + +/* + public HelloWorldException(String message, String errorCode) { + super(message, errorCode); + } +*/ + +} diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl b/sca-java-1.x/trunk/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl index 185aa2c649..a8bf30cb65 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl @@ -22,43 +22,74 @@ + xmlns:ns4="http://yetanotherpackage/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + - + + + - + - + - + - + + type="ns0:aBean" /> - + - - + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + - + - + + @@ -136,82 +200,86 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + - - - - + + + + - - + + - - - - - - + + - - - - - + - @@ -219,11 +287,30 @@ + + + + + + + + + + + + + + + + + @@ -231,9 +318,9 @@ - + @@ -241,9 +328,9 @@ - + @@ -251,10 +338,10 @@ - + @@ -262,9 +349,9 @@ - + @@ -272,9 +359,19 @@ + + + + + + + + + - + + @@ -282,17 +379,30 @@ + + + - + + + + + + + + + + + @@ -301,8 +411,8 @@ - + @@ -311,8 +421,8 @@ - + diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java b/sca-java-1.x/trunk/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java index 22f154fbf3..8d1694d1d7 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java @@ -20,9 +20,9 @@ package helloworld; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; +import static junit.framework.Assert.fail; import java.io.IOException; -import java.net.HttpURLConnection; import java.net.URL; import javax.xml.namespace.QName; @@ -85,15 +85,16 @@ public class HttpTransportTestCase{ } @Test - public void testComponent1JAXWS() throws IOException { + public void testComponent1JAXWSwsgen() 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"); + QName portName = new QName("http://helloworld/", "HelloWorldImplPort"); URL wsdlLocation = this.getClass().getClassLoader().getResource("wsdl/HelloWorldImplService.wsdl"); Service webService = Service.create( wsdlLocation, serviceName ); - HelloWorldService wsProxy = (HelloWorldService) webService.getPort(HelloWorldService.class); + HelloWorldService wsProxy = (HelloWorldService) webService.getPort(portName, HelloWorldService.class); assertEquals("Hello Fred", wsProxy.getGreetings("Fred")); @@ -107,10 +108,24 @@ public class HttpTransportTestCase{ abean.setField3(bbean); assertEquals("Hello 3 4 1 2", wsProxy.getGreetingsDBean(abean)); +/* TUSCANY-3778 + String byteArrayString = "Hello World"; + assertEquals(byteArrayString, String.valueOf(wsProxy.getGreetingsByteArray(byteArrayString.getBytes()))); - // repeat the JAXWS call with WSDL generated by tuscany - - } + try { + wsProxy.getGreetingsException("Fred"); + fail("exception not returned"); + } catch(Exception ex) { + + } +*/ + } + + @Test + public void testComponent1JAXWStuscanygen() throws IOException { + // repeat the JAXWS call with WSDL generated by tuscany + + } @After public void stopServer() throws Exception { diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService.wsdl b/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService.wsdl index 5fa0d565b1..157c4a573a 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService.wsdl +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService.wsdl @@ -45,7 +45,22 @@ - + + + + + + + + + + + + + + + + @@ -70,8 +85,17 @@ + + + + + + + + + - + @@ -127,6 +151,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService_schema2.xsd b/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService_schema2.xsd index 446492c371..ad2c2de492 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService_schema2.xsd +++ b/sca-java-1.x/trunk/itest/wsdlgen/src/test/resources/wsdl/HelloWorldImplService_schema2.xsd @@ -3,6 +3,8 @@ + + @@ -17,6 +19,10 @@ + + + + @@ -25,8 +31,30 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -46,6 +74,18 @@ + + + + + + + + + + + + -- cgit v1.2.3