Author: ffang
Date: Sun Jan 30 05:13:37 2011
New Revision: 1065189
URL: http://svn.apache.org/viewvc?rev=1065189&view=rev
Log:
[CXF-3293]idl2wsdl tool fails if parameter refer an interface from other module
in an included idl file
Added:
cxf/trunk/tools/corba/src/test/resources/idl/ExternalInterfaceRef.idl
cxf/trunk/tools/corba/src/test/resources/idl/expected_ExternalInterfaceRef.wsdl
Modified:
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
Modified:
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java?rev=1065189&r1=1065188&r2=1065189&view=diff
==============================================================================
---
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
(original)
+++
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
Sun Jan 30 05:13:37 2011
@@ -185,6 +185,12 @@ public class ObjectReferenceVisitor exte
}
repositoryID = customScope.toIDLRepositoryID();
bindingName = getBindingQNameByID(definition, repositoryID,
objRefWsdlVisitor);
+ if (bindingName == null) {
+ //check bindingName with prefix
+ customScope.setPrefix(objRefWsdlVisitor.getPragmaPrefix());
+ repositoryID = customScope.toIDLRepositoryID();
+ bindingName = getBindingQNameByID(definition, repositoryID,
objRefWsdlVisitor);
+ }
}
if (bindingName == null) {
@@ -540,6 +546,12 @@ public class ObjectReferenceVisitor exte
}
repositoryID = customScope.toIDLRepositoryID();
bindingName = getBindingQNameByID(def, repositoryID, wsdlVisitor);
+ if (bindingName == null) {
+ //check bindingName with prefix
+ customScope.setPrefix(wsdlVisitor.getPragmaPrefix());
+ repositoryID = customScope.toIDLRepositoryID();
+ bindingName = getBindingQNameByID(def, repositoryID,
wsdlVisitor);
+ }
}
if (bindingName != null) {
Modified:
cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java?rev=1065189&r1=1065188&r2=1065189&view=diff
==============================================================================
---
cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
(original)
+++
cxf/trunk/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
Sun Jan 30 05:13:37 2011
@@ -325,12 +325,13 @@ public class IDLToWSDLTest extends ToolT
File actual = new File(output, "Parent.wsdl");
File expected =
new
File(getClass().getResource("/idl/expected_Parent.wsdl").toURI());
-
+ File include0Dir = new File(getClass().getResource("/idl").toURI());
File include1Dir = new
File(getClass().getResource("/idl/subdir1").toURI());
File include2Dir = new
File(getClass().getResource("/idl/subdir2").toURI());
String[] args = new String[] {"-ow", "Parent.wsdl",
"-o", output.toString(),
+ "-I", include0Dir.toString(),
"-I", include1Dir.toString(),
"-I", include2Dir.toString(),
input.toString()
@@ -339,4 +340,25 @@ public class IDLToWSDLTest extends ToolT
assertEquals("IDLToWSDL Failed", noError, exc);
doTestGeneratedWsdl(expected, actual);
}
+
+ public void testExternalInterfaceRef() throws Exception {
+ File input = new
File(getClass().getResource("/idl/ExternalInterfaceRef.idl").toURI());
+ File actual = new File(output, "ExternalInterfaceRef.wsdl");
+ File expected =
+ new
File(getClass().getResource("/idl/expected_ExternalInterfaceRef.wsdl").toURI());
+
+
+ File include1Dir = new File(getClass().getResource("/idl").toURI());
+
+ String[] args = new String[] {"-ow", "ExternalInterfaceRef.wsdl",
+ "-o", output.toString(),
+ "-I", include1Dir.toString(),
+ "-verbose",
+ input.toString()
+ };
+ int exc = execute(args);
+ assertEquals("IDLToWSDL Failed", noError, exc);
+ doTestGeneratedWsdl(expected, actual);
+ }
+
}
Added: cxf/trunk/tools/corba/src/test/resources/idl/ExternalInterfaceRef.idl
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/ExternalInterfaceRef.idl?rev=1065189&view=auto
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/ExternalInterfaceRef.idl
(added)
+++ cxf/trunk/tools/corba/src/test/resources/idl/ExternalInterfaceRef.idl Sun
Jan 30 05:13:37 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.
+ */
+
+#ifndef EXTERNAL_INTTERFACE_REF_IDL
+#define EXTERNAL_INTTERFACE_REF_IDL
+
+#include "PragmaPrefix.idl"
+
+module ExternalInterfaceRef {
+
+ interface TestForExternalInterfaceRef
+ {
+ void testExternalInterfRef(in Test2::ForTesting arg0);
+ };
+};
+#endif
Added:
cxf/trunk/tools/corba/src/test/resources/idl/expected_ExternalInterfaceRef.wsdl
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/expected_ExternalInterfaceRef.wsdl?rev=1065189&view=auto
==============================================================================
---
cxf/trunk/tools/corba/src/test/resources/idl/expected_ExternalInterfaceRef.wsdl
(added)
+++
cxf/trunk/tools/corba/src/test/resources/idl/expected_ExternalInterfaceRef.wsdl
Sun Jan 30 05:13:37 2011
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
targetNamespace="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef"
xmlns:corba="http://cxf.apache.org/bindings/corba"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:tns="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <corba:typeMapping
targetNamespace="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef/typemap">
+ <corba:const xmlns:xs="http://www.w3.org/2001/XMLSchema" value="\2"
idltype="corba:char" name="Test2.TRANSIENT" type="xs:byte"/>
+ <corba:object xmlns:ns4="http://www.w3.org/2005/08/addressing"
xmlns="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef"
binding="Test2.ForTestingCORBABinding"
repositoryID="IDL:org.apache.cxf/Test2/ForTesting:1.0" name="Test2.ForTesting"
type="ns4:EndpointReferenceType"/>
+ </corba:typeMapping>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef"
xmlns="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:import namespace="http://www.w3.org/2005/08/addressing"
schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd">
+ </xs:import>
+ <xs:element name="_get_session">
+ <xs:complexType>
+ <xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Test2.ForTestingRef" type="wsa:EndpointReferenceType">
+ <xs:annotation>
+ <xs:appinfo>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="_get_sessionResult">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="return" nillable="true"
type="wsa:EndpointReferenceType">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="greetMe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="who" type="xs:string">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="greetMeResponse">
+ <xs:complexType>
+ <xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="testExternalInterfRef">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="arg0" nillable="true"
type="wsa:EndpointReferenceType">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="testExternalInterfRefResponse">
+ <xs:complexType>
+ <xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="testExternalInterfRef">
+ <wsdl:part name="inparameter" element="tns:testExternalInterfRef">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="greetMe">
+ <wsdl:part name="inparameter" element="tns:greetMe">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="_get_sessionResponse">
+ <wsdl:part name="parameters" element="tns:_get_sessionResult">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="testExternalInterfRefResponse">
+ <wsdl:part name="outparameter" element="tns:testExternalInterfRefResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="_get_session">
+ <wsdl:part name="parameters" element="tns:_get_session">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part name="outparameter" element="tns:greetMeResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="ExternalInterfaceRef.TestForExternalInterfaceRef">
+ <wsdl:operation name="testExternalInterfRef">
+ <wsdl:input name="testExternalInterfRefRequest"
message="tns:testExternalInterfRef">
+ </wsdl:input>
+ <wsdl:output name="testExternalInterfRefResponse"
message="tns:testExternalInterfRefResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="Test2.ForTesting">
+ <wsdl:operation name="_get_session">
+ <wsdl:input name="_get_session" message="tns:_get_session">
+ </wsdl:input>
+ <wsdl:output name="_get_sessionResponse"
message="tns:_get_sessionResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="greetMe">
+ <wsdl:input name="greetMeRequest" message="tns:greetMe">
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse" message="tns:greetMeResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="Test2.ForTestingCORBABinding"
type="tns:Test2.ForTesting">
+ <corba:binding repositoryID="IDL:org.apache.cxf/Test2/ForTesting:1.0"/>
+ <wsdl:operation name="_get_session">
+ <corba:operation name="_get_session">
+ <corba:return
xmlns="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef/typemap"
name="return" idltype="Test2.ForTesting"/>
+ </corba:operation>
+ <wsdl:input name="_get_session">
+ </wsdl:input>
+ <wsdl:output name="_get_sessionResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="greetMe">
+ <corba:operation name="greetMe">
+ <corba:param mode="in" name="who" idltype="corba:string"/>
+ </corba:operation>
+ <wsdl:input name="greetMeRequest">
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding
name="ExternalInterfaceRef.TestForExternalInterfaceRefCORBABinding"
type="tns:ExternalInterfaceRef.TestForExternalInterfaceRef">
+ <corba:binding
repositoryID="IDL:org.apache.cxf/ExternalInterfaceRef/TestForExternalInterfaceRef:1.0"/>
+ <wsdl:operation name="testExternalInterfRef">
+ <corba:operation name="testExternalInterfRef">
+ <corba:param
xmlns="http://cxf.apache.org/bindings/corba/idl/ExternalInterfaceRef/typemap"
mode="in" name="arg0" idltype="Test2.ForTesting"/>
+ </corba:operation>
+ <wsdl:input name="testExternalInterfRefRequest">
+ </wsdl:input>
+ <wsdl:output name="testExternalInterfRefResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service
name="ExternalInterfaceRef.TestForExternalInterfaceRefCORBAService">
+ <wsdl:port
name="ExternalInterfaceRef.TestForExternalInterfaceRefCORBAPort"
binding="tns:ExternalInterfaceRef.TestForExternalInterfaceRefCORBABinding">
+ <corba:address location="IOR:"/>
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="Test2.ForTestingCORBAService">
+ <wsdl:port name="Test2.ForTestingCORBAPort"
binding="tns:Test2.ForTestingCORBABinding">
+ <corba:address location="IOR:"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>