Author: slaws
Date: Thu Aug 25 17:11:37 2011
New Revision: 1161646

URL: http://svn.apache.org/viewvc?rev=1161646&view=rev
Log:
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. 

Added:
    
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
Modified:
    
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
    
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
    
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java

Modified: 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java?rev=1161646&r1=1161645&r2=1161646&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
 Thu Aug 25 17:11:37 2011
@@ -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 implem
 
     @Callback
     protected CallbackInterface callback;
-
+ 
+/*    
+    @Reference
+    protected ServiceComponent chainedCallbackReference;
+*/
     private static ParameterObject po;
 
     public void callback(String str) {

Added: 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite?rev=1161646&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
 (added)
+++ 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedClient.composite
 Thu Aug 25 17:11:37 2011
@@ -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

Modified: 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite?rev=1161646&r1=1161645&r2=1161646&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
 (original)
+++ 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite
 Thu Aug 25 17:11:37 2011
@@ -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

Modified: 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java?rev=1161646&r1=1161645&r2=1161646&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
 Thu Aug 25 17:11:37 2011
@@ -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();
 


Reply via email to