tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1159623 - in /tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src: main/java/org/apache/tuscany/sca/itest/interfaces/ main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/ test/java/org/apache/tuscany/sca/ites...
Date Fri, 19 Aug 2011 13:15:52 GMT
Author: slaws
Date: Fri Aug 19 13:15:52 2011
New Revision: 1159623

URL: http://svn.apache.org/viewvc?rev=1159623&view=rev
Log:
TUSCANY-3916 - Add local callback miss-match case. Remote callback case to follow. 

Added:
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite
Modified:
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.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/LocalCallbackMissmatchInterface.java?rev=1159623&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackMissmatchInterface.java
Fri Aug 19 13:15:52 2011
@@ -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);
+
+}

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.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/LocalServiceCallbackMissmatchComponent.java?rev=1159623&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponent.java
Fri Aug 19 13:15:52 2011
@@ -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();
+
+}

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.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/LocalServiceCallbackMissmatchComponentImpl.java?rev=1159623&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceCallbackMissmatchComponentImpl.java
Fri Aug 19 13:15:52 2011
@@ -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;
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.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/local/MissmatchCallbackLocal.composite?rev=1159623&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchCallbackLocal.composite
Fri Aug 19 13:15:52 2011
@@ -0,0 +1,32 @@
+<?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="MissmatchCallbackLocal" >
+
+    <component name="LocalClientComponent">
+        <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalClientComponentImpl"
/>
+        <reference name="aCallBackService" target="LocalServiceComponent" />
+    </component> 
+    
+    <component name="LocalServiceComponent">
+        <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalServiceCallbackMissmatchComponentImpl"
/>
+    </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/InerfaceMissmatchTestCase.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/InerfaceMissmatchTestCase.java?rev=1159623&r1=1159622&r2=1159623&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
Fri Aug 19 13:15:52 2011
@@ -31,7 +31,12 @@ import org.oasisopen.sca.ServiceRuntimeE
 
 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"};
@@ -50,10 +55,43 @@ public class InerfaceMissmatchTestCase {
             Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []"));
         }
         
-        node1.stop();
-        
+        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 {
      
@@ -77,7 +115,13 @@ public class InerfaceMissmatchTestCase {
         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 {
         



Mime
View raw message