incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r546193 - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/processors/idl/ test/resources/idl/
Date Mon, 11 Jun 2007 16:46:31 GMT
Author: dmiddlem
Date: Mon Jun 11 09:46:29 2007
New Revision: 546193

URL: http://svn.apache.org/viewvc?view=rev&rev=546193
Log:
Commit for YOKO-381:
* Fixing issue with interface inheritance when scoping is used but the inheritted type is
not fully
  qualified.
* Updating test case for inheritance.

Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Scope.java
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Inheritance.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/inheritance.idl

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java?view=diff&rev=546193&r1=546192&r2=546193
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
Mon Jun 11 09:46:29 2007
@@ -221,7 +221,18 @@
     private AST visitInterfaceInheritanceSpec(AST interfaceInheritanceSpecNode, Binding binding)
{
         // <interface_inheritance_spec> ::= ":" <interface_name> { "," <interface_name>
}*
         
+        Scope inheritanceScope = null;
         AST interfaceNameNode = interfaceInheritanceSpecNode.getFirstChild();
+
+        // We need to build the scope that may be included with the inheritance node tree
+        while (interfaceNameNode.getFirstChild() != null) {
+            if (inheritanceScope == null) {
+                inheritanceScope = new Scope();
+            }
+            inheritanceScope = new Scope(inheritanceScope, interfaceNameNode.toString());
+            interfaceNameNode = interfaceNameNode.getFirstChild();
+        }
+
         BindingType corbaBinding = findCorbaBinding(binding);
         while (interfaceNameNode != null) {
             
@@ -237,7 +248,14 @@
                 Scope currentScope = getScope();
                 while (intf == null
                        && currentScope != currentScope.getParent()) {
-                    Scope interfaceScope = new Scope(currentScope, interfaceNameNode.toString());
+                    Scope interfaceScope = null;
+                    if (inheritanceScope == null) {
+                        interfaceScope = new Scope(currentScope, interfaceNameNode.toString());
+                    } else {
+                        // Prefix any scope we discovered earlier to the current interfaceNameNode
+                        interfaceScope = new Scope(currentScope, inheritanceScope,
+                                                   interfaceNameNode.toString());
+                    }
                     intf = findPortType(interfaceScope.toString());
                     currentScope = currentScope.getParent();
                 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Scope.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Scope.java?view=diff&rev=546193&r1=546192&r2=546193
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Scope.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Scope.java
Mon Jun 11 09:46:29 2007
@@ -48,6 +48,14 @@
         scope.add(str);
         parent = containingScope;
     }
+
+    // This is used for interface inheritance
+    public Scope(Scope containingScope, Scope prefixScope, String str) {
+        scope = new ArrayList<String>(containingScope.scope);
+        scope.addAll(prefixScope.scope);
+        scope.add(str);
+        parent = containingScope;
+    }
     
     public Scope(Scope containingScope, AST node) {
         scope = new ArrayList<String>(containingScope.scope);

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Inheritance.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Inheritance.wsdl?view=diff&rev=546193&r1=546192&r2=546193
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Inheritance.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Inheritance.wsdl Mon Jun 11
09:46:29 2007
@@ -92,6 +92,30 @@
           </xs:sequence>
         </xs:complexType>
       </xs:element>
+      <xs:element name="testInterface1">
+        <xs:complexType>
+          <xs:sequence>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="testInterface1Response">
+        <xs:complexType>
+          <xs:sequence>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="testInterface2">
+        <xs:complexType>
+          <xs:sequence>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="testInterface2Response">
+        <xs:complexType>
+          <xs:sequence>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
     </xs:schema>
   </wsdl:types>
   <wsdl:message name="setTestCallback">
@@ -106,10 +130,18 @@
     <wsdl:part name="inparameter" element="tns:setCallback">
     </wsdl:part>
   </wsdl:message>
+  <wsdl:message name="testInterface2">
+    <wsdl:part name="inparameter" element="tns:testInterface2">
+    </wsdl:part>
+  </wsdl:message>
   <wsdl:message name="test">
     <wsdl:part name="inparameter" element="tns:test">
     </wsdl:part>
   </wsdl:message>
+  <wsdl:message name="testInterface2Response">
+    <wsdl:part name="outparameter" element="tns:testInterface2Response">
+    </wsdl:part>
+  </wsdl:message>
   <wsdl:message name="setTest">
     <wsdl:part name="inparameter" element="tns:setTest">
     </wsdl:part>
@@ -118,10 +150,18 @@
     <wsdl:part name="outparameter" element="tns:testResponse">
     </wsdl:part>
   </wsdl:message>
+  <wsdl:message name="testInterface1Response">
+    <wsdl:part name="outparameter" element="tns:testInterface1Response">
+    </wsdl:part>
+  </wsdl:message>
   <wsdl:message name="setTestCallbackResponse">
     <wsdl:part name="outparameter" element="tns:setTestCallbackResponse">
     </wsdl:part>
   </wsdl:message>
+  <wsdl:message name="testInterface1">
+    <wsdl:part name="inparameter" element="tns:testInterface1">
+    </wsdl:part>
+  </wsdl:message>
   <wsdl:message name="setTestResponse">
     <wsdl:part name="outparameter" element="tns:setTestResponse">
     </wsdl:part>
@@ -142,6 +182,22 @@
     </wsdl:output>
     </wsdl:operation>
   </wsdl:portType>
+  <wsdl:portType name="A.B.C.E.Interface2">
+    <wsdl:operation name="testInterface2">
+      <wsdl:input name="testInterface2Request" message="tns:testInterface2">
+    </wsdl:input>
+      <wsdl:output name="testInterface2Response" message="tns:testInterface2Response">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:portType name="A.B.C.D.Interface1">
+    <wsdl:operation name="testInterface1">
+      <wsdl:input name="testInterface1Request" message="tns:testInterface1">
+    </wsdl:input>
+      <wsdl:output name="testInterface1Response" message="tns:testInterface1Response">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
   <wsdl:portType name="org.apache.yoko.IpService">
     <wsdl:operation name="setCallback">
       <wsdl:input name="setCallbackRequest" message="tns:setCallback">
@@ -178,6 +234,16 @@
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
+  <wsdl:binding name="A.B.C.E.Interface2CORBABinding" type="tns:A.B.C.E.Interface2">
+    <corba:binding repositoryID="IDL:A/B/C/E/Interface2:1.0" bases="IDL:A/B/C/D/Interface1:1.0"
/>
+    <wsdl:operation name="testInterface2">
+      <corba:operation name="testInterface2" />
+      <wsdl:input name="testInterface2Request">
+      </wsdl:input>
+      <wsdl:output name="testInterface2Response">
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
   <wsdl:binding name="org.apache.yoko.IpServiceCORBABinding" type="tns:org.apache.yoko.IpService">
     <corba:binding repositoryID="IDL:org/apache/yoko/IpService:1.0" bases="IDL:org/apache/yoko/IpInterface:1.0
IDL:org/apache/IpTest:1.0" />
     <wsdl:operation name="setCallback">
@@ -199,6 +265,16 @@
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
+  <wsdl:binding name="A.B.C.D.Interface1CORBABinding" type="tns:A.B.C.D.Interface1">
+    <corba:binding repositoryID="IDL:A/B/C/D/Interface1:1.0" />
+    <wsdl:operation name="testInterface1">
+      <corba:operation name="testInterface1" />
+      <wsdl:input name="testInterface1Request">
+      </wsdl:input>
+      <wsdl:output name="testInterface1Response">
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
   <wsdl:service name="org.apache.yoko.IpServiceCORBAService">
     <wsdl:port name="org.apache.yoko.IpServiceCORBAPort" binding="tns:org.apache.yoko.IpServiceCORBABinding">
       <corba:address location="IOR:" />
@@ -211,6 +287,16 @@
   </wsdl:service>
   <wsdl:service name="org.apache.IpTestCORBAService">
     <wsdl:port name="org.apache.IpTestCORBAPort" binding="tns:org.apache.IpTestCORBABinding">
+      <corba:address location="IOR:" />
+    </wsdl:port>
+  </wsdl:service>
+  <wsdl:service name="A.B.C.E.Interface2CORBAService">
+    <wsdl:port name="A.B.C.E.Interface2CORBAPort" binding="tns:A.B.C.E.Interface2CORBABinding">
+      <corba:address location="IOR:" />
+    </wsdl:port>
+  </wsdl:service>
+  <wsdl:service name="A.B.C.D.Interface1CORBAService">
+    <wsdl:port name="A.B.C.D.Interface1CORBAPort" binding="tns:A.B.C.D.Interface1CORBABinding">
       <corba:address location="IOR:" />
     </wsdl:port>
   </wsdl:service>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/inheritance.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/inheritance.idl?view=diff&rev=546193&r1=546192&r2=546193
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/inheritance.idl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/inheritance.idl Mon Jun 11 09:46:29
2007
@@ -37,4 +37,28 @@
   };  
 };
 
+module A {
+    module B {
+        module C {
+            module D {
+                interface Interface1 {
+                    void testInterface1();
+                };
+            };
+        };
+    };
+};
+
+module A {
+    module B {
+        module C {
+            module E {
+                interface Interface2 : D::Interface1 {
+                    void testInterface2();
+                };
+            };
+        };
+    };
+};
+
 



Mime
View raw message