From 70993983dbb1b5ed38f0245e4678eed1ad72472b Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 6 Mar 2009 20:46:17 +0000 Subject: Add a pojo WS test case git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@751069 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/ws/axis2/itests/pojo/Data.java | 53 +++++++++++++++++++ .../sca/binding/ws/axis2/itests/pojo/Data2.java | 35 +++++++++++++ .../ws/axis2/itests/pojo/POJOWSTestCase.java | 50 ++++++++++++++++++ .../binding/ws/axis2/itests/pojo/TestService.java | 29 +++++++++++ .../ws/axis2/itests/pojo/TestServiceImpl.java | 59 ++++++++++++++++++++++ .../binding/ws/axis2/itests/pojo/package-info.java | 21 ++++++++ .../binding/ws/axis2/itests/pojo/test.composite | 32 ++++++++++++ 7 files changed, 279 insertions(+) create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java create mode 100644 java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite (limited to 'java/sca') diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java new file mode 100644 index 0000000000..8c1e6b68da --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java @@ -0,0 +1,53 @@ +/* + * 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.axis2.itests.pojo; + +//import java.io.Serializable; + +public class Data { + + private Data2[] a = null; + private int b = 0; + private float c = 0.0f; + + public Data2[] getA() { + return this.a; + } + + public void setA(Data2[] a) { + this.a = a; + } + + public int getB() { + return this.b; + } + + public void setB(int b) { + this.b = b; + } + + public float getC() { + return this.c; + } + + public void setC(float c) { + this.c = c; + } + +} diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java new file mode 100644 index 0000000000..25954a0603 --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java @@ -0,0 +1,35 @@ +/* + * 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.axis2.itests.pojo; + +public class Data2 { + + private String[] asdf = null; + + public String[] getAsdf() { + return this.asdf; + } + + public void setAsdf(String[] asdf) { + this.asdf = asdf; + } + + +} diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java new file mode 100644 index 0000000000..457eceda8b --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java @@ -0,0 +1,50 @@ +/* + * 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.axis2.itests.pojo; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.Test; + +public class POJOWSTestCase { + + @Test + public void testWS() throws Exception { + + String location = ContributionLocationHelper.getContributionLocation(TestService.class); + Contribution contrib = new Contribution("c1", location); + Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite", contrib); + node.start(); + + // try { + // System.out.println("Test server started (press enter to shutdown)"); + // System.in.read(); + // } + // catch (IOException e) { + // System.err.println(e); + // e.printStackTrace(); + // } + + node.stop(); + System.out.println("Test server stopped"); + } + +} diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java new file mode 100644 index 0000000000..c055d4909f --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.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 org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface TestService { + + public boolean printData(Data data); + +} diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java new file mode 100644 index 0000000000..4eec594a47 --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java @@ -0,0 +1,59 @@ +/* + * 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.axis2.itests.pojo; + +import java.util.Arrays; + +import org.oasisopen.sca.annotation.Service; + +@Service(TestService.class) +public class TestServiceImpl implements TestService { + + public boolean printData(Data data) { + if (data == null) { + System.out.println("data is null"); + return false; + } + + StringBuilder sb = new StringBuilder(256); + sb.append("Data:\n"); + Data2[] a = data.getA(); + if (a != null) { + for (int i = 0; i < a.length; i++) { + sb.append(" a["); + sb.append(i); + sb.append("] = "); + sb.append(Arrays.asList(a[i].getAsdf())); + sb.append("\n"); + } + } else { + sb.append(" a = null"); + } + sb.append("\n b = "); + sb.append(data.getB()); + sb.append("\n c = "); + sb.append(data.getC()); + sb.append("\n"); + + System.out.println(sb.toString()); + + return true; + } + +} diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java new file mode 100644 index 0000000000..9224baae29 --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ +@javax.xml.bind.annotation.XmlSchema(namespace="http://test/server") +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite new file mode 100644 index 0000000000..2120c88db4 --- /dev/null +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + -- cgit v1.2.3