diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-15 15:32:32 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-15 15:32:32 +0000 |
commit | 26f32e7e0dd8f659ee8b4553d1144a0201d6e005 (patch) | |
tree | a4b85ef25231c6e783750cf4528351d970f9cffe /sca-java-2.x/trunk | |
parent | 25388cb132c01c8444987326fa747546867a8903 (diff) |
Turn complex message passing test back on
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@954932 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
11 files changed, 294 insertions, 120 deletions
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Bar.java b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Bar.java deleted file mode 100644 index 379af8df00..0000000000 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Bar.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * 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 org.apache.tuscany.sca.binding.ws;
-
-import java.io.Serializable;
-
-public class Bar implements Serializable {
- private static final long serialVersionUID = 1249963611910502668L;
-
- private String s;
- private int x;
- private Integer y;
-
- private Boolean b;
-
- public Boolean getB() {
- return b;
- }
- public void setB(Boolean b) {
- this.b = b;
- }
- public String getS() {
- return s;
- }
- public void setS(String s) {
- this.s = s;
- }
- public int getX() {
- return x;
- }
- public void setX(int x) {
- this.x = x;
- }
- public Integer getY() {
- return y;
- }
- public void setY(Integer y) {
- this.y = y;
- }
-
-}
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Foo.java b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Foo.java deleted file mode 100644 index e4fee2c4c9..0000000000 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/Foo.java +++ /dev/null @@ -1,36 +0,0 @@ -/*
- * 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 org.apache.tuscany.sca.binding.ws;
-
-import java.io.Serializable;
-
-public class Foo implements Serializable {
- private static final long serialVersionUID = 4879476066850018458L;
-
- private Bar[] bars;
-
- public Bar[] getBars() {
- return bars;
- }
-
- public void setBars(Bar[] bars) {
- this.bars = bars;
- }
-}
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorld.java b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorld.java index 80ef9b5167..6bc67db5fc 100644 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorld.java +++ b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorld.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.binding.ws;
+import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.Foo;
import org.oasisopen.sca.ServiceRuntimeException;
import org.oasisopen.sca.annotation.Remotable;
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java index eb405471a8..8f57680d47 100644 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java +++ b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.ws; import javax.jws.WebService;
+import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.Foo;
import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.HelloWorldService;
import org.oasisopen.sca.ServiceRuntimeException;
import org.oasisopen.sca.annotation.Reference;
@@ -46,8 +47,9 @@ public class HelloWorldImpl implements HelloWorld { }
public Foo getGreetingsComplex(Foo foo){
- Foo response = null;//helloWorldExternal.getGreetingsComplex(foo);
- System.out.println("At client: " + response.getBars()[0].getS());
+ System.out.println("Entering SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
+ Foo response = helloWorldExternal.getGreetingsComplex(foo);
+ System.out.println("Leaving SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
return response;
}
}
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/HelloWorldServiceService_schema1.xsd b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/HelloWorldServiceService_schema1.xsd index e8d4340886..acdfcaaaa5 100644 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/HelloWorldServiceService_schema1.xsd +++ b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/HelloWorldServiceService_schema1.xsd @@ -21,6 +21,10 @@ <xs:element name="getGreetings" type="tns:getGreetings"/>
+ <xs:element name="getGreetingsComplex" type="tns:getGreetingsComplex"/>
+
+ <xs:element name="getGreetingsComplexResponse" type="tns:getGreetingsComplexResponse"/>
+
<xs:element name="getGreetingsResponse" type="tns:getGreetingsResponse"/>
<xs:complexType name="getGreetings">
@@ -34,5 +38,33 @@ <xs:element name="getGreetingsReturn" type="xs:string" form="qualified" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
+
+ <xs:complexType name="getGreetingsComplex">
+ <xs:sequence>
+ <xs:element name="arg0" type="tns:foo" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="foo">
+ <xs:sequence>
+ <xs:element name="bars" type="tns:bar" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="bar">
+ <xs:sequence>
+ <xs:element name="b" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="s" type="xs:string" minOccurs="0"/>
+ <xs:element name="x" type="xs:int"/>
+ <xs:element name="y" type="xs:int" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="getGreetingsComplexResponse">
+ <xs:sequence>
+ <xs:element name="return" type="tns:foo" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>
+
diff --git a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/helloworld-external-service.wsdl b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/helloworld-external-service.wsdl index 2aa1a8f149..837bcb059e 100644 --- a/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/helloworld-external-service.wsdl +++ b/sca-java-2.x/trunk/itest/ws/contribution-java-first/src/main/resources/helloworld-external-service.wsdl @@ -30,11 +30,21 @@ <message name="getGreetingsResponse">
<part name="parameters" element="tns:getGreetingsResponse"/>
</message>
+ <message name="getGreetingsComplex">
+ <part name="parameters" element="tns:getGreetingsComplex"/>
+ </message>
+ <message name="getGreetingsComplexResponse">
+ <part name="parameters" element="tns:getGreetingsComplexResponse"/>
+ </message>
<portType name="HelloWorldService">
<operation name="getGreetings">
<input message="tns:getGreetings"/>
<output message="tns:getGreetingsResponse"/>
</operation>
+ <operation name="getGreetingsComplex">
+ <input message="tns:getGreetingsComplex"/>
+ <output message="tns:getGreetingsComplexResponse"/>
+ </operation>
</portType>
<binding name="HelloWorldServicePortBinding" type="tns:HelloWorldService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
@@ -47,11 +57,19 @@ <soap:body use="literal"/>
</output>
</operation>
+ <operation name="getGreetingsComplex">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
</binding>
<service name="HelloWorldServiceService">
<port name="HelloWorldServicePort" binding="tns:HelloWorldServicePortBinding">
- <soap:address location="http://localhost:8086/External/HelloWorld"/>
+ <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
-
diff --git a/sca-java-2.x/trunk/itest/ws/external-client/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/client/HelloWorldClientLauncher.java b/sca-java-2.x/trunk/itest/ws/external-client/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/client/HelloWorldClientLauncher.java index 6371c93d7c..f73a740908 100644 --- a/sca-java-2.x/trunk/itest/ws/external-client/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/client/HelloWorldClientLauncher.java +++ b/sca-java-2.x/trunk/itest/ws/external-client/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/client/HelloWorldClientLauncher.java @@ -26,6 +26,7 @@ import javax.xml.namespace.QName; import javax.xml.ws.Service;
import org.apache.tuscany.sca.binding.ws.jaxws.sca.Exception_Exception;
+import org.apache.tuscany.sca.binding.ws.jaxws.sca.Foo;
import org.apache.tuscany.sca.binding.ws.jaxws.sca.HelloWorldImpl;
public class HelloWorldClientLauncher {
@@ -60,8 +61,18 @@ public class HelloWorldClientLauncher { }
public String getGreetingsException(String name) throws Exception_Exception {
- return wsProxy.getGreetingsException(name);
- }
+ System.out.println("Entering External Client HelloWorld.getGreetingsException: " + name);
+ String response = wsProxy.getGreetingsException(name);
+ System.out.println("Leaving External Client HelloWorld.getGreetingsException: " + response);
+ return response;
+ }
+
+ public Foo getGreetingsComplex(Foo f) throws Exception_Exception {
+ System.out.println("Entering External Client HelloWorld.getGreetingsComplex: " + f.getBars().get(0).getS());
+ Foo response = wsProxy.getGreetingsComplex(f);
+ System.out.println("Leaving External Client HelloWorld.getGreetingsComplex: " + response.getBars().get(0).getS());
+ return response;
+ }
public static void main(String[] args) throws Exception {
HelloWorldClientLauncher launcher = new HelloWorldClientLauncher();
diff --git a/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Bar.java b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Bar.java new file mode 100644 index 0000000000..d279c98b87 --- /dev/null +++ b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Bar.java @@ -0,0 +1,133 @@ +
+package org.apache.tuscany.sca.binding.ws.jaxws.external.service;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for bar complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="bar">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="b" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * <element name="s" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="x" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * <element name="y" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "bar", propOrder = {
+ "b",
+ "s",
+ "x",
+ "y"
+})
+public class Bar {
+
+ protected Boolean b;
+ protected String s;
+ protected int x;
+ protected Integer y;
+
+ /**
+ * Gets the value of the b property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isB() {
+ return b;
+ }
+
+ /**
+ * Sets the value of the b property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setB(Boolean value) {
+ this.b = value;
+ }
+
+ /**
+ * Gets the value of the s property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getS() {
+ return s;
+ }
+
+ /**
+ * Sets the value of the s property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setS(String value) {
+ this.s = value;
+ }
+
+ /**
+ * Gets the value of the x property.
+ *
+ */
+ public int getX() {
+ return x;
+ }
+
+ /**
+ * Sets the value of the x property.
+ *
+ */
+ public void setX(int value) {
+ this.x = value;
+ }
+
+ /**
+ * Gets the value of the y property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getY() {
+ return y;
+ }
+
+ /**
+ * Sets the value of the y property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setY(Integer value) {
+ this.y = value;
+ }
+
+}
diff --git a/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Foo.java b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Foo.java new file mode 100644 index 0000000000..855dc95fea --- /dev/null +++ b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/Foo.java @@ -0,0 +1,69 @@ +
+package org.apache.tuscany.sca.binding.ws.jaxws.external.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for foo complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="foo">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="bars" type="{http://ws.binding.sca.tuscany.apache.org/}bar" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "foo", propOrder = {
+ "bars"
+})
+public class Foo {
+
+ @XmlElement(nillable = true)
+ protected List<Bar> bars;
+
+ /**
+ * Gets the value of the bars property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the bars property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getBars().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Bar }
+ *
+ *
+ */
+ public List<Bar> getBars() {
+ if (bars == null) {
+ bars = new ArrayList<Bar>();
+ }
+ return this.bars;
+ }
+
+}
diff --git a/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/HelloWorldService.java b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/HelloWorldService.java index 238ef96c48..be44ce7c21 100644 --- a/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/HelloWorldService.java +++ b/sca-java-2.x/trunk/itest/ws/external-service/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/external/service/HelloWorldService.java @@ -41,17 +41,17 @@ public class HelloWorldService { return response;
}
-/*
public Foo getGreetingsComplex(Foo foo){
+ System.out.println("Entering External Service HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
Foo response = foo;
Bar b3 = new Bar();
b3.setS("simon");
- b3.setX(4);
- b3.setY(new Integer(5));
+ b3.setX(7);
+ b3.setY(new Integer(8));
b3.setB(Boolean.TRUE);
- response.getBars()[1] = b3;
- System.out.println("At sevice: " + response.getBars()[0].getS());
+ response.getBars().add(b3);
+ System.out.println("Leaving External Service HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
return response;
}
-*/
+
}
diff --git a/sca-java-2.x/trunk/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/JavaFirstTestCase.java b/sca-java-2.x/trunk/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/JavaFirstTestCase.java index f1fb797bf3..77418f331f 100644 --- a/sca-java-2.x/trunk/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/JavaFirstTestCase.java +++ b/sca-java-2.x/trunk/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/JavaFirstTestCase.java @@ -20,10 +20,13 @@ package org.apache.tuscany.sca.binding.ws.launcher.axis2;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.apache.tuscany.sca.binding.ws.jaxws.external.client.HelloWorldClientLauncher;
import org.apache.tuscany.sca.binding.ws.jaxws.external.service.HelloWorldServiceLauncher;
+import org.apache.tuscany.sca.binding.ws.jaxws.sca.Bar;
+import org.apache.tuscany.sca.binding.ws.jaxws.sca.Foo;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
@@ -82,9 +85,8 @@ public class JavaFirstTestCase { fail("expecting exception");
}
- public void testGetGreetingsComplex() throws Exception {
-
-/*
+ @Test
+ public void testGetGreetingsComplex() throws Exception {
Foo f = new Foo();
Bar b1 = new Bar();
b1.setS("petra");
@@ -96,19 +98,19 @@ public class JavaFirstTestCase { b2.setX(3);
b2.setY(new Integer(4));
b2.setB(Boolean.FALSE);
- f.setBars(new Bar[] { b1, b2} );
+ f.getBars().add(b1);
+ f.getBars().add(b2);
- Foo f2 = helloWorld.getGreetingsComplex(f);
+ Foo f2 = externalClient.getGreetingsComplex(f);
- assertEquals("petra", f2.getBars()[0].getS());
- assertEquals(1, f2.getBars()[0].getX());
- assertEquals(2, f2.getBars()[0].getY().intValue());
- assertTrue(f2.getBars()[0].getB().booleanValue());
- assertEquals("simon", f2.getBars()[1].getS());
- assertEquals(4, f2.getBars()[1].getX());
- assertEquals(5, f2.getBars()[1].getY().intValue());
- assertTrue(f2.getBars()[1].getB().booleanValue());
-*/
+ assertEquals("petra", f2.getBars().get(0).getS());
+ assertEquals(1, f2.getBars().get(0).getX());
+ assertEquals(2, f2.getBars().get(0).getY().intValue());
+ assertTrue(f2.getBars().get(0).isB());
+ assertEquals("simon", f2.getBars().get(2).getS());
+ assertEquals(7, f2.getBars().get(2).getX());
+ assertEquals(8, f2.getBars().get(2).getY().intValue());
+ assertTrue(f2.getBars().get(2).isB().booleanValue());
}
@After
|