cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1518175 - in /cxf/trunk: core/src/main/java/org/apache/cxf/databinding/source/ systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ systests/uncategorized/src/test/resources/wsdl_systest/
Date Wed, 28 Aug 2013 12:12:31 GMT
Author: ema
Date: Wed Aug 28 12:12:30 2013
New Revision: 1518175

URL: http://svn.apache.org/r1518175
Log:
[CXF-5237]:Schema validatation doesn't work in mtom enabled provider service

Added:
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
  (with props)
    cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
  (with props)
Modified:
    cxf/trunk/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java

Modified: cxf/trunk/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?rev=1518175&r1=1518174&r2=1518175&view=diff
==============================================================================
--- cxf/trunk/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
(original)
+++ cxf/trunk/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
Wed Aug 28 12:12:30 2013
@@ -37,6 +37,7 @@ import javax.xml.validation.Schema;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 import org.xml.sax.SAXException;
 
@@ -44,6 +45,7 @@ import org.apache.cxf.common.classloader
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.StaxInEndingInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
@@ -214,13 +216,30 @@ public class XMLStreamDataReader impleme
 
     private Element validate(XMLStreamReader input) 
         throws XMLStreamException, SAXException, IOException {
-        DOMSource ds = read(input);
-        schema.newValidator().validate(ds);
-        Node nd = ds.getNode();
-        if (nd instanceof Document) {
-            return ((Document)nd).getDocumentElement();
+        DOMSource ds = read(input);    
+        Element rootElement = null;
+        if (ds.getNode() instanceof Document) {
+            rootElement = ((Document)ds.getNode()).getDocumentElement();
+        } else {
+            rootElement = (Element)ds.getNode();
         }
-        return (Element)ds.getNode();
+        NodeList includeList = rootElement.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include",
"Include");
+        if (includeList.getLength() > 0) {
+            Element newElement = (Element)rootElement.cloneNode(true);
+            NodeList nodeList = newElement.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include",
"Include");
+            for (int i = 0; i < nodeList.getLength(); i++) {
+                Element include = (Element)nodeList.item(i);
+                Node parentNode = include.getParentNode();
+                parentNode.removeChild(include);
+                String cid = DOMUtils.getAttribute(include, "href");
+                //set the fake base64Binary to validate instead of reading the attachment
from message
+                parentNode.setTextContent(javax.xml.bind.DatatypeConverter.printBase64Binary(cid.getBytes()));
+            }
+            schema.newValidator().validate(new DOMSource(newElement));
+        } else {
+            schema.newValidator().validate(ds);
+        }
+        return rootElement;
     }
 
     private InputStream getInputStream(XMLStreamReader input) 

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ExceptionType")
+public class ExceptionType {
+
+    protected String message;
+
+    /**
+     * Gets the value of the message property.
+     * 
+     * @return possible object is {@link String }
+     */
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * Sets the value of the message property.
+     * 
+     * @param value allowed object is {@link String }
+     */
+    public void setMessage(String value) {
+        this.message = value;
+    }
+
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,53 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.ws.WebFault;
+@WebFault(name = "ExceptionType", targetNamespace = "http://cxf.apache.org/")
+public class ExceptionTypeException extends Exception {
+    public static final long serialVersionUID = 20130719154625L;
+    
+    private ExceptionType exceptionType;
+
+    public ExceptionTypeException() {
+        super();
+    }
+    
+    public ExceptionTypeException(String message) {
+        super(message);
+    }
+    
+    public ExceptionTypeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ExceptionTypeException(String message, ExceptionType exceptionType) {
+        super(message);
+        this.exceptionType = exceptionType;
+    }
+
+    public ExceptionTypeException(String message, ExceptionType exceptionType, Throwable
cause) {
+        super(message, cause);
+        this.exceptionType = exceptionType;
+    }
+
+    public ExceptionType getFaultInfo() {
+        return this.exceptionType;
+    }
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,109 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for hello complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ * 
+ * <pre>
+ * &lt;complexType name="hello">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         &lt;element name="file" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "hello", propOrder = {
+                "arg0",
+                "file"
+         })
+public class Hello {
+
+    protected String arg0;
+    @XmlElement(required = true)
+    @XmlMimeType("application/octet-stream")
+    protected DataHandler file;
+
+    /**
+     * Gets the value of the arg0 property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getArg0() {
+        return arg0;
+    }
+
+    /**
+     * Sets the value of the arg0 property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setArg0(String value) {
+        this.arg0 = value;
+    }
+
+    /**
+     * Gets the value of the file property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link DataHandler }
+     *     
+     */
+    public DataHandler getFile() {
+        return file;
+    }
+
+    /**
+     * Sets the value of the file property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link DataHandler }
+     *     
+     */
+    public void setFile(DataHandler value) {
+        this.file = value;
+    }
+
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,77 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for helloResponse complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ * 
+ * <pre>
+ * &lt;complexType name="helloResponse">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}string"
minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "helloResponse")
+public class HelloResponse {
+
+    @XmlElement(name = "return")
+    protected String res;
+
+    /**
+     * Gets the value of the return property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getReturn() {
+        return res;
+    }
+
+    /**
+     * Sets the value of the return property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setReturn(String value) {
+        this.res = value;
+    }
+
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://cxf.apache.org/", name = "HelloWS")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface HelloWS {
+
+    @WebResult(name = "helloResponse", targetNamespace = "http://cxf.apache.org/", partName
= "parameters")
+    @WebMethod
+    HelloResponse hello(@WebParam(partName = "parameters", 
+                                         name = "helloRequest", 
+                                         targetNamespace = "http://cxf.apache.org/") Hello
parameters)
+        throws ExceptionTypeException;
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+@WebServiceClient(name = "HelloWS", targetNamespace = "http://cxf.apache.org/")
+public class HelloWSClient extends Service {
+    private QName portName = new QName("http://cxf.apache.org/", "hello");
+
+    public HelloWSClient(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    /**
+     * @return returns HelloWS
+     */
+    @WebEndpoint(name = "hello")
+    public HelloWS getHello() {
+        return super.getPort(portName, HelloWS.class);
+    }
+
+    /**
+     * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the
proxy. Supported
+     *            features not in the <code>features</code> parameter will have
their default values.
+     * @return returns HelloWS
+     */
+    @WebEndpoint(name = "hello")
+    public HelloWS getHello(WebServiceFeature... features) {
+        return super.getPort(portName, HelloWS.class, features);
+    }
+
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.MTOMFeature;
+
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public final class MTOMProviderSchemaValidationTest extends AbstractBusClientServerTestBase
{
+    public static final String PORT = Server.PORT;
+
+    private final QName serviceName = new QName("http://cxf.apache.org/", "HelloWS");
+
+    @BeforeClass
+    public static void startservers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+    }
+    @Test
+    public void testSchemaValidation() throws Exception {
+        HelloWS port = createService();
+        Hello request = new Hello();
+        request.setArg0("value");
+        URL wsdl = getClass().getResource("/wsdl_systest/mtom_provider_validate.wsdl");
+        File attachment = new File(wsdl.getFile());
+        request.setFile(new DataHandler(new FileDataSource(attachment)));
+        HelloResponse response = port.hello(request);
+        assertEquals("Hello CXF", response.getReturn());
+    }
+
+    private HelloWS createService() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl_systest/mtom_provider_validate.wsdl");
+        assertNotNull(wsdl);
+
+        HelloWSClient service = new HelloWSClient(wsdl, serviceName);
+        assertNotNull(service);
+
+        HelloWS port = service.getHello(new MTOMFeature());
+
+        updateAddressPort(port, PORT);
+
+        return port;
+    }
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+
+public class Server extends AbstractBusTestServerBase {
+    public static final String PORT = allocatePort(Server.class);
+    protected void run() { 
+        
+        TestProvider implementor = new TestProvider();
+        Endpoint ep = Endpoint.create(implementor);
+        ((EndpointImpl)ep).setWsdlLocation("wsdl_systest/mtom_provider_validate.wsdl");
+        ep.publish("http://localhost:" + PORT + "/mtom/provider");
+    }
+    
+    public static void main(String[] args) throws Exception { 
+        try {
+            Server s = new Server();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
(added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.io.StringReader;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
+
+@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http")
+@ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD)
+@WebServiceProvider(targetNamespace = "http://cxf.apache.org/", serviceName = "HelloWS",
portName = "hello")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@EndpointProperties(value = {
+                             @EndpointProperty(key = "schema-validation-enabled", value =
"true"),
+                             @EndpointProperty(key = "mtom-enabled", value = "true")
+                    })
+public class TestProvider implements Provider<SAXSource> {
+
+    private String successRsp = "<ns2:helloResponse xmlns:ns2=\"http://cxf.apache.org/\">"
+                                + "<return>Hello CXF</return>" + "</ns2:helloResponse>";
+
+    public SAXSource invoke(SAXSource request) {
+        return new SAXSource(new InputSource(new StringReader(successRsp)));
+    }
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl?rev=1518175&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
(added)
+++ cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
Wed Aug 28 12:12:30 2013
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://cxf.apache.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="HelloWS" targetNamespace="http://cxf.apache.org/">
+  <wsdl:types>
+    <xs:schema xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.apache.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="http://cxf.apache.org/">
+      <xs:element name="helloRequest" type="tns:hello"/>
+      <xs:element name="helloResponse" type="tns:helloResponse"/>
+      <xs:complexType name="hello">
+        <xs:sequence>
+          <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+          <xs:element name="file" type="xsd:base64Binary"
+					xmime:expectedContentTypes="application/octet-stream" />
+        </xs:sequence>
+      </xs:complexType>
+      <xs:complexType name="helloResponse">
+        <xs:sequence>
+          <xs:element minOccurs="0" name="return" type="xs:string"/>
+        </xs:sequence>
+      </xs:complexType>
+      <xs:element name="ExceptionType" type="tns:ExceptionType"/>
+      <xs:complexType name="ExceptionType">
+        <xs:sequence>
+          <xs:element minOccurs="0" name="message" type="xs:string"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="helloResponse">
+    <wsdl:part element="tns:helloResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="hello">
+    <wsdl:part element="tns:helloRequest" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="ExceptionType">
+    <wsdl:part element="tns:ExceptionType" name="ExceptionType">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="HelloWSImpl">
+    <wsdl:operation name="hello">
+      <wsdl:input message="tns:hello" name="hello">
+      </wsdl:input>
+      <wsdl:output message="tns:helloResponse" name="helloResponse">
+      </wsdl:output>
+      <wsdl:fault message="tns:ExceptionType" name="ExceptionType">
+    </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="HelloWSSoapBinding" type="tns:HelloWSImpl">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="hello">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="hello">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="helloResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="ExceptionType">
+        <soap:fault name="ExceptionType" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="HelloWS">
+    <wsdl:port binding="tns:HelloWSSoapBinding" name="hello">
+      <soap:address location="http://localhost:9003/mtom/provider"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Propchange: cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message