cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1531018 - in /cxf/branches/2.7.x-fixes/tools/corba/src: main/java/org/apache/cxf/tools/corba/processors/wsdl/ test/java/org/apache/cxf/tools/corba/processors/ test/resources/wsdl/
Date Thu, 10 Oct 2013 15:22:37 GMT
Author: dkulp
Date: Thu Oct 10 15:22:37 2013
New Revision: 1531018

URL: http://svn.apache.org/r1531018
Log:
Merged revisions 1531016 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1531016 | dkulp | 2013-10-10 11:17:16 -0400 (Thu, 10 Oct 2013) | 11 lines

  WSDLtoCorba: handling different forms of sequences

  Related to CXF-5254.
  Introduced the concept of (un)wrapped arrays and sequences (as suggested
  by Daniel Kulp). Element declarations of xsd:complexTypes may be
  sequences/arrays (minOccurs!=0 || maxOccurs!=0) and they appear as a
  sequence of elements with the same name in XML instances (unwrapped
  form).
  However when mapping IDL to WSDL Corba Binding, sequences are always
  wrapped.

........

Added:
    cxf/branches/2.7.x-fixes/tools/corba/src/test/resources/wsdl/arrays-mixed.wsdl
Modified:
    cxf/branches/2.7.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java
    cxf/branches/2.7.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToCorbaBindingTest.java

Modified: cxf/branches/2.7.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java?rev=1531018&r1=1531017&r2=1531018&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java
(original)
+++ cxf/branches/2.7.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java
Thu Oct 10 15:22:37 2013
@@ -36,6 +36,8 @@ import javax.wsdl.Definition;
 import javax.wsdl.Part;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.binding.corba.wsdl.Abstractanonsequence;
+import org.apache.cxf.binding.corba.wsdl.Abstractsequence;
 import org.apache.cxf.binding.corba.wsdl.CaseType;
 import org.apache.cxf.binding.corba.wsdl.CorbaConstants;
 import org.apache.cxf.binding.corba.wsdl.CorbaTypeImpl;
@@ -153,6 +155,11 @@ public class WSDLToCorbaHelper {
                 throw new Exception("Couldn't convert schema " + stype.getQName() + " to
corba type");
             }
         }
+
+        if (corbaTypeImpl != null && !isDuplicate(corbaTypeImpl)) {
+            typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+        }
+
         return corbaTypeImpl;
     }
 
@@ -212,7 +219,7 @@ public class WSDLToCorbaHelper {
             } else if (container instanceof XmlSchemaElement) {
                 XmlSchemaElement element = (XmlSchemaElement)container;
 
-                CorbaTypeImpl corbatype = processLocalElement(element, schemaTypeName.getNamespaceURI());
+                CorbaTypeImpl corbatype = processLocalElement(defaultName, element, schemaTypeName.getNamespaceURI());
                 QName elName = element.getQName();
                 if (elName == null) {
                     elName = element.getRef().getTargetQName();
@@ -295,7 +302,8 @@ public class WSDLToCorbaHelper {
         return corbatype;
     }
 
-    private CorbaTypeImpl processLocalElement(XmlSchemaElement element, String uri) throws
Exception {
+    private CorbaTypeImpl processLocalElement(QName containingTypeName,
+                                              XmlSchemaElement element, String uri) throws
Exception {
         CorbaTypeImpl membertype = new CorbaTypeImpl();
 
         XmlSchemaType schemaType = element.getSchemaType();
@@ -341,7 +349,14 @@ public class WSDLToCorbaHelper {
         } else if (schemaType != null) {
             XmlSchemaType st = schemaType;
             boolean anonymous = WSDLTypes.isAnonymous(st.getName());
-            membertype = convertSchemaToCorbaType(st, elemName, st, null, anonymous);
+            QName typeName = null;
+            if (anonymous) {
+                typeName = new QName(elemName.getNamespaceURI(),
+                                     containingTypeName.getLocalPart() + "." + elemName.getLocalPart());
+            } else {
+                typeName = st.getQName();
+            }
+            membertype = convertSchemaToCorbaType(st, typeName, st, null, anonymous);
         } else if (element.getSchemaTypeName() != null) {
             QName name = checkPrefix(element.getSchemaTypeName());
             membertype = getLocalType(name);
@@ -355,21 +370,30 @@ public class WSDLToCorbaHelper {
                                                     + elemName.getLocalPart() + "Array");
             CorbaTypeImpl arraytype = null;
             if (memName != null) {
-                arraytype = createArray(name, schemaName, memName, elemName,
+                arraytype = createArray(name, /*schemaName*/name, memName, elemName,
                                         element.getMaxOccurs(), element.getMinOccurs(), false);
             } else {
-                arraytype = createArray(name, schemaName, membertype.getQName(), elemName,
+                arraytype = createArray(name, /*schemaName*/name, membertype.getQName(),
elemName,
                                         element.getMaxOccurs(), element.getMinOccurs(), false);
             }
 
             if (arraytype != null) {
-                membertype.setName(arraytype.getName());
-                membertype.setQName(arraytype.getQName());
-                membertype.setType(arraytype.getType());
+                if (arraytype instanceof Abstractsequence) {
+                    ((Abstractsequence)arraytype).setWrapped(false);
+                }
+                if (arraytype instanceof Abstractanonsequence) {
+                    ((Abstractanonsequence)arraytype).setWrapped(false);
+                }
+                // we don't change a type which is already added to typeMappingType.getStructOrExceptionOrUnion()!
+//                membertype.setName(arraytype.getName());
+//                membertype.setQName(arraytype.getQName());
+//                membertype.setType(arraytype.getType());
 
                 if (!isDuplicate(arraytype)) {
                     typeMappingType.getStructOrExceptionOrUnion().add(arraytype);
                 }
+                // the local element with maxOccurs != 1 or minOccurs != 1 becomes the just
created array
+                membertype = arraytype;
             }
         }
         membertype.setQualified(elementQualified);
@@ -1304,7 +1328,12 @@ public class WSDLToCorbaHelper {
                     if (elName.getNamespaceURI().equals("")) {
                         elName = new QName(uri, elName.getLocalPart());
                     }
-                    arrayType = convertSchemaToCorbaType(atype, elName, atype, null, true);
+                    QName arrayTypeName = elName;
+                    if (anonymous) {
+                        arrayTypeName = new QName(elName.getNamespaceURI(),
+                                                  defaultName.getLocalPart() + "." + elName.getLocalPart());
+                    }
+                    arrayType = convertSchemaToCorbaType(atype, arrayTypeName, atype, null,
true);
                     boolean isQualified = getElementQualification(arrayEl, uri);
                     if (isQualified) {
                         arrayType.setQualified(isQualified);

Modified: cxf/branches/2.7.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToCorbaBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToCorbaBindingTest.java?rev=1531018&r1=1531017&r2=1531018&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToCorbaBindingTest.java
(original)
+++ cxf/branches/2.7.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToCorbaBindingTest.java
Thu Oct 10 15:22:37 2013
@@ -20,6 +20,7 @@
 package org.apache.cxf.tools.corba.processors;
 
 import java.io.File;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -37,6 +38,11 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import org.apache.cxf.binding.corba.CorbaTypeMap;
+import org.apache.cxf.binding.corba.utils.CorbaUtils;
+import org.apache.cxf.binding.corba.wsdl.Anonarray;
+import org.apache.cxf.binding.corba.wsdl.Anonsequence;
+import org.apache.cxf.binding.corba.wsdl.Array;
 import org.apache.cxf.binding.corba.wsdl.BindingType;
 import org.apache.cxf.binding.corba.wsdl.CorbaConstants;
 import org.apache.cxf.binding.corba.wsdl.CorbaTypeImpl;
@@ -44,12 +50,12 @@ import org.apache.cxf.binding.corba.wsdl
 import org.apache.cxf.binding.corba.wsdl.OperationType;
 import org.apache.cxf.binding.corba.wsdl.ParamType;
 import org.apache.cxf.binding.corba.wsdl.Sequence;
+import org.apache.cxf.binding.corba.wsdl.Struct;
 import org.apache.cxf.binding.corba.wsdl.TypeMappingType;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.corba.common.WSDLCorbaFactory;
 import org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding;
 import org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction;
-
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -739,7 +745,289 @@ public class WSDLToCorbaBindingTest exte
             new File("array.idl").deleteOnExit();
         }
     }
+
+    @Test
+    public void testMixedArraysMapping() throws Exception {
+        try {
+            String fileName = getClass().getResource("/wsdl/arrays-mixed.wsdl").toString();
+            generator.setWsdlFile(fileName);
+            generator.addInterfaceName("X");
+
+            Definition model = generator.generateCORBABinding();
+            QName bName = new QName("http://schemas.apache.org/idl/anon.idl",
+                "XCORBABinding", "tns");
+
+            Binding binding = model.getBinding(bName);
+            assertNotNull(binding);
+            assertEquals("XCORBABinding", binding.getQName().getLocalPart());
+            assertEquals("X", binding.getPortType().getQName().getLocalPart());
+            assertEquals(1, binding.getExtensibilityElements().size());
+            assertEquals(1, binding.getBindingOperations().size());
+
+            for (ExtensibilityElement extElement: getExtensibilityElements(binding)) {
+                if (extElement.getElementType().getLocalPart().equals("binding")) {
+                    BindingType bindingType = (BindingType)extElement;
+                    assertEquals(bindingType.getRepositoryID(), "IDL:X:1.0");
+                }
+            }
+
+            this.writer.writeWSDL(model, System.out);
+
+            Iterator<?> tm = model.getExtensibilityElements().iterator();
+            assertTrue(tm.hasNext());
+            TypeMappingType tmt = (TypeMappingType)tm.next();
+            CorbaTypeMap typeMap = CorbaUtils.createCorbaTypeMap(Arrays.asList(tmt));
+
+            assertNull("All nested anonymous types should have \"nested\" names", typeMap.getType("item"));
+
+            // Checkstyle forces me to split the method...
+            assertMixedArraysMappingEasyTypes(typeMap);
+
+            // elem types are no longer strings from now.
+            assertMixedArraysMappingDifficultSequences(typeMap);
+            assertMixedArraysMappingDifficultArrays(typeMap);
+
+            Iterator<?> j = binding.getBindingOperations().iterator();
+            while (j.hasNext()) {
+                BindingOperation bindingOperation = (BindingOperation)j.next();
+                assertEquals(1, bindingOperation.getExtensibilityElements().size());
+                assertEquals(bindingOperation.getBindingInput().getName(), "op_a");
+                assertEquals(bindingOperation.getBindingOutput().getName(), "op_aResponse");
+
+                for (ExtensibilityElement extElement: getExtensibilityElements(bindingOperation))
{
+                    if (extElement.getElementType().getLocalPart().equals("operation")) {
+                        OperationType corbaOpType = (OperationType)extElement;
+                        assertEquals(corbaOpType.getName(), "op_a");
+                        assertEquals(1, corbaOpType.getParam().size());
+                        assertNotNull(corbaOpType.getReturn());
+                        ParamType paramtype = corbaOpType.getParam().get(0);
+                        assertEquals(paramtype.getName(), "part1");
+                        QName idltype = new QName("http://schemas.apache.org/idl/anon.idl/corba/typemap/",
+                            "MixedArrayType", "ns1");
+                        assertEquals(paramtype.getIdltype(), idltype);
+                        assertEquals(paramtype.getMode().toString(), "IN");
+                    } else if (extElement.getElementType().getLocalPart().equals("typeMapping"))
{
+                        System.out.println("x");
+                    }
+                }
+            }
+
+            // See if an IDL is able to produce from this CORBA Binding.
+            WSDLToIDLAction idlgen = new WSDLToIDLAction();
+            idlgen.setBindingName("XCORBABinding");
+            idlgen.setOutputFile("array.idl");
+            idlgen.generateIDL(model);
+
+            File f = new File("array.idl");
+            assertTrue("array.idl should be generated", f.exists());
+        } finally {
+            new File("array.idl").deleteOnExit();
+        }
+    }
         
+    /**
+     * @param typeMap
+     */
+    private void assertMixedArraysMappingEasyTypes(CorbaTypeMap typeMap) {
+        Sequence p1 = (Sequence)typeMap.getType("p1-unwrapped-sequenceArray");
+        assertEquals(new QName("", "p1-unwrapped-sequence"), p1.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p1.getElemtype());
+        Sequence p1q = (Sequence)typeMap.getType("p1-unwrapped-sequence-qArray");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "p1-unwrapped-sequence-q"),
+            p1q.getElemname());
+        assertFalse(p1.isWrapped());
+
+        Sequence p2 = (Sequence)typeMap.getType("UnboundedArray");
+        assertEquals(new QName("", "item"), p2.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p2.getElemtype());
+        assertTrue(p2.isWrapped());
+
+        Array p3 = (Array)typeMap.getType("p3-unwrapped-arrayArray");
+        assertEquals(new QName("", "p3-unwrapped-array"), p3.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p3.getElemtype());
+        Array p3q = (Array)typeMap.getType("p3-unwrapped-array-qArray");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "p3-unwrapped-array-q"),
+            p3q.getElemname());
+        assertFalse(p3.isWrapped());
+
+        Array p4 = (Array)typeMap.getType("FixedArray");
+        assertEquals(new QName("", "item"), p4.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p4.getElemtype());
+        assertTrue(p4.isWrapped());
+
+        Sequence p5 = (Sequence)typeMap.getType("p5-anonymous-unwrapped-sequenceArray");
+        assertEquals(new QName("", "p5-anonymous-unwrapped-sequence"), p5.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p5.getElemtype());
+        Sequence p5q = (Sequence)typeMap.getType("p5-anonymous-unwrapped-sequence-qArray");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "p5-anonymous-unwrapped-sequence-q"),
+            p5q.getElemname());
+        assertFalse(p5.isWrapped());
+
+        Anonsequence p6 = (Anonsequence)typeMap.getType("MixedArrayType.p6-anonymous-wrapped-sequenceType");
+        assertEquals(new QName("", "item"), p6.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p6.getElemtype());
+        assertFalse(p6.isQualified());
+        assertTrue(p6.isWrapped());
+        Anonsequence p6q = (Anonsequence)typeMap.getType("MixedArrayType.p6-anonymous-wrapped-sequence-qType");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "item"), p6q.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p6q.getElemtype());
+        assertTrue(p6q.isQualified());
+        assertTrue(p6q.isWrapped());
+
+        Array p7 = (Array)typeMap.getType("p7-anonymous-unwrapped-arrayArray");
+        assertEquals(new QName("", "p7-anonymous-unwrapped-array"), p7.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p7.getElemtype());
+        assertFalse(p7.isQualified());
+        assertFalse(p7.isWrapped());
+        Array p7q = (Array)typeMap.getType("p7-anonymous-unwrapped-array-qArray");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "p7-anonymous-unwrapped-array-q"),
+            p7q.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p7q.getElemtype());
+        assertTrue(p7q.isQualified());
+        assertFalse(p7q.isWrapped());
+
+        Anonarray p8 = (Anonarray)typeMap.getType("MixedArrayType.p8-anonymous-wrapped-arrayType");
+        assertEquals(new QName("", "item"), p8.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p8.getElemtype());
+        assertFalse(p8.isQualified());
+        assertTrue(p8.isWrapped());
+        Anonarray p8q = (Anonarray)typeMap.getType("MixedArrayType.p8-anonymous-wrapped-array-qType");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "item"), p8q.getElemname());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p8q.getElemtype());
+        assertTrue(p8q.isQualified());
+        assertTrue(p8q.isWrapped());
+    }
+
+    /**
+     * @param typeMap
+     */
+    private void assertMixedArraysMappingDifficultSequences(CorbaTypeMap typeMap) {
+        String corbaTm = "http://schemas.apache.org/idl/anon.idl/corba/typemap/";
+
+        // p9 is unwrapped, so there's "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequenceArray"
type
+        // registered and "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence"
as type of the element
+        // which is Struct
+        Sequence p9 = (Sequence)typeMap.getType(
+            "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequenceArray");
+        assertEquals(new QName("", "p9-anonymous-unwrapped-non-primitive-sequence"), p9.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence"),
+            p9.getElemtype());
+        assertFalse(p9.isQualified());
+        assertFalse(p9.isWrapped());
+        Struct p9item = (Struct)typeMap.getType("MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence");
+        assertEquals(1, p9item.getMember().size());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p9item.getMember().get(0).getIdltype());
+        assertEquals("item", p9item.getMember().get(0).getName());
+        Sequence p9q = (Sequence)typeMap.getType(
+            "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence-qArray");
+        assertEquals(
+            new QName("http://schemas.apache.org/idltypes/anon.idl",
+                      "p9-anonymous-unwrapped-non-primitive-sequence-q"),
+            p9q.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence-q"),
+            p9q.getElemtype());
+        assertTrue(p9q.isQualified());
+        assertFalse(p9q.isWrapped());
+        Struct p9qitem = (Struct)typeMap.getType("MixedArrayType.p9-anonymous-unwrapped-non-primitive-sequence-q");
+        assertEquals(1, p9qitem.getMember().size());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p9qitem.getMember().get(0).getIdltype());
+        assertEquals("item", p9qitem.getMember().get(0).getName());
+
+        // p10 is wrapped, so there's no "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequenceArray"
+        Anonsequence p10 = (Anonsequence)typeMap.getType(
+            "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequenceType");
+        assertEquals(new QName("", "item"), p10.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequence.item"),
+            p10.getElemtype());
+        assertFalse(p10.isQualified());
+        assertTrue(p10.isWrapped());
+        Struct p10item = (Struct)typeMap.getType(
+            "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequence.item");
+        assertEquals(p10item.getMember().size(), 1);
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p10item.getMember().get(0).getIdltype());
+        assertEquals("item", p10item.getMember().get(0).getName());
+        assertFalse(p10item.getMember().get(0).isSetQualified());
+        Anonsequence p10q = (Anonsequence)typeMap.getType(
+            "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequence-qType");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "item"), p10q.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequence-q.item"),
+            p10q.getElemtype());
+        assertTrue(p10q.isQualified());
+        assertTrue(p10q.isWrapped());
+        Struct p10qitem = (Struct)typeMap.getType(
+            "MixedArrayType.p10-anonymous-wrapped-non-primitive-sequence-q.item");
+        assertEquals(p10qitem.getMember().size(), 1);
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p10qitem.getMember().get(0).getIdltype());
+        assertEquals("item", p10qitem.getMember().get(0).getName());
+        assertTrue(p10qitem.getMember().get(0).isQualified());
+    }
+
+    /**
+     * @param typeMap
+     */
+    private void assertMixedArraysMappingDifficultArrays(CorbaTypeMap typeMap) {
+        String corbaTm = "http://schemas.apache.org/idl/anon.idl/corba/typemap/";
+
+        // p11 is unwrapped, so the same case as p9
+        Array p11 = (Array)typeMap.getType("MixedArrayType.p11-anonymous-unwrapped-non-primitive-arrayArray");
+        assertEquals(new QName("", "p11-anonymous-unwrapped-non-primitive-array"), p11.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p11-anonymous-unwrapped-non-primitive-array"),
+            p11.getElemtype());
+        assertFalse(p11.isQualified());
+        assertFalse(p11.isWrapped());
+        Struct p11item = (Struct)typeMap.getType("MixedArrayType.p11-anonymous-unwrapped-non-primitive-array");
+        assertEquals(1, p11item.getMember().size());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p11item.getMember().get(0).getIdltype());
+        assertEquals("item", p11item.getMember().get(0).getName());
+        Array p11q = (Array)typeMap.getType("MixedArrayType.p11-anonymous-unwrapped-non-primitive-array-qArray");
+        assertEquals(
+            new QName("http://schemas.apache.org/idltypes/anon.idl",
+                      "p11-anonymous-unwrapped-non-primitive-array-q"),
+            p11q.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p11-anonymous-unwrapped-non-primitive-array-q"),
+            p11q.getElemtype());
+        assertTrue(p11q.isQualified());
+        assertFalse(p11q.isWrapped());
+        Struct p11qitem = (Struct)typeMap.getType("MixedArrayType.p11-anonymous-unwrapped-non-primitive-array-q");
+        assertEquals(1, p11qitem.getMember().size());
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p11qitem.getMember().get(0).getIdltype());
+        assertEquals("item", p11qitem.getMember().get(0).getName());
+
+        // p12 us wrapped - see p10
+        Anonarray p12 = (Anonarray)typeMap.getType("MixedArrayType.p12-anonymous-wrapped-non-primitive-arrayType");
+        assertEquals(new QName("", "item"), p12.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p12-anonymous-wrapped-non-primitive-array.item"),
+            p12.getElemtype());
+        assertFalse(p12.isQualified());
+        assertTrue(p12.isWrapped());
+        Struct p12item = (Struct)typeMap.getType("MixedArrayType.p12-anonymous-wrapped-non-primitive-array.item");
+        assertEquals(p12item.getMember().size(), 1);
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p12item.getMember().get(0).getIdltype());
+        assertEquals("item", p12item.getMember().get(0).getName());
+        assertFalse(p12item.getMember().get(0).isSetQualified());
+        Anonarray p12q = (Anonarray)typeMap.getType(
+            "MixedArrayType.p12-anonymous-wrapped-non-primitive-array-qType");
+        assertEquals(new QName("http://schemas.apache.org/idltypes/anon.idl", "item"), p12q.getElemname());
+        assertEquals(
+            new QName(corbaTm, "MixedArrayType.p12-anonymous-wrapped-non-primitive-array-q.item"),
+            p12q.getElemtype());
+        assertTrue(p12q.isQualified());
+        assertTrue(p12q.isWrapped());
+        Struct p12qitem = (Struct)typeMap.getType(
+            "MixedArrayType.p12-anonymous-wrapped-non-primitive-array-q.item");
+        assertEquals(p12qitem.getMember().size(), 1);
+        assertEquals(new QName(CorbaConstants.NU_WSDL_CORBA, "string"), p12qitem.getMember().get(0).getIdltype());
+        assertEquals("item", p12qitem.getMember().get(0).getName());
+        assertTrue(p12qitem.getMember().get(0).isQualified());
+    }
+
     private List<ExtensibilityElement> getExtensibilityElements(javax.wsdl.extensions.ElementExtensible
e) {
         return CastUtils.cast(e.getExtensibilityElements());
     }

Added: cxf/branches/2.7.x-fixes/tools/corba/src/test/resources/wsdl/arrays-mixed.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/tools/corba/src/test/resources/wsdl/arrays-mixed.wsdl?rev=1531018&view=auto
==============================================================================
--- cxf/branches/2.7.x-fixes/tools/corba/src/test/resources/wsdl/arrays-mixed.wsdl (added)
+++ cxf/branches/2.7.x-fixes/tools/corba/src/test/resources/wsdl/arrays-mixed.wsdl Thu Oct
10 15:22:37 2013
@@ -0,0 +1,278 @@
+<?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
+ * "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.
+-->
+<definitions name="anon.idl"
+    targetNamespace="http://schemas.apache.org/idl/anon.idl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://schemas.apache.org/idl/anon.idl"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsd1="http://schemas.apache.org/idltypes/anon.idl"
+    xmlns:corba="http://schemas.apache.org/bindings/corba"
+    xmlns:corbatm="http://schemas.apache.org/bindings/corba/typemap">
+    <types>
+        <schema targetNamespace="http://schemas.apache.org/idltypes/anon.idl"
+            xmlns="http://www.w3.org/2001/XMLSchema"
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+            <complexType name="UnboundedArray">
+                <sequence>
+                    <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"
/>
+                </sequence>
+            </complexType>
+            <complexType name="FixedArray">
+                <sequence>
+                    <element name="item" type="xsd:string" minOccurs="3" maxOccurs="3"
/>
+                </sequence>
+            </complexType>
+            <complexType name="MixedArrayType">
+                <sequence>
+                    <!-- This is a single part -->
+                    <element name="p0" type="xsd:string"/>
+                    <!-- unwrapped sequence -->
+                    <element name="p1-unwrapped-sequence" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" />
+                    <element name="p1-unwrapped-sequence-q" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" form="qualified" />
+                    <element name="p1-unwrapped-sequence-n" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" nillable="true" />
+                    <!-- wrapped sequence -->
+                    <element name="p2-wrapped-sequence" type="xsd1:UnboundedArray" minOccurs="1"
maxOccurs="1" />
+<!--                     <element name="p2-wrapped-sequence-n" type="xsd1:UnboundedArray"
minOccurs="1" maxOccurs="1" nillable="true" /> -->
+                    <!-- unwrapped array -->
+                    <element name="p3-unwrapped-array" type="xsd:string" minOccurs="3"
maxOccurs="3" />
+                    <element name="p3-unwrapped-array-q" type="xsd:string" minOccurs="3"
maxOccurs="3" form="qualified" />
+                    <element name="p3-unwrapped-array-n" type="xsd:string" minOccurs="3"
maxOccurs="3" nillable="true" />
+                    <!-- wrapped array -->
+                    <element name="p4-wrapped-array" type="xsd1:FixedArray" minOccurs="1"
maxOccurs="1" />
+<!--                     <element name="p4-wrapped-array-n" type="xsd1:FixedArray"
minOccurs="1" maxOccurs="1" nillable="true" /> -->
+                    <!-- anonymous unwrapped sequence - not anonymous, because processed
in processLocalElement -->
+                    <element name="p5-anonymous-unwrapped-sequence" minOccurs="0" maxOccurs="unbounded">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <element name="p5-anonymous-unwrapped-sequence-q" minOccurs="0" maxOccurs="unbounded"
form="qualified">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <element name="p5-anonymous-unwrapped-sequence-n" minOccurs="0" maxOccurs="unbounded"
nillable="true">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <!-- anonymous wrapped sequence -->
+                    <element name="p6-anonymous-wrapped-sequence" minOccurs="1" maxOccurs="1">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p6-anonymous-wrapped-sequence-q" minOccurs="1" maxOccurs="1"
form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"
form="qualified" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p6-anonymous-wrapped-sequence-n" minOccurs="1" maxOccurs="1"
nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <!-- anonymous unwrapped array - not anonymous, because processed
in processLocalElement -->
+                    <element name="p7-anonymous-unwrapped-array" minOccurs="3" maxOccurs="3">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <element name="p7-anonymous-unwrapped-array-q" minOccurs="3" maxOccurs="3"
form="qualified">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <element name="p7-anonymous-unwrapped-array-n" minOccurs="3" maxOccurs="3"
nillable="true">
+                        <simpleType>
+                            <restriction base="xsd:string" />
+                        </simpleType>
+                    </element>
+                    <!-- anonymous wrapped array -->
+                    <element name="p8-anonymous-wrapped-array" minOccurs="1" maxOccurs="1">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="3" maxOccurs="3"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p8-anonymous-wrapped-array-q" minOccurs="1" maxOccurs="1"
form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="3" maxOccurs="3"
form="qualified" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p8-anonymous-wrapped-array-n" minOccurs="1" maxOccurs="1"
nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" minOccurs="3" maxOccurs="3"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <!-- anonymous unwrapped non-primitive sequence - not anonymous, because
processed in processLocalElement -->
+                    <element name="p9-anonymous-unwrapped-non-primitive-sequence" minOccurs="0"
maxOccurs="unbounded">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p9-anonymous-unwrapped-non-primitive-sequence-q" minOccurs="0"
maxOccurs="unbounded" form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" form="qualified"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p9-anonymous-unwrapped-non-primitive-sequence-n" minOccurs="0"
maxOccurs="unbounded" nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <!-- anonymous wrapped non-primitive sequence -->
+                    <element name="p10-anonymous-wrapped-non-primitive-sequence" minOccurs="1"
maxOccurs="1">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="0" maxOccurs="unbounded">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" />
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p10-anonymous-wrapped-non-primitive-sequence-q" minOccurs="1"
maxOccurs="1" form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="0" maxOccurs="unbounded"
form="qualified">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" form="qualified"
/>
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p10-anonymous-wrapped-non-primitive-sequence-n" minOccurs="1"
maxOccurs="1" nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="0" maxOccurs="unbounded">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" />
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <!-- anonymous unwrapped non-primitive array - not anonymous, because
processed in processLocalElement -->
+                    <element name="p11-anonymous-unwrapped-non-primitive-array" minOccurs="3"
maxOccurs="3">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p11-anonymous-unwrapped-non-primitive-array-q" minOccurs="3"
maxOccurs="3" form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" form="qualified"
/>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p11-anonymous-unwrapped-non-primitive-array-n" minOccurs="3"
maxOccurs="3" nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" type="xsd:string" />
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <!-- anonymous wrapped non-primitive array -->
+                    <element name="p12-anonymous-wrapped-non-primitive-array" minOccurs="1"
maxOccurs="1">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="3" maxOccurs="3">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" />
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p12-anonymous-wrapped-non-primitive-array-q" minOccurs="1"
maxOccurs="1" form="qualified">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="3" maxOccurs="3" form="qualified">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" form="qualified"
/>
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                    <element name="p12-anonymous-wrapped-non-primitive-array-n" minOccurs="1"
maxOccurs="1" nillable="true">
+                        <complexType>
+                            <sequence>
+                                <element name="item" minOccurs="3" maxOccurs="3">
+                                    <complexType>
+                                        <sequence>
+                                            <element name="item" type="xsd:string" />
+                                        </sequence>
+                                    </complexType>
+                                </element>
+                            </sequence>
+                        </complexType>
+                    </element>
+                </sequence>
+            </complexType>
+
+        </schema>
+    </types>
+    <message name="X.op_a">
+        <part name="part1" type="xsd1:MixedArrayType"/>
+    </message>
+    <message name="X.op_aResponse">
+        <part name="return" type="xsd:string"/>
+    </message>
+
+    <portType name="X">
+        <operation name="op_a">
+            <input message="tns:X.op_a" name="op_a"/>
+            <output message="tns:X.op_aResponse" name="op_aResponse"/>
+        </operation>
+    </portType>
+</definitions>



Mime
View raw message