summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-25 17:11:37 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-25 17:11:37 +0000
commit5dbdd580743b49879184d5c5735889977891a2fd (patch)
treedabe6556a6fba680e1fdc4205a8368922ba1dc63 /sca-java-2.x
parentcf07a27562e816156582b1ac7d3a0e72611dbd8e (diff)
Extend test to call the callback and add (commented out) changes to demonstrate the danger of retrieving and endpoint for a component that hosts callback endpoints.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1161646 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x')
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java7
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite29
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite4
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java13
4 files changed, 50 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
index a62b5dd471..0bf2ad3e63 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
@@ -19,6 +19,7 @@
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(ServiceComponent.class)
@@ -26,7 +27,11 @@ public class ServiceComponentImpl implements ServiceComponent {
@Callback
protected CallbackInterface callback;
-
+
+/*
+ @Reference
+ protected ServiceComponent chainedCallbackReference;
+*/
private static ParameterObject po;
public void callback(String str) {
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
new file mode 100644
index 0000000000..5a423f8561
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:foo="http://foo" targetNamespace="http://foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ name="MatchDistributedClient" >
+
+ <component name="DistributedClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ClientComponentImpl" />
+ <reference name="aCallBackService" target="DistributedServiceComponent" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
index fd00323a93..8f71d058c6 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
@@ -23,5 +23,9 @@
<component name="DistributedServiceComponent">
<implementation.java class="org.apache.tuscany.sca.itest.interfaces.ServiceComponentImpl" />
+<!--
+ <reference name="chainedCallbackReference" target="DistributedServiceComponent">
+ </reference>
+-->
</component>
</composite> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
index 1864a8139d..89ca0314c7 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
@@ -80,13 +80,14 @@ public class InerfaceMatchTestCase {
String [] contributions = {"./target/classes"};
Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
- "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite",
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite",
contributions);
node1.start();
Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
"org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.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/");
@@ -99,9 +100,17 @@ public class InerfaceMatchTestCase {
String response = local.foo1(po);
Assert.assertEquals("AComponent", response);
} catch (ServiceRuntimeException ex){
- Assert.fail("Unexpected exception " + ex.toString());
+ 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();