From 132aa8a77685ec92bc90c03f987650d275a7b639 Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 30 Sep 2013 06:59:11 +0000 Subject: 2.0.1 RC1 release tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1527464 13f79535-47bb-0310-9956-ffa450edef68 --- .../testing/itest/interface-matching/pom.xml | 92 +++++ .../sca/itest/interfaces/CallbackInterface.java | 35 ++ .../interfaces/CallbackMissmatchInterface.java | 35 ++ .../interfaces/ClientClientComponentImpl.java | 81 +++++ .../sca/itest/interfaces/ClientComponent.java | 51 +++ .../sca/itest/interfaces/ClientComponentImpl.java | 92 +++++ .../itest/interfaces/LocalCallbackInterface.java | 32 ++ .../LocalCallbackMissmatchInterface.java | 32 ++ .../itest/interfaces/LocalClientComponentImpl.java | 88 +++++ .../LocalServiceCallbackMissmatchComponent.java | 38 +++ ...LocalServiceCallbackMissmatchComponentImpl.java | 50 +++ .../itest/interfaces/LocalServiceComponent.java | 38 +++ .../interfaces/LocalServiceComponentImpl.java | 49 +++ .../interfaces/LocalServiceMissmatchComponent.java | 38 +++ .../LocalServiceMissmatchComponentImpl.java | 49 +++ .../interfaces/NonJAXBClientComponentImpl.java | 92 +++++ .../itest/interfaces/NonJAXBParameterObject.java | 51 +++ .../itest/interfaces/NonJAXBServiceComponent.java | 41 +++ .../interfaces/NonJAXBServiceComponentImpl.java | 60 ++++ .../sca/itest/interfaces/ParameterObject.java | 48 +++ .../ServiceCallbackMissmatchComponent.java | 39 +++ .../ServiceCallbackMissmatchComponentImpl.java | 49 +++ .../sca/itest/interfaces/ServiceComponent.java | 41 +++ .../sca/itest/interfaces/ServiceComponentImpl.java | 57 ++++ .../interfaces/ServiceMissmatchComponent.java | 52 +++ .../interfaces/ServiceMissmatchComponentImpl.java | 68 ++++ ....apache.tuscany.sca.definitions.xml.Definitions | 17 + .../tuscany/sca/itest/interfaces/definitions.xml | 36 ++ .../distributed/MatchDistributedClient.composite | 34 ++ .../MatchDistributedClientClient.composite | 29 ++ .../distributed/MatchDistributedService.composite | 27 ++ .../MatchNonJAXBDistributedClient.composite | 29 ++ .../MatchNonJAXBDistributedService.composite | 27 ++ .../MatchPolicyDistributedClient.composite | 29 ++ .../MatchPolicyDistributedService.composite | 31 ++ .../distributed/MatchWSDistributedClient.composite | 29 ++ .../MatchWSDistributedService.composite | 30 ++ .../interfaces/match/local/MatchLocal.composite | 32 ++ .../MissmatchCallbackDistributedService.composite | 27 ++ .../MissmatchDistributedClient.composite | 29 ++ .../MissmatchDistributedService.composite | 27 ++ .../MissmatchPolicyDistributedClient.composite | 30 ++ .../MissmatchPolicyDistributedService.composite | 31 ++ .../local/MissmatchCallbackLocal.composite | 32 ++ .../missmatch/local/MissmatchLocal.composite | 32 ++ .../missmatch/local/MissmatchRemoteable.composite | 32 ++ .../itest/interfaces/InerfaceMatchTestCase.java | 369 +++++++++++++++++++++ .../interfaces/InerfaceMissmatchTestCase.java | 246 ++++++++++++++ .../itest/interfaces/InterfaceWriteTestCase.java | 110 ++++++ 49 files changed, 2713 insertions(+) create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/pom.xml create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackInterface.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackMissmatchInterface.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientClientComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBClientComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBParameterObject.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponent.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponentImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/local/MatchLocal.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchRemoteable.composite create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfaceWriteTestCase.java (limited to 'sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching') diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/pom.xml b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/pom.xml new file mode 100644 index 0000000000..95abe93bb7 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0.1 + ../pom.xml + + itest-interface-matching + Apache Tuscany SCA iTest Interface Matching + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0.1 + + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0.1 + test + + + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0.1 + + + + org.mortbay.jetty + jetty + 6.1.19 + + + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0.1 + + + + org.apache.tuscany.sca + tuscany-host-rmi + 2.0.1 + + + + org.apache.tuscany.sca + tuscany-policy-security-jsr250 + 2.0.1 + + + + org.codehaus.woodstox + wstx-asl + 3.2.9 + test + + + stax + stax-api + + + + + + diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackInterface.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackInterface.java new file mode 100644 index 0000000000..4db5531aca --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackInterface.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.itest.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * only for callBack + */ +@Remotable +public interface CallbackInterface { + + void callbackMethod(String str); + + void callbackMethod1(String str); + + void modifyParameter(ParameterObject po); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackMissmatchInterface.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackMissmatchInterface.java new file mode 100644 index 0000000000..9d9362f4d5 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/CallbackMissmatchInterface.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.itest.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * only for callBack + */ +@Remotable +public interface CallbackMissmatchInterface { + + void callbackMethod(ParameterObject po); + + void callbackMethod1(ParameterObject po, String str); + + void modifyParameter(ParameterObject po); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientClientComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientClientComponentImpl.java new file mode 100644 index 0000000000..66988094e7 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientClientComponentImpl.java @@ -0,0 +1,81 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/* + * Test that a client can be reference using a target name containing only the component + * name when the client has callback services registered. + */ +@Service(ClientComponent.class) +public class ClientClientComponentImpl implements ClientComponent{ + + @Reference + protected ClientComponent aClient; + + public String foo(ParameterObject po) { + return aClient.foo(po); + } + + public String foo1(ParameterObject po) { + return aClient.foo1(po); + } + + public String foo2(String str) throws Exception { + return str + "AComponent"; + } + + public String foo3(String str, int i) { + return str + "AComponent" + i; + } + + public String foo4(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + } + + public void callbackMethod(String str) { + } + + public void callbackMethod1(String str) { + } + + public void callModifyParameter() { + } + + public String getCallbackValue() { + return null; + } + + public void onewayMethod(String str) { + } + + public String getOnewayValue() { + return null; + } + + public void modifyParameter(ParameterObject po) { + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponent.java new file mode 100644 index 0000000000..c6a6499126 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponent.java @@ -0,0 +1,51 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/* + * itest for interface: local,method-overloading + */ +@Remotable +public interface ClientComponent { + + String foo(ParameterObject po); + + String foo1(ParameterObject po); + + String foo2(String str) throws Exception; + + String foo3(String str, int i); + + String foo4(int i, String str) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + @OneWay + void onewayMethod(String str); + + String getCallbackValue(); + + String getOnewayValue(); +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponentImpl.java new file mode 100644 index 0000000000..4a414f870f --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ClientComponentImpl.java @@ -0,0 +1,92 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(ClientComponent.class) +public class ClientComponentImpl implements ClientComponent, CallbackInterface { + + @Reference + protected ServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo(ParameterObject po) { + po.field1 = "AComponent"; + return aCallBackService.foo("AComponent"); + } + + public String foo1(ParameterObject po) { + po.field1 = "AComponent"; + return aCallBackService.foo1("AComponent"); + } + + public String foo2(String str) throws Exception { + return str + "AComponent"; + } + + public String foo3(String str, int i) { + return str + "AComponent" + i; + } + + public String foo4(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callbackMethod1(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java new file mode 100644 index 0000000000..a41875b2b6 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.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 org.apache.tuscany.sca.itest.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * only for callBack + */ +public interface LocalCallbackInterface { + + void callbackMethod(String str); + + void modifyParameter(ParameterObject po); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java new file mode 100644 index 0000000000..fbb81ae5c1 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.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 org.apache.tuscany.sca.itest.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * only for callBack + */ +public interface LocalCallbackMissmatchInterface { + + void callbackMethod(ParameterObject po); + + void modifyParameter(ParameterObject po); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java new file mode 100644 index 0000000000..9a8ad9ed8d --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java @@ -0,0 +1,88 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(ClientComponent.class) +public class LocalClientComponentImpl implements ClientComponent, LocalCallbackInterface { + + @Reference + protected LocalServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo(ParameterObject po) { + po.field1 = "AComponent"; + return aCallBackService.foo("AComponent"); + } + + public String foo1(ParameterObject po) { + po.field1 = "AComponent"; + return aCallBackService.foo("AComponent"); + } + + public String foo2(String str) throws Exception { + return str + "AComponent"; + } + + public String foo3(String str, int i) { + return str + "AComponent" + i; + } + + public String foo4(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java new file mode 100644 index 0000000000..7a66b2d900 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java @@ -0,0 +1,38 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Callback(LocalCallbackMissmatchInterface.class) +public interface LocalServiceCallbackMissmatchComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java new file mode 100644 index 0000000000..7ef6c04a9c --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(LocalServiceCallbackMissmatchComponent.class) +public class LocalServiceCallbackMissmatchComponentImpl implements LocalServiceCallbackMissmatchComponent { + + @Callback + protected LocalCallbackMissmatchInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + po = new ParameterObject("CallBack"); + callback.callbackMethod(po); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return po.field1; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java new file mode 100644 index 0000000000..92ed0434e4 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java @@ -0,0 +1,38 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Callback(LocalCallbackInterface.class) +public interface LocalServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java new file mode 100644 index 0000000000..1d8995ccc6 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(LocalServiceComponent.class) +public class LocalServiceComponentImpl implements LocalServiceComponent { + + @Callback + protected LocalCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponent.java new file mode 100644 index 0000000000..fb722b2699 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponent.java @@ -0,0 +1,38 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Callback(LocalCallbackInterface.class) +public interface LocalServiceMissmatchComponent { + + String foo(ParameterObject po); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponentImpl.java new file mode 100644 index 0000000000..78626a3add --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceMissmatchComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(LocalServiceMissmatchComponent.class) +public class LocalServiceMissmatchComponentImpl implements LocalServiceMissmatchComponent { + + @Callback + protected LocalCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(ParameterObject po) { + return po.field1; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBClientComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBClientComponentImpl.java new file mode 100644 index 0000000000..f3048a9098 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBClientComponentImpl.java @@ -0,0 +1,92 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(ClientComponent.class) +public class NonJAXBClientComponentImpl implements ClientComponent, CallbackInterface { + + @Reference + protected NonJAXBServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo(ParameterObject po) { + po.field1 = "AComponent"; + return aCallBackService.foo("AComponent"); + } + + public String foo1(ParameterObject po) { + NonJAXBParameterObject nonJAXBPO = new NonJAXBParameterObject(po.field1); + return aCallBackService.foo1(nonJAXBPO); + } + + public String foo2(String str) throws Exception { + return str + "AComponent"; + } + + public String foo3(String str, int i) { + return str + "AComponent" + i; + } + + public String foo4(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callbackMethod1(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBParameterObject.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBParameterObject.java new file mode 100644 index 0000000000..8acef311a9 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBParameterObject.java @@ -0,0 +1,51 @@ +/* + * 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.itest.interfaces; + +import java.io.Serializable; + +/** + * + * A bean that cannont be converted to/from XML using JAXB as there is no + * default constructor + * + */ +public class NonJAXBParameterObject implements Serializable { + private static final long serialVersionUID = 1L; + public String field1; + + + public NonJAXBParameterObject(String field1) { + this.field1 = field1; + } + + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof NonJAXBParameterObject) { + NonJAXBParameterObject other = (NonJAXBParameterObject)o; + if (field1 != null) { + return field1.equals(other.field1); + } + } + return false; + } +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponent.java new file mode 100644 index 0000000000..d097394721 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponent.java @@ -0,0 +1,41 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Remotable +@Callback(CallbackInterface.class) +public interface NonJAXBServiceComponent { + + String foo(String str); + + String foo1(NonJAXBParameterObject po); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponentImpl.java new file mode 100644 index 0000000000..d50feafd0e --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/NonJAXBServiceComponentImpl.java @@ -0,0 +1,60 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(NonJAXBServiceComponent.class) +public class NonJAXBServiceComponentImpl implements NonJAXBServiceComponent { + + @Callback + protected CallbackInterface callback; + +/* + @Reference + protected ServiceComponent chainedCallbackReference; +*/ + private static ParameterObject po; + + public String foo(String str) { + return str; + } + + public String foo1(NonJAXBParameterObject po){ + return po.field1; + } + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java new file mode 100644 index 0000000000..9c980e01c8 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java @@ -0,0 +1,48 @@ +/* + * 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.itest.interfaces; + +import java.io.Serializable; + +public class ParameterObject implements Serializable { + private static final long serialVersionUID = 1L; + public String field1; + + public ParameterObject() { + this.field1 = null; + } + + public ParameterObject(String field1) { + this.field1 = field1; + } + + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ParameterObject) { + ParameterObject other = (ParameterObject)o; + if (field1 != null) { + return field1.equals(other.field1); + } + } + return false; + } +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponent.java new file mode 100644 index 0000000000..81d4b3816a --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponent.java @@ -0,0 +1,39 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Remotable +@Callback(CallbackMissmatchInterface.class) +public interface ServiceCallbackMissmatchComponent { + + String foo(ParameterObject po); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponentImpl.java new file mode 100644 index 0000000000..4dbfd55535 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceCallbackMissmatchComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(ServiceCallbackMissmatchComponent.class) +public class ServiceCallbackMissmatchComponentImpl implements ServiceCallbackMissmatchComponent { + + @Callback + protected CallbackMissmatchInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod1(po, str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(ParameterObject po) { + return po.field1; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponent.java new file mode 100644 index 0000000000..355db43089 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponent.java @@ -0,0 +1,41 @@ +/* + * 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.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Remotable +@Callback(CallbackInterface.class) +public interface ServiceComponent { + + String foo(String str); + + String foo1(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java new file mode 100644 index 0000000000..aee96e4737 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java @@ -0,0 +1,57 @@ +/* + * 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.itest.interfaces; + +import javax.annotation.security.RolesAllowed; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@RolesAllowed({"Role1"}) +@Service(ServiceComponent.class) +public class ServiceComponentImpl implements ServiceComponent { + + @Callback + protected CallbackInterface callback; + + private static ParameterObject po; + + @RolesAllowed({"Role2", "Role3"}) + public String foo(String str) { + return str; + } + + public String foo1(String str){ + return str; + } + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponent.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponent.java new file mode 100644 index 0000000000..a1c933716e --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponent.java @@ -0,0 +1,52 @@ +/* + * 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.itest.interfaces; + +import java.util.List; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Local be-directional callBackService + */ +@Remotable +@Callback(CallbackInterface.class) +public interface ServiceMissmatchComponent { + + // infrastructure won't detect difference between String and ParameterObject + String foo(ParameterObject po); + + // Infrastructure will detect difference between parameter numbers + String foo1(ParameterObject po, String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + + void inArray(String[] stringArray); + + String[] outArray(); + + void inCollection(List stringArray); + + List outCollection(); +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponentImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponentImpl.java new file mode 100644 index 0000000000..0e0966da79 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceMissmatchComponentImpl.java @@ -0,0 +1,68 @@ +/* + * 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.itest.interfaces; + +import java.util.List; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(ServiceMissmatchComponent.class) +public class ServiceMissmatchComponentImpl implements ServiceMissmatchComponent { + + @Callback + protected CallbackInterface callback; + + private static ParameterObject po; + + public String foo(ParameterObject po) { + return po.field1; + } + + public String foo1(ParameterObject po, String str){ + return str; + } + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public ParameterObject getPO() { + return po; + } + + public void inArray(String[] stringArray) { + } + + public String[] outArray() { + return null; + } + + public void inCollection(List stringArray) { + } + + public List outCollection() { + return null; + } +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions new file mode 100644 index 0000000000..39b298a665 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions @@ -0,0 +1,17 @@ +# 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. +org/apache/tuscany/sca/itest/interfaces/definitions.xml \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml new file mode 100644 index 0000000000..f462f81388 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml @@ -0,0 +1,36 @@ + + + + + + + + myname + mypassword + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite new file mode 100644 index 0000000000..7a373f2f31 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite new file mode 100644 index 0000000000..d0f2bc25ba --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite new file mode 100644 index 0000000000..f13cc8657b --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedClient.composite new file mode 100644 index 0000000000..4d39fc2ec7 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedClient.composite @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite new file mode 100644 index 0000000000..ffb609daee --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite new file mode 100644 index 0000000000..e5591f2e93 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite new file mode 100644 index 0000000000..7340a2d6e6 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite new file mode 100644 index 0000000000..44074bf719 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite new file mode 100644 index 0000000000..981f5d172c --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/local/MatchLocal.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/local/MatchLocal.composite new file mode 100644 index 0000000000..6c728f8bd3 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/local/MatchLocal.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite new file mode 100644 index 0000000000..808ffa45f0 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite new file mode 100644 index 0000000000..dcfe3bf3c3 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite new file mode 100644 index 0000000000..9424f66d56 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite new file mode 100644 index 0000000000..b8f51c9afc --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite new file mode 100644 index 0000000000..a90d9e0a3f --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite new file mode 100644 index 0000000000..2c673054a6 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite new file mode 100644 index 0000000000..4a128015f8 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchRemoteable.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchRemoteable.composite new file mode 100644 index 0000000000..7b3ff13e4f --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchRemoteable.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java new file mode 100644 index 0000000000..ade96178d2 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java @@ -0,0 +1,369 @@ +/* + * 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.itest.interfaces; + +import java.net.URI; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.TuscanyRuntime; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; +import org.oasisopen.sca.client.SCAClientFactory; + +public class InerfaceMatchTestCase { + + /** + * Non-remotable client and service interfaces where the interfaces match. + * Components running in the same composite/JVM, i.e. no remote registry + * + * @throws Exception + */ + @Test + public void testLocal() throws Exception { + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/local/MatchLocal.composite", + contributions); + node1.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception " + ex.toString()); + } + + node1.stop(); + } + + /** + * Remotable client and service interfaces where the interfaces match. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * + * @throws Exception + */ + @Test + public void testDistributedRemotable() throws Exception { + + // Force the remote default binding to be web services + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://docs.oasis-open.org/ns/opencsa/sca/200912}binding.ws"); + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite", + contributions); + + // force default binding on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + try { + local.callback("Callback"); + String response = local.getCallbackValue(); + Assert.assertEquals("Callback", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with callback" + ex.toString()); + } + + node1.stop(); + node2.stop(); + } + + /** + * Remotable client and service interfaces where the interfaces match but + * where there is a parameter that can't be converted to/from XML using JAXB + * Components running in the separate composite/JVM, i.e. there is a remote registry + * + * @throws Exception + */ + @Test + public void testDistributedRemotableNonJAXB() throws Exception { + + // Force the remote default binding to be rmi as I want something that doesn't depend on + // WSDL so that I can test what happens when the registry tries to generate WSDL + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"); + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite", + contributions); + + // force default binding on node2 to use a different port from node 1(which will default to 8080 + // Don't need to do this as not testing callbacks here + //((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + //((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + po.field1 = "Test String"; + + try { + String response = local.foo1(po); + Assert.assertEquals("Test String", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + node1.stop(); + node2.stop(); + } + + /** + * Remotable client and service interfaces where the interfaces match and the service has policy. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * + * @throws Exception + */ + @Test + public void testPolicyDistributedRemotable() throws Exception { + + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite", + contributions); + // force binding.ws on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + try { + local.callback("Callback"); + String response = local.getCallbackValue(); + Assert.assertEquals("Callback", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with callback" + ex.toString()); + } + + node1.stop(); + node2.stop(); + } + + /** + * Remotable client and service interfaces where the interfaces match. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * and with binding.ws explicitly configured at the service + * + * @throws Exception + */ + @Test + public void testWSDistributedRemotable() throws Exception { + + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite", + contributions); + + // force default binding on node2 to use a different port from node 1(which will default to 8080) + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + try { + local.callback("Callback"); + String response = local.getCallbackValue(); + Assert.assertEquals("Callback", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with callback" + ex.toString()); + } + + node1.stop(); + node2.stop(); + } + + /** + * Remotable client and service interfaces where the interfaces match. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * Access from an SCALient call to make sure that it is able to connect to the remote + * registry. + * + * + * @throws Exception + */ + @Test + public void testDistributedRemotableSCAClient() throws Exception { + + // Force the remote default binding to be web services + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://docs.oasis-open.org/ns/opencsa/sca/200912}binding.ws"); + + TuscanyRuntime runtime = TuscanyRuntime.newInstance(); + +/* + org.apache.tuscany.sca.Node nodeA = runtime.createNode("default"); + nodeA.installContribution("nodeAContrib", "./target/classes", null, null); + nodeA.startComposite("node1Contrib", "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite"); + + org.apache.tuscany.sca.Node nodeB = runtime.createNode("default"); + nodeB.installContribution("nodeAContrib", "./target/classes", null, null); + nodeB.startComposite("node1Contrib", "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite"); +*/ + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite", + contributions); + + // force default binding on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default")); + ClientComponent local = clientFactory.getService(ClientComponent.class, "LocalClientClientComponent"); + + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + +/* Used to keep the composites alive when running the next (ignored) test manually + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Continuing"); +*/ + node1.stop(); + node2.stop(); + } + + /** + * Allows you to manually call the previous test from a separate VM to + * ensure that endpoint serialization to the client work OK. It's not + * intended to run as part of the test suite. + * + * + * @throws Exception + */ + @Test + @Ignore + public void testDistributedRemotableSCAClientSeparateVM() throws Exception { + // Force the remote default binding to be web services + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://docs.oasis-open.org/ns/opencsa/sca/200912}binding.ws"); + + // Make a reference target point across VMs to a component that has callback services + String [] contributions = {"./target/classes"}; + + Node node3 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite", + contributions); + node3.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default")); + ClientComponent clientClient = clientFactory.getService(ClientComponent.class, "DistributedClientClientComponent"); + + ParameterObject po = new ParameterObject(); + + try { + String response = clientClient.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + // Make an SCAClient point across VMs to a component that has callback services + ClientComponent client = clientFactory.getService(ClientComponent.class, "DistributedClientComponent"); + + try { + String response = client.foo1(po); + Assert.assertEquals("AComponent", response); + } catch (ServiceRuntimeException ex){ + Assert.fail("Unexpected exception with foo " + ex.toString()); + } + + node3.stop(); + } +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java new file mode 100644 index 0000000000..636f6cb789 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java @@ -0,0 +1,246 @@ +/* + * 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.itest.interfaces; + +import java.net.URI; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; + +public class InerfaceMissmatchTestCase { + + /** + * Non-remoteable client and service interfaces where the parameter types of one of the operations don't match. + * Components running in the same composite/JVM, i.e. no remote registry + * + * @throws Exception + */ + @Test + public void testLocal() throws Exception { + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite", + contributions); + node1.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + local.foo1(po); + Assert.fail("Expection exteption indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + node1.stop(); + } + + /** + * Non-remoteable client and service interfaces where the parameter types of one of the callback operations don't match. + * Components running in the same composite/JVM, i.e. no remote registry + * + * @throws Exception + */ + @Test + public void testCallbackLocal() throws Exception { + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite", + contributions); + node1.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + local.foo1(po); + Assert.fail("Expection exteption indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + node1.stop(); + } + + /** + * Remoteable client and service interfaces where the parameter types of one of the operations don't match. + * Components running in the same composite/JVM, i.e. no remote registry + * Tuscany is not able to detect miss-match here? + * + * @throws Exception + */ + @Test + public void testNonDistributedRemotable() throws Exception { + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchRemoteable.composite", + contributions); + node1.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + local.foo1(po); + } catch (ServiceRuntimeException ex){ + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + node1.stop(); + } + + /** + * Remoteable client and service interfaces where the parameter types of one of the operations don't match. + * Components running in the seaprate composite/JVM, i.e. there is a remote registry + * Both of the interfaces are converted to WSDL and Tuscany is able to detect miss-match. + * + * @throws Exception + */ + @Test + public void testDistributedRemotable() throws Exception { + + // Force the remote default binding to be web services + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://docs.oasis-open.org/ns/opencsa/sca/200912}binding.ws"); + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite", + contributions); + // for default binding on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + local.foo1(po); + node1.stop(); + node2.stop(); + Assert.fail("Expected exception indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + node1.stop(); + node2.stop(); + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + + } + + /** + * Remoteable client and service interfaces where the parameter types of one of the operations don't match. + * Components running in the seaprate composite/JVM, i.e. there is a remote registry + * Both of the interfaces are converted to WSDL and Tuscany is able to detect miss-match. + * + * @throws Exception + */ + @Test + public void testCallbackDistributedRemotable() throws Exception { + + // Force the remote default binding to be web services + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://docs.oasis-open.org/ns/opencsa/sca/200912}binding.ws"); + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite", + contributions); + // for default binding on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + local.foo1(po); + node1.stop(); + node2.stop(); + Assert.fail("Expected exception indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + node1.stop(); + node2.stop(); + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + } + + /** + * Remotable client and service interfaces where the interfaces match and the service and reference + * have missmatching policy. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * + * @throws Exception + */ + @Test + public void testPolicyDistributedRemotable() throws Exception { + + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite", + contributions); + // force binding.ws on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + node1.stop(); + node2.stop(); + Assert.fail("Expected exception indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + node1.stop(); + node2.stop(); + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + } +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfaceWriteTestCase.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfaceWriteTestCase.java new file mode 100644 index 0000000000..9f6c1edbb0 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfaceWriteTestCase.java @@ -0,0 +1,110 @@ +/* + * 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.itest.interfaces; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.net.URI; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import junit.framework.Assert; + + + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.assembly.xml.InterfaceContractProcessor; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; + +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl; +import org.apache.tuscany.sca.interfacedef.util.Audit; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.junit.Test; + +public class InterfaceWriteTestCase { + + /** + * Looks at writing and reading the Tuscany interface model + * + * @throws Exception + */ + @Test + public void testInterfaceWriteRead() throws Exception { + String [] contributions = {"./target/classes"}; + NodeImpl node1 = (NodeImpl)NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite", + contributions); + node1.start(); + + Component serviceComponent = node1.getDomainComposite().getComponents().get(0); + Service service = serviceComponent.getServices().get(0); + + InterfaceContractProcessor processor = new InterfaceContractProcessor(node1.getExtensionPointRegistry()); + ProcessorContext context = new ProcessorContext(); + + FactoryExtensionPoint modelFactories = node1.getExtensionPointRegistry().getExtensionPoint(FactoryExtensionPoint.class); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + processor.write(service.getInterfaceContract(), writer, context); + writer.close(); + + String xml = bos.toString(); + System.out.println("Written ouput is:\n" + xml); + + ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes()); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + XMLStreamReader reader = inputFactory.createXMLStreamReader(bis); + InterfaceContract interfaceContract = processor.read(reader, context); + + bos = new ByteArrayOutputStream(); + writer = outputFactory.createXMLStreamWriter(bos); + processor.write(interfaceContract, writer, context); + writer.close(); + + System.out.println("Read ouput is:\n" + bos); + + InterfaceContractMapper interfaceContractMapper = new InterfaceContractMapperImpl(node1.getExtensionPointRegistry()); + + Audit matchAudit = new Audit(); + boolean match = false; + match = interfaceContractMapper.isCompatibleSubset(service.getInterfaceContract(), + interfaceContract, + matchAudit); + + if (!match){ + System.out.println(matchAudit.toString()); + } + + Assert.assertTrue(match); + + node1.stop(); + } + +} -- cgit v1.2.3