incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r544186 - in /incubator/yoko/trunk: bindings/src/test/java/org/apache/yoko/bindings/corba/ tools/src/main/java/org/apache/yoko/tools/processors/idl/ tools/src/test/resources/idl/
Date Mon, 04 Jun 2007 17:06:02 GMT
Author: bravi
Date: Mon Jun  4 10:05:57 2007
New Revision: 544186

URL: http://svn.apache.org/viewvc?view=rev&rev=544186
Log:
[YOKO-375] - Fix for IDLToWSDL to handle sequence of octets when the octet is defined as a
typedef.

Modified:
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopedNameVisitor.java
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_base64Binary_sequence_octet.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_hexBinary_sequence_octet.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_sequence_octet_corba_typemap_tns.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/sequence_octet.idl

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
Mon Jun  4 10:05:57 2007
@@ -78,10 +78,6 @@
     public void testSequenceStructChoice() throws Exception {
     }
 
-    public void testArrayWithChoice() throws Exception {
-        super.testArrayWithChoice();
-    }
-
         
     static abstract class CorbaTypeTestSetup extends TestSetup {
 

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopedNameVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopedNameVisitor.java?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopedNameVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopedNameVisitor.java
Mon Jun  4 10:05:57 2007
@@ -27,6 +27,8 @@
 import antlr.collections.AST;
 
 import org.apache.schemas.yoko.bindings.corba.Alias;
+import org.apache.schemas.yoko.bindings.corba.Anonsequence;
+import org.apache.schemas.yoko.bindings.corba.Sequence;
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
@@ -262,7 +264,7 @@
                     scopedName = new Scope(currentScope, node);
                 }
                 
-                result = findAlias(schemas, schema, typeMap, scopedName.toString(), holder);
+                result = findNonSchemaType(schemas, schema, typeMap, scopedName.toString(),
holder);
                 if (!result) {
                     QName qname = null;
 
@@ -301,7 +303,7 @@
                 name = scopedName.toString();
             }
             
-            result = findAlias(schemas, schema, typeMap, name, holder);
+            result = findNonSchemaType(schemas, schema, typeMap, name, holder);
             if (!result) {
                 QName qname = new QName(schema.getTargetNamespace(), name);
 
@@ -369,37 +371,48 @@
         return scopedName;
     }
 
-    protected static boolean findAlias(XmlSchemaCollection schemas,
-                                       XmlSchema schema,
-                                       TypeMappingType typeMap,
-                                       String name,
-                                       VisitorTypeHolder holder) {
+    protected static boolean findNonSchemaType(XmlSchemaCollection schemas,
+                                               XmlSchema schema,
+                                               TypeMappingType typeMap,
+                                               String name,
+                                               VisitorTypeHolder holder) {
         boolean result = false;
         QName qname = new QName(typeMap.getTargetNamespace(), name);
         CorbaTypeImpl corbaType = findCorbaType(typeMap, qname);
-        if (corbaType instanceof Alias) {
-            result = true;
-            if (holder != null) {
-                holder.setCorbaType(corbaType);
-                Alias alias = (Alias) corbaType;
-                //loop through alias base types, till you get a non-alias corba type
-                CorbaTypeImpl type = findCorbaType(typeMap, alias.getBasetype());
-                while ((type != null) && (type instanceof Alias)) {
-                    alias = (Alias) type;
-                    type = findCorbaType(typeMap, alias.getBasetype());
-                }
-                QName tname;
-                if (type == null) {
-                    //it must be a primitive type
-                    tname = xmlSchemaPrimitiveMap.get(alias.getBasetype());
-                } else {
-                    tname = type.getType();
-                }         
-                XmlSchemaType stype = schemas.getTypeByQName(tname);
-                if (stype == null) {
-                    stype = schema.getTypeByName(tname);
+        if (corbaType != null) {
+            if (corbaType instanceof Alias) {
+                result = true;
+                if (holder != null) {
+                    holder.setCorbaType(corbaType);
+                    Alias alias = (Alias) corbaType;
+                    //loop through alias base types, till you get a non-alias corba type
+                    CorbaTypeImpl type = findCorbaType(typeMap, alias.getBasetype());
+                    while ((type != null) && (type instanceof Alias)) {
+                        alias = (Alias) type;
+                        type = findCorbaType(typeMap, alias.getBasetype());
+                    }
+                    QName tname;
+                    if (type == null) {
+                        //it must be a primitive type
+                        tname = xmlSchemaPrimitiveMap.get(alias.getBasetype());
+                    } else {
+                        tname = type.getType();
+                    }         
+                    XmlSchemaType stype = schemas.getTypeByQName(tname);
+                    if (stype == null) {
+                        stype = schema.getTypeByName(tname);
+                    }
+                    holder.setSchemaType(stype);
+                }
+            } else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence))
+                       && ((corbaType.getType().equals(Constants.XSD_BASE64))
+                           || (corbaType.getType().equals(Constants.XSD_BASE64)))) {
+                //special case of sequence of octets
+                result = true;
+                if (holder != null) {
+                    holder.setCorbaType(corbaType);
+                    holder.setSchemaType(schemas.getTypeByQName(corbaType.getType()));
                 }
-                holder.setSchemaType(stype);
             }
         }
         return result;

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_base64Binary_sequence_octet.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_base64Binary_sequence_octet.wsdl?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_base64Binary_sequence_octet.wsdl
(original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_base64Binary_sequence_octet.wsdl
Mon Jun  4 10:05:57 2007
@@ -22,6 +22,8 @@
     <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="corba:octet" bound="0" repositoryID="IDL:mySequenceOctet:1.0" name="mySequenceOctet"
type="xs:base64Binary" />
     <corba:anonsequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="corba:octet" bound="0" name="_1_mySequenceSequenceOctet" type="xs:base64Binary"
/>
     <corba:sequence xmlns:ns4="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="_1_mySequenceSequenceOctet" bound="0" repositoryID="IDL:mySequenceSequenceOctet:1.0"
name="mySequenceSequenceOctet" type="ns4:mySequenceSequenceOctet" />
+    <corba:alias xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap" basetype="corba:octet"
repositoryID="IDL:aliasOctet:1.0" name="aliasOctet" />
+    <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="aliasOctet" bound="0" repositoryID="IDL:octetSeq:1.0" name="octetSeq" type="xs:base64Binary"
/>
   </corba:typeMapping>
   <wsdl:types>
     <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/sequence_octet"
xmlns="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns:xs="http://www.w3.org/2001/XMLSchema">

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_hexBinary_sequence_octet.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_hexBinary_sequence_octet.wsdl?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_hexBinary_sequence_octet.wsdl
(original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_hexBinary_sequence_octet.wsdl
Mon Jun  4 10:05:57 2007
@@ -22,6 +22,8 @@
     <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="corba:octet" bound="0" repositoryID="IDL:mySequenceOctet:1.0" name="mySequenceOctet"
type="xs:hexBinary" />
     <corba:anonsequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="corba:octet" bound="0" name="_1_mySequenceSequenceOctet" type="xs:hexBinary" />
     <corba:sequence xmlns:ns4="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="_1_mySequenceSequenceOctet" bound="0" repositoryID="IDL:mySequenceSequenceOctet:1.0"
name="mySequenceSequenceOctet" type="ns4:mySequenceSequenceOctet" />
+    <corba:alias xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap" basetype="corba:octet"
repositoryID="IDL:aliasOctet:1.0" name="aliasOctet" />
+    <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="aliasOctet" bound="0" repositoryID="IDL:octetSeq:1.0" name="octetSeq" type="xs:hexBinary"
/>
   </corba:typeMapping>
   <wsdl:types>
     <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/sequence_octet"
xmlns="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns:xs="http://www.w3.org/2001/XMLSchema">

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_sequence_octet_corba_typemap_tns.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_sequence_octet_corba_typemap_tns.wsdl?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_sequence_octet_corba_typemap_tns.wsdl
(original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_sequence_octet_corba_typemap_tns.wsdl
Mon Jun  4 10:05:57 2007
@@ -22,6 +22,8 @@
     <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://yoko.org/foobar/typemap"
elemtype="corba:octet" bound="0" repositoryID="IDL:mySequenceOctet:1.0" name="mySequenceOctet"
type="xs:base64Binary" />
     <corba:anonsequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://yoko.org/foobar/typemap"
elemtype="corba:octet" bound="0" name="_1_mySequenceSequenceOctet" type="xs:base64Binary"
/>
     <corba:sequence xmlns:ns4="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns="http://yoko.org/foobar/typemap"
elemtype="_1_mySequenceSequenceOctet" bound="0" repositoryID="IDL:mySequenceSequenceOctet:1.0"
name="mySequenceSequenceOctet" type="ns4:mySequenceSequenceOctet" />
+    <corba:alias xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap" basetype="corba:octet"
repositoryID="IDL:aliasOctet:1.0" name="aliasOctet" />
+    <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/sequence_octet/typemap"
elemtype="aliasOctet" bound="0" repositoryID="IDL:octetSeq:1.0" name="octetSeq" type="xs:base64Binary"
/>
   </corba:typeMapping>
   <wsdl:types>
     <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/sequence_octet"
xmlns="http://schemas.apache.org/yoko/idl/sequence_octet" xmlns:xs="http://www.w3.org/2001/XMLSchema">

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/sequence_octet.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/sequence_octet.idl?view=diff&rev=544186&r1=544185&r2=544186
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/sequence_octet.idl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/sequence_octet.idl Mon Jun  4 10:05:57
2007
@@ -18,4 +18,7 @@
  */ 
 
 typedef sequence< octet > mySequenceOctet;
-typedef sequence< sequence< octet > > mySequenceSequenceOctet;
+typedef sequence< sequence< octet > > mySequenceSequenceOctet;
+
+typedef octet aliasOctet;
+typedef sequence<aliasOctet> octetSeq;



Mime
View raw message