You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/10/03 20:21:35 UTC

svn commit: r1393651 - in /cxf/branches/2.5.x-fixes/tools/corba/src: main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java test/resources/idl/missing_struct_member.idl

Author: dkulp
Date: Wed Oct  3 18:21:34 2012
New Revision: 1393651

URL: http://svn.apache.org/viewvc?rev=1393651&view=rev
Log:
Merged revisions 1393647 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1393647 | dkulp | 2012-10-03 14:18:24 -0400 (Wed, 03 Oct 2012) | 10 lines

  Merged revisions 1393646 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1393646 | dkulp | 2012-10-03 14:17:10 -0400 (Wed, 03 Oct 2012) | 2 lines

    [CXF-4541] Fix a scoping issue in the idl2wsdl processing

  ........

........

Added:
    cxf/branches/2.5.x-fixes/tools/corba/src/test/resources/idl/missing_struct_member.idl
Modified:
    cxf/branches/2.5.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java
    cxf/branches/2.5.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java

Modified: cxf/branches/2.5.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java?rev=1393651&r1=1393650&r2=1393651&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java (original)
+++ cxf/branches/2.5.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java Wed Oct  3 18:21:34 2012
@@ -319,7 +319,7 @@ public class ScopedNameVisitor extends V
         ModuleToNSMapper mapper = wsdlVisitor.getModuleToNSMapper();
         WSDLSchemaManager manager = wsdlVisitor.getManager();
         
-        Scope scopedName = scope;
+        Scope scopedName = new Scope(scope, node);
         String name = node.toString();
         if (isFullyScopedName(node)) {
             scopedName = getFullyScopedName(new Scope(), node);

Modified: cxf/branches/2.5.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java?rev=1393651&r1=1393650&r2=1393651&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java (original)
+++ cxf/branches/2.5.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/IDLToWSDLTest.java Wed Oct  3 18:21:34 2012
@@ -35,7 +35,12 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
 import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.tools.corba.common.ToolCorbaConstants;
 import org.apache.cxf.tools.corba.common.ToolTestBase;
 import org.apache.cxf.tools.corba.utils.TestUtils;
@@ -395,4 +400,26 @@ public class IDLToWSDLTest extends ToolT
             assertTrue(e.getMessage().indexOf("can't resolve type for const myConst") >= 0);
         }
     }
+
+    public void testCXF4541() throws Exception {
+        File input = new File(getClass().getResource("/idl/missing_struct_member.idl").toURI());
+        String[] args = new String[] {
+            "-mns[org::bash=http://www.bash.org]",
+            "-o", output.toString(),
+            input.toString()
+        };
+        IDLToWSDL.run(args);
+        File fs = new File(output, "org_bash.xsd");
+        assertTrue(fs.getName() + " was not created.", fs.exists());
+        Document doc = StaxUtils.read(new FileInputStream(fs));
+        NodeList l = doc.getDocumentElement().getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "element");
+        for (int x = 0; x < l.getLength(); x++) {
+            Element el = (Element)l.item(x);
+            if ("bar".equals(el.getAttribute("name"))
+                && el.getAttribute("type").contains("string")) {
+                return;
+            }
+        }
+        fail("Did not find foo element");
+    }
 }

Added: cxf/branches/2.5.x-fixes/tools/corba/src/test/resources/idl/missing_struct_member.idl
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/corba/src/test/resources/idl/missing_struct_member.idl?rev=1393651&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/corba/src/test/resources/idl/missing_struct_member.idl (added)
+++ cxf/branches/2.5.x-fixes/tools/corba/src/test/resources/idl/missing_struct_member.idl Wed Oct  3 18:21:34 2012
@@ -0,0 +1,11 @@
+module org
+{
+   module bash
+   {
+       struct foo
+       {
+           string bar;
+       };
+   };
+};
+