From 5dbdd580743b49879184d5c5735889977891a2fd Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 25 Aug 2011 17:11:37 +0000 Subject: 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 --- .../sca/itest/interfaces/ServiceComponentImpl.java | 7 +++++- .../distributed/MatchDistributedClient.composite | 29 ++++++++++++++++++++++ .../distributed/MatchDistributedService.composite | 4 +++ .../itest/interfaces/InerfaceMatchTestCase.java | 13 ++++++++-- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite (limited to 'sca-java-2.x') 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 @@ + + + + + + + + + + \ 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 @@ + \ 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(); -- cgit v1.2.3