diff options
Diffstat (limited to 'sca-java-1.x/trunk/itest/jaxws')
12 files changed, 144 insertions, 18 deletions
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstract.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstract.java index a633908bc3..cd2cf16e58 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstract.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstract.java @@ -27,5 +27,15 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @XmlJavaTypeAdapter(TestAdapter.class)
public abstract class TestAbstract {
- public abstract String getGreeting();
+ public String firstName = "?";
+
+ public String lastName = "??";
+
+ public String greeting = "???";
+
+ public String sender = "Anonymous";
+
+ public String getGreeting() {
+ return greeting;
+ }
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstractImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstractImpl.java new file mode 100644 index 0000000000..de1667c0c3 --- /dev/null +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAbstractImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 jtest;
+
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * The test abstract class on-the-wire representation
+ */
+public class TestAbstractImpl {
+
+ public String className;
+
+ public String someMessage;
+
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAdapter.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAdapter.java index 2c5e52caba..44216d3e03 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAdapter.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestAdapter.java @@ -24,11 +24,16 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; /**
* The test XML adapter class
*/
-public class TestAdapter extends XmlAdapter<String, TestAbstract> {
- public TestAbstract unmarshal(String v) throws Exception {
- return (TestAbstract)this.getClass().getClassLoader().loadClass(v).newInstance();
+public class TestAdapter extends XmlAdapter<TestAbstractImpl, TestAbstract> {
+ public TestAbstract unmarshal(TestAbstractImpl ai) throws Exception {
+ TestAbstract a = (TestAbstract)this.getClass().getClassLoader().loadClass(ai.className).newInstance();
+ a.sender = ai.someMessage;
+ return a;
}
- public String marshal(TestAbstract v) throws Exception {
- return v.getClass().getName();
+ public TestAbstractImpl marshal(TestAbstract v) throws Exception {
+ TestAbstractImpl ai = new TestAbstractImpl();
+ ai.className = v.getClass().getName();
+ ai.someMessage = "YouKnowWho";
+ return ai;
}
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java index 7a54553a68..9839e980c8 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java @@ -26,5 +26,7 @@ public interface TestClient { void runAbstractTypeTest();
+/*
void runAbstractExceptionTest();
+*/
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete1.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete1.java index 47cf3db41d..2193316ade 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete1.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete1.java @@ -24,7 +24,7 @@ package jtest; */
public class TestConcrete1 extends TestAbstract {
- public String getGreeting() {
- return "Hello";
+ public TestConcrete1() {
+ greeting = "Hello";
}
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete2.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete2.java index 660ecf30ba..059d18d2a8 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete2.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestConcrete2.java @@ -24,7 +24,7 @@ package jtest; */
public class TestConcrete2 extends TestAbstract {
- public String getGreeting() {
- return "World";
+ public TestConcrete2() {
+ greeting = "World";
}
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java index 69488bbd14..ac5a01cd15 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java @@ -30,7 +30,9 @@ import jtest.TestAbstract; @Remotable
public interface TestService {
- void sendAbstract(TestAbstract data1, TestAbstract data2);
+ void sendAbstract(TestAbstract data);
+/*
void throwAbstract() throws AbstractException;
+*/
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java new file mode 100644 index 0000000000..cd7b1f3ecc --- /dev/null +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java @@ -0,0 +1,29 @@ +/*
+ * 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 jtest;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface TestWebService {
+
+ @WebMethod
+ void sendAbstract(TestAbstract testData);
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java index 2eadd43a86..278f94f8fc 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java @@ -39,10 +39,16 @@ public class TestClientImpl implements TestClient { public void runAbstractTypeTest() {
TestConcrete1 data1 = new TestConcrete1();
+ data1.firstName = "Bill";
+ data1.lastName = "Brown";
+ ref.sendAbstract(data1);
TestConcrete2 data2 = new TestConcrete2();
- ref.sendAbstract(data1, data2);
+ data2.firstName = "Sam";
+ data2.lastName = "Smith";
+ ref.sendAbstract(data2);
}
+/*
public void runAbstractExceptionTest() {
try {
ref.throwAbstract();
@@ -51,4 +57,5 @@ public class TestClientImpl implements TestClient { System.out.println(e.getGreeting());
}
}
+*/
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java index dc51ae0bd9..356b32dfab 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java @@ -32,13 +32,16 @@ import jtest.TestService; @Service(TestService.class)
public class TestServiceImpl implements TestService {
- public void sendAbstract(TestAbstract data1, TestAbstract data2) {
- System.out.println("data1 is instance of class " + data1.getClass().getName());
- System.out.println("data2 is instance of class " + data2.getClass().getName());
- System.out.println(data1.getGreeting() + " " + data2.getGreeting());
+ public void sendAbstract(TestAbstract data) {
+ System.out.println("data is instance of class " + data.getClass().getName());
+ System.out.println("data sent by " + data.sender);
+ System.out.println("data first+last name is " + data.firstName + " " + data.lastName);
+ System.out.println(data.getGreeting());
}
+/*
public void throwAbstract() throws AbstractException {
throw new ConcreteException();
}
+*/
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java new file mode 100644 index 0000000000..974279c7ef --- /dev/null +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java @@ -0,0 +1,32 @@ +/*
+ * 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 jtest.impl;
+
+import javax.jws.WebService;
+
+import jtest.TestAbstract;
+import jtest.TestWebService;
+
+@WebService(endpointInterface = "jtest.TestWebService")
+public class TestWebServiceImpl implements TestWebService {
+
+ public void sendAbstract(TestAbstract testData) {
+ System.out.println(testData.getGreeting());
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java b/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java index 6886d17a6a..7ffcbebfd8 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java @@ -19,6 +19,7 @@ package jtest;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.WSDLServiceGenerator;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode;
@@ -33,7 +34,8 @@ public class DatatypesTestCase { @BeforeClass
public static void setUpBeforeClass() throws Exception {
- node = SCANodeFactory.newInstance().createSCANode("jtest.composite",
+ WSDLServiceGenerator.printWSDL = true;
+ node = SCANodeFactory.newInstance().createSCANode("jtest.composite",
new SCAContribution("payment", "./target/classes"));
node.start();
}
@@ -45,13 +47,14 @@ public class DatatypesTestCase { testClient.runAbstractTypeTest();
}
+/*
@Test
- @Ignore
public void runAbstractExceptionTest() {
SCAClient client = (SCAClient)node;
TestClient testClient = client.getService(TestClient.class, "TestClient");
testClient.runAbstractExceptionTest();
}
+*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
|