Author: slaws
Date: Fri Mar 23 13:04:42 2012
New Revision: 1304327

URL: http://svn.apache.org/viewvc?rev=1304327&view=rev
Log:
TUSCANY-4033 - Don't generate WSDL when binding an EPR to a remote EP and the 
EPR and EP both use a Java interface. 

Modified:
    
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
    
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/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=1304327&r1=1304326&r2=1304327&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
 Fri Mar 23 13:04:42 2012
@@ -50,6 +50,8 @@ import org.apache.tuscany.sca.core.assem
 import org.apache.tuscany.sca.definitions.Definitions;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.TuscanyInterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.util.Audit;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
@@ -1123,10 +1125,20 @@ public class EndpointReferenceBinderImpl
             return true;
         }
         
-        // If the contracts are not of the same type use normailized interfaces
-        if (endpointReferenceContract.getClass() != 
endpointContract.getClass() ||
+        // TUSCANY-4033
+        // Detect the case where the interfaces are both Java but the Endpoint 
is remote in which case
+        // we have to match the local Java interface with the remote Tuscany 
interface. But we can do this
+        // without running WSDLGen
+        if (endpointReferenceContract.getClass() == 
endpointContract.getClass() &&
+            endpointReferenceContract instanceof JavaInterfaceContract &&
+            endpointContract.getNormalizedWSDLContract() != null &&
+            endpointContract.getNormalizedWSDLContract() instanceof 
TuscanyInterfaceContractImpl){
+            // use the TuscanyInterfaceContractImpl to compare against the 
Java contract
+            endpointContract = endpointContract.getNormalizedWSDLContract();
+        } else if (endpointReferenceContract.getClass() != 
endpointContract.getClass() ||
             endpointReferenceContract.getNormalizedWSDLContract() != null ||
             endpointContract.getNormalizedWSDLContract() != null) {
+            // If the contracts are not of the same type use normailized 
interfaces
             endpointReferenceContract = 
((RuntimeEndpointReference)endpointReference).getGeneratedWSDLContract(endpointReferenceContract);
             endpointContract = 
((RuntimeEndpoint)endpoint).getGeneratedWSDLContract(endpointContract);
         }        

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=1304327&r1=1304326&r2=1304327&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
 Fri Mar 23 13:04:42 2012
@@ -119,7 +119,6 @@ public class InerfaceMatchTestCase {
      * @throws Exception
      */
     @Test
-    @Ignore("Can't get RMI binding working as a delegate for some reason")
     public void testDistributedRemotableNonJAXB() throws Exception {
         
         // Force the remote default binding to be rmi as I want something that 
doesn't depend on
@@ -145,21 +144,14 @@ public class InerfaceMatchTestCase {
         
         ClientComponent local = node1.getService(ClientComponent.class, 
"DistributedClientComponent");
         ParameterObject po = new ParameterObject();
+        po.field1 = "Test String";
         
         try {
             String response = local.foo1(po);
-            Assert.assertEquals("AComponent", response);
+            Assert.assertEquals("Test String", 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();


Reply via email to