Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6E49218B61 for ; Fri, 18 Mar 2016 16:14:35 +0000 (UTC) Received: (qmail 67500 invoked by uid 500); 18 Mar 2016 16:14:35 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 67417 invoked by uid 500); 18 Mar 2016 16:14:35 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 67299 invoked by uid 99); 18 Mar 2016 16:14:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 16:14:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 23C1DDF97F; Fri, 18 Mar 2016 16:14:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkulp@apache.org To: commits@cxf.apache.org Date: Fri, 18 Mar 2016 16:14:36 -0000 Message-Id: In-Reply-To: <3504515c022a4b15b6c7e8d405da3894@git.apache.org> References: <3504515c022a4b15b6c7e8d405da3894@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] cxf git commit: [CXF-5193] Fix anonymous fixed IDL type handling This closes #123 [CXF-5193] Fix anonymous fixed IDL type handling This closes #123 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2c00184f Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2c00184f Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2c00184f Branch: refs/heads/3.0.x-fixes Commit: 2c00184f7f3e32cb0c1f0ef90a3c411d369aa5a2 Parents: 3203bc6 Author: Grzegorz Grzybek Authored: Thu Mar 17 13:41:25 2016 +0100 Committer: Daniel Kulp Committed: Fri Mar 18 12:14:28 2016 -0400 ---------------------------------------------------------------------- .../corba/processors/idl/FixedVisitor.java | 42 ++++++--- .../processors/IDLToWSDLGenerationTest.java | 5 + .../src/test/resources/idl/FixedStruct.idl | 32 +++++++ .../resources/idl/expected_FixedStruct.wsdl | 98 ++++++++++++++++++++ 4 files changed, 166 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2c00184f/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java ---------------------------------------------------------------------- diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java index 46897b4..75eb81e 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java @@ -24,6 +24,8 @@ import javax.xml.namespace.QName; import antlr.collections.AST; +import org.apache.cxf.binding.corba.wsdl.Anonfixed; +import org.apache.cxf.binding.corba.wsdl.CorbaType; import org.apache.cxf.binding.corba.wsdl.Fixed; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaFractionDigitsFacet; @@ -79,7 +81,12 @@ public class FixedVisitor extends VisitorBase { AST digitsNode = fixedNode.getFirstChild(); AST scaleNode = digitsNode.getNextSibling(); - Scope scopedName = new Scope(getScope(), identifierNode); + Scope scopedName = null; + if (identifierNode == null) { + scopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema); + } else { + scopedName = new Scope(getScope(), identifierNode); + } // validate digits and scale Long digits = new Long(digitsNode.toString()); @@ -112,17 +119,30 @@ public class FixedVisitor extends VisitorBase { // add xmlschema:fixed setSchemaType(fixedSimpleType); - - // corba:fixed - Fixed corbaFixed = new Fixed(); - corbaFixed.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString())); - corbaFixed.setDigits(digits); - corbaFixed.setScale(scale); - corbaFixed.setRepositoryID(scopedName.toIDLRepositoryID()); - //corbaFixed.setType(Constants.XSD_DECIMAL); - corbaFixed.setType(fixedSimpleType.getQName()); + CorbaType type = null; + if (identifierNode != null) { + // corba:fixed + Fixed corbaFixed = new Fixed(); + corbaFixed.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString())); + corbaFixed.setDigits(digits); + corbaFixed.setScale(scale); + corbaFixed.setRepositoryID(scopedName.toIDLRepositoryID()); + //corbaFixed.setType(Constants.XSD_DECIMAL); + corbaFixed.setType(fixedSimpleType.getQName()); + type = corbaFixed; + } else { + // corba:anonfixed + Anonfixed corbaFixed = new Anonfixed(); + corbaFixed.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString())); + corbaFixed.setDigits(digits); + corbaFixed.setScale(scale); + //corbaFixed.setType(Constants.XSD_DECIMAL); + corbaFixed.setType(fixedSimpleType.getQName()); + typeMap.getStructOrExceptionOrUnion().add(corbaFixed); + type = corbaFixed; + } // add corba:fixed - setCorbaType(corbaFixed); + setCorbaType(type); } } http://git-wip-us.apache.org/repos/asf/cxf/blob/2c00184f/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java ---------------------------------------------------------------------- diff --git a/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java b/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java index e3de3e1..7d47d71 100644 --- a/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java +++ b/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java @@ -165,6 +165,11 @@ public class IDLToWSDLGenerationTest extends ProcessorTestBase { } @Test + public void testFixedStructGeneration() throws Exception { + testWSDLGeneration("/idl/FixedStruct.idl", "/idl/expected_FixedStruct.wsdl"); + } + + @Test public void testTypedefGeneration() throws Exception { testWSDLGeneration("/idl/Typedef.idl", "/idl/expected_Typedef.wsdl"); } http://git-wip-us.apache.org/repos/asf/cxf/blob/2c00184f/tools/corba/src/test/resources/idl/FixedStruct.idl ---------------------------------------------------------------------- diff --git a/tools/corba/src/test/resources/idl/FixedStruct.idl b/tools/corba/src/test/resources/idl/FixedStruct.idl new file mode 100644 index 0000000..bdcf8e4 --- /dev/null +++ b/tools/corba/src/test/resources/idl/FixedStruct.idl @@ -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. +*/ + +module fixeds +{ + struct FixedStruct + { + string<5> oddString; + fixed<5,2> oddFixed; + }; + + interface FunctionTest + { + FixedStruct testFixeds(in FixedStruct aFixedStruct); + }; +}; http://git-wip-us.apache.org/repos/asf/cxf/blob/2c00184f/tools/corba/src/test/resources/idl/expected_FixedStruct.wsdl ---------------------------------------------------------------------- diff --git a/tools/corba/src/test/resources/idl/expected_FixedStruct.wsdl b/tools/corba/src/test/resources/idl/expected_FixedStruct.wsdl new file mode 100644 index 0000000..7036f11 --- /dev/null +++ b/tools/corba/src/test/resources/idl/expected_FixedStruct.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +