You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by en...@apache.org on 2007/05/21 14:29:58 UTC
svn commit: r540153 - in /incubator/yoko/trunk/tools/src:
main/java/org/apache/yoko/tools/processors/idl/
test/java/org/apache/yoko/tools/processors/ test/resources/idl/
Author: enolan
Date: Mon May 21 07:29:57 2007
New Revision: 540153
URL: http://svn.apache.org/viewvc?view=rev&rev=540153
Log:
Yoko-369 - idltowsdl tool generates the incorrect schematype for a typedef sequence <otctet>.
Added:
incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl
incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl (with props)
Modified:
incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java
Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java?view=diff&rev=540153&r1=540152&r2=540153
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java Mon May 21 07:29:57 2007
@@ -23,6 +23,7 @@
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;
@@ -86,17 +87,31 @@
scopedName = new Scope(getScope(), identifierNode);
}
- XmlSchemaType schemaType = null;
+ XmlSchemaType schemaType = null;
+ QName basetype = null;
+ if (ctype instanceof Alias) {
+ Alias alias = (Alias) ctype;
+ basetype = alias.getBasetype();
+ }
+ // Needs to check if its a typedef of basetype octet.
if (simpleTypeSpecNode.getType() != IDLTokenTypes.LITERAL_octet) {
- schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
- } else {
- // According to CORBA Binding for WSDL specification,
- // idl:sequence<octet> maps to xs:base64Binary by default.
- //
- // wsdlVisitor.getSequenceOctetType() returns the XmlSchema type
- // that idl:sequence<octet> should map to, as specified by the
- // -s command line option or the default type xsd:base64Binary.
- //
+ if (basetype != null) {
+ if (!(basetype.getLocalPart().equals("octet"))) {
+ schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
+ }
+ } else {
+ schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
+ }
+ }
+ // According to CORBA Binding for WSDL specification,
+ // idl:sequence<octet> maps to xs:base64Binary by default.
+ //
+ // wsdlVisitor.getSequenceOctetType() returns the XmlSchema type
+ // that idl:sequence<octet> should map to, as specified by the
+ // -s command line option or the default type xsd:base64Binary.
+ //
+ if ((simpleTypeSpecNode.getType() == IDLTokenTypes.LITERAL_octet)
+ || (basetype != null && basetype.getLocalPart().equals("octet"))) {
schemaType = wsdlVisitor.getSequenceOctetType();
}
Modified: incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java?view=diff&rev=540153&r1=540152&r2=540153
==============================================================================
--- incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java (original)
+++ incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java Mon May 21 07:29:57 2007
@@ -252,6 +252,11 @@
testWSDLGeneration("/idl/ConstScopename.idl", "/idl/expected_ConstScopename.wsdl");
}
+ public void testTypedfOctet() throws Exception {
+ // This tests typedef sequence of octets.
+ testWSDLGeneration("/idl/Octet.idl", "/idl/expected_Octet.wsdl");
+ }
+
public void testLogicalPhysicalSchemaGeneration(String idlFilename,
String logicalName,
String physicalName,
Added: incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl?view=auto&rev=540153
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl (added)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl Mon May 21 07:29:57 2007
@@ -0,0 +1,21 @@
+/*
+ * 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.
+*/
+
+typedef octet TpOctet;
+typedef sequence <TpOctet> TpOctetSet;
Added: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl?view=auto&rev=540153
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl (added)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl Mon May 21 07:29:57 2007
@@ -0,0 +1,29 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://schemas.apache.org/yoko/idl/Octet" xmlns:tns="http://schemas.apache.org/yoko/idl/Octet" xmlns:corba="http://schemas.apache.org/yoko/bindings/corba" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <corba:typeMapping targetNamespace="http://schemas.apache.org/yoko/idl/Octet/typemap">
+ <corba:alias xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" basetype="corba:octet" repositoryID="IDL:TpOctet:1.0" name="TpOctet" />
+ <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" elemtype="TpOctet" bound="0" repositoryID="IDL:TpOctetSet:1.0" name="TpOctetSet" type="xs:base64Binary" />
+ </corba:typeMapping>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/Octet" xmlns="http://schemas.apache.org/yoko/idl/Octet" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ </xs:schema>
+ </wsdl:types>
+</wsdl:definitions>
\ No newline at end of file
Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml