cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1043875 - in /cxf/trunk/systests/jaxws/src/test: java/org/apache/cxf/systest/jaxws/ resources/wsdl_systest_jaxws/
Date Thu, 09 Dec 2010 09:29:50 GMT
Author: ffang
Date: Thu Dec  9 09:29:49 2010
New Revision: 1043875

URL: http://svn.apache.org/viewvc?rev=1043875&view=rev
Log:
[CXF-3095]test to verify multiple xsd files work with schema-validation-enabled

Added:
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServicePortTypeImpl.java
    cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/
    cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
    cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response-in.xsd
    cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response.xsd
    cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/schemaValidation.wsdl

Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
(added)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
Thu Dec  9 09:29:49 2010
@@ -0,0 +1,104 @@
+/**
+ * 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.jaxws;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.schemavalidation.CkReponseType;
+import org.apache.cxf.jaxws.schemavalidation.CkRequeteType;
+import org.apache.cxf.jaxws.schemavalidation.RequeteIdType;
+import org.apache.cxf.jaxws.schemavalidation.Service;
+import org.apache.cxf.jaxws.schemavalidation.ServicePortType;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+
+public class SchemaValidationClientServerTest extends AbstractBusClientServerTestBase {
+    static final String PORT = allocatePort(Server.class);
+
+    private final QName portName = new QName("http://cxf.apache.org/jaxws/schemavalidation",
"servicePort");
+
+    public static class Server extends AbstractBusTestServerBase {        
+
+        protected void run()  {
+            String address;
+            Object implementor = new ServicePortTypeImpl();
+            address = "http://localhost:" + PORT + "/schemavalidation";
+            Endpoint ep = Endpoint.create(implementor);
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("schema-validation-enabled", Boolean.TRUE);
+            ep.setProperties(map);
+            ((EndpointImpl)ep).getInInterceptors().add(new LoggingInInterceptor());
+            ((EndpointImpl)ep).getOutInterceptors().add(new LoggingOutInterceptor());
+            ep.publish(address);
+        }
+
+        public static void main(String[] args) {
+            try { 
+                Server s = new Server(); 
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally { 
+                System.out.println("done!");
+            }
+        }
+    }
+   
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class));
+    }
+    
+   
+    @Test
+    public void testSchemaValidationWithMultipleXsds() throws Exception {
+        Service service = new Service();
+        assertNotNull(service);
+
+        ServicePortType greeter = service.getPort(portName, ServicePortType.class);
+        ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
+        ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
+        updateAddressPort(greeter, PORT);
+
+        RequeteIdType requestId = new RequeteIdType();
+        requestId.setId("ffang");
+        CkRequeteType request = new CkRequeteType();
+        request.setRequete(requestId);
+        ((BindingProvider)greeter).getRequestContext().put("schema-validation-enabled", Boolean.TRUE);
+        CkReponseType response = greeter.ckR(request); 
+        assertEquals(response.getProduit().get(0).getAction().getStatus(), 4);
+            
+    }
+    
+}

Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServicePortTypeImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServicePortTypeImpl.java?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServicePortTypeImpl.java
(added)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServicePortTypeImpl.java
Thu Dec  9 09:29:49 2010
@@ -0,0 +1,39 @@
+/**
+ * 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.jaxws;
+
+import org.apache.cxf.jaxws.schemavalidation.ActionCheckMajType;
+import org.apache.cxf.jaxws.schemavalidation.CkReponseType;
+import org.apache.cxf.jaxws.schemavalidation.CkRequeteType;
+import org.apache.cxf.jaxws.schemavalidation.ProduitPosteActionType;
+import org.apache.cxf.jaxws.schemavalidation.ServicePortType;
+
+@javax.xml.ws.BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")
+public class ServicePortTypeImpl implements ServicePortType {
+    @Override
+    public CkReponseType ckR(CkRequeteType ckRIn) {
+        CkReponseType result = new CkReponseType();
+        ActionCheckMajType action = new ActionCheckMajType();
+        action.setStatus(4);
+        ProduitPosteActionType pdt = new ProduitPosteActionType();
+        pdt.setAction(action);
+        result.getProduit().add(pdt);
+        return result;
+    }
+}

Added: cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd (added)
+++ cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd Thu Dec  9
09:29:49 2010
@@ -0,0 +1,36 @@
+<?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.
+        -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cxf.apache.org/jaxws/schemavalidation"
targetNamespace="http://cxf.apache.org/jaxws/schemavalidation" elementFormDefault="qualified">
+	<xsd:element name="ckRequete" type="ckRequeteType">
+	</xsd:element>
+	<xsd:complexType name="requeteIdType">
+		<xsd:attribute name="id" type="GUIDType" use="required">
+		</xsd:attribute>
+	</xsd:complexType>
+	<xsd:simpleType name="GUIDType">
+		<xsd:restriction base="xsd:string">
+		     <xsd:maxLength value="10" />
+                </xsd:restriction>
+	</xsd:simpleType>
+	
+	<xsd:complexType name="ckRequeteType">
+		<xsd:sequence>
+			<xsd:element name="requete" type="requeteIdType">
+			</xsd:element>
+		</xsd:sequence>
+	</xsd:complexType>
+</xsd:schema>

Added: cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response-in.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response-in.xsd?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response-in.xsd (added)
+++ cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response-in.xsd Thu Dec
 9 09:29:49 2010
@@ -0,0 +1,62 @@
+<?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.
+        -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cxf.apache.org/jaxws/schemavalidation"
targetNamespace="http://cxf.apache.org/jaxws/schemavalidation" elementFormDefault="qualified">
+	
+	<xsd:complexType name="ckReponseType">
+		<xsd:sequence>
+			<xsd:element name="produit" type="produitPosteActionType" minOccurs="0" maxOccurs="unbounded"/>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="produitPosteActionType">
+		<xsd:sequence>
+			<xsd:element name="action" type="actionCheckMajType"/>
+		</xsd:sequence>
+	</xsd:complexType>
+
+	<xsd:complexType name="actionCheckMajType">
+		<xsd:attribute name="status" type="statusType" use="required"/>
+	</xsd:complexType>
+	<xsd:simpleType name="statusType">
+		<xsd:restriction base="xsd:int">
+			<xsd:enumeration value="0">
+				<xsd:annotation>
+					<xsd:documentation>Aucune</xsd:documentation>
+				</xsd:annotation>
+			</xsd:enumeration>
+			<xsd:enumeration value="1">
+				<xsd:annotation>
+					<xsd:documentation>Installation</xsd:documentation>
+				</xsd:annotation>
+			</xsd:enumeration>
+			<xsd:enumeration value="2">
+				<xsd:annotation>
+					<xsd:documentation>mis a jour</xsd:documentation>
+				</xsd:annotation>
+			</xsd:enumeration>
+			<xsd:enumeration value="3">
+				<xsd:annotation>
+					<xsd:documentation>inconnu</xsd:documentation>
+				</xsd:annotation>
+			</xsd:enumeration>
+			<xsd:enumeration value="4">
+				<xsd:annotation>
+					<xsd:documentation>Erreur</xsd:documentation>
+				</xsd:annotation>
+			</xsd:enumeration>
+		</xsd:restriction>
+	</xsd:simpleType>
+</xsd:schema>

Added: cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response.xsd?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response.xsd (added)
+++ cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/response.xsd Thu Dec  9
09:29:49 2010
@@ -0,0 +1,21 @@
+<?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.
+        -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cxf.apache.org/jaxws/schemavalidation"
targetNamespace="http://cxf.apache.org/jaxws/schemavalidation" elementFormDefault="qualified">
+	<xsd:include schemaLocation="response-in.xsd"/>
+	<xsd:element name="ckReponse" type="ckReponseType">
+	</xsd:element>
+</xsd:schema>

Added: cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/schemaValidation.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/schemaValidation.wsdl?rev=1043875&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/schemaValidation.wsdl (added)
+++ cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/schemaValidation.wsdl Thu
Dec  9 09:29:49 2010
@@ -0,0 +1,61 @@
+<?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://cxf.apache.org/jaxws/schemavalidation" xmlns:tns="http://cxf.apache.org/jaxws/schemavalidation"
name="schemavalidation" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" >
+	<wsdl:documentation>shemavalidation</wsdl:documentation>
+
+	<wsdl:types>
+		<xsd:schema targetNamespace="http://cxf.apache.org/jaxws/schemavalidation">
+                        <xsd:include schemaLocation="response.xsd"/>
+                        <xsd:include schemaLocation="request.xsd"/>               
         
+		</xsd:schema>
+	</wsdl:types>
+	
+	
+	<wsdl:message name="ckRIn">
+		<wsdl:part name="ckRIn" element="tns:ckRequete"/>
+	</wsdl:message>
+	<wsdl:message name="ckROut">
+		<wsdl:part name="ckROut" element="tns:ckReponse"/>
+	</wsdl:message>
+
+	
+	<wsdl:portType name="servicePortType">
+		<wsdl:operation name="ckR">
+			<wsdl:input name="ckRIn"  message="tns:ckRIn"/>
+			<wsdl:output name="ckROut" message="tns:ckROut"/>
+		</wsdl:operation>
+	</wsdl:portType>
+	
+	<wsdl:binding name="serviceBinding" type="tns:servicePortType">
+		<wsoap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+		<wsdl:operation name="ckR">
+		   <wsoap12:operation soapAction="ckR"/>
+		   <wsdl:input>
+				<wsoap12:body parts="ckRIn" use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+				<wsoap12:body parts="ckROut" use="literal"/>
+            </wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+	
+	<wsdl:service name="service">
+		<wsdl:port name="servicePort" binding="tns:serviceBinding">
+			<wsoap12:address location="http://localhost:9001/schemavalidation"/>
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>



Mime
View raw message