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 098121023C for ; Thu, 27 Nov 2014 16:15:42 +0000 (UTC) Received: (qmail 15367 invoked by uid 500); 27 Nov 2014 16:15:42 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 15308 invoked by uid 500); 27 Nov 2014 16:15:41 -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 15299 invoked by uid 99); 27 Nov 2014 16:15:41 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Nov 2014 16:15:41 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A4154949C2B; Thu, 27 Nov 2014 16:15:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ay@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: add WSI-BP R2209 check in WSIBPValidator Date: Thu, 27 Nov 2014 16:15:41 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master ab4eaac0b -> 74ba19524 add WSI-BP R2209 check in WSIBPValidator Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/74ba1952 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/74ba1952 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/74ba1952 Branch: refs/heads/master Commit: 74ba1952473b6d31aa8b0b75b92faaac9789f527 Parents: ab4eaac Author: Akitoshi Yoshida Authored: Thu Nov 27 17:05:23 2014 +0100 Committer: Akitoshi Yoshida Committed: Thu Nov 27 17:14:43 2014 +0100 ---------------------------------------------------------------------- .../validator/internal/WSIBPValidator.java | 12 +++++ .../cxf/tools/validator/WSDLValidationTest.java | 8 ++++ .../hello_world_unbound_porttype_elements.wsdl | 47 ++++++++++++++++++++ 3 files changed, 67 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/74ba1952/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java ---------------------------------------------------------------------- diff --git a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java index cb4a413..fc70e91 100644 --- a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java +++ b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java @@ -235,6 +235,17 @@ public class WSIBPValidator extends AbstractDefinitionValidator { return true; } + private boolean checkR2209(final Operation operation, + final BindingOperation bop) { + if ((bop.getBindingInput() == null && operation.getInput() != null) + || (bop.getBindingOutput() == null && operation.getOutput() != null)) { + addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2209") + + "Unbound PortType elements in Operation '" + operation.getName() + "'"); + return false; + } + return true; + } + public boolean checkBinding() { for (PortType portType : wsdlHelper.getPortTypes(def)) { Iterator ite = portType.getOperations().iterator(); @@ -258,6 +269,7 @@ public class WSIBPValidator extends AbstractDefinitionValidator { if ("DOCUMENT".equalsIgnoreCase(style) || StringUtils.isEmpty(style)) { boolean passed = checkR2201Input(operation, bop) && checkR2201Output(operation, bop) + && checkR2209(operation, bop) && checkR2716(bop); if (!passed) { return false; http://git-wip-us.apache.org/repos/asf/cxf/blob/74ba1952/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java ---------------------------------------------------------------------- diff --git a/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java b/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java index f8361c6..9093221 100644 --- a/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java +++ b/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java @@ -175,6 +175,14 @@ public class WSDLValidationTest extends ToolTestBase { } @Test + public void testWSIBPR2209() throws Exception { + String[] args = new String[] {"-verbose", + getLocation("/validator_wsdl/hello_world_unbound_porttype_elements.wsdl")}; + WSDLValidator.main(args); + assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2209") > -1); + } + + @Test public void testBPR2717() throws Exception { try { String[] args = new String[] {"-verbose", http://git-wip-us.apache.org/repos/asf/cxf/blob/74ba1952/tools/validator/src/test/resources/validator_wsdl/hello_world_unbound_porttype_elements.wsdl ---------------------------------------------------------------------- diff --git a/tools/validator/src/test/resources/validator_wsdl/hello_world_unbound_porttype_elements.wsdl b/tools/validator/src/test/resources/validator_wsdl/hello_world_unbound_porttype_elements.wsdl new file mode 100644 index 0000000..b99c74d --- /dev/null +++ b/tools/validator/src/test/resources/validator_wsdl/hello_world_unbound_porttype_elements.wsdl @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +