cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1127029 - in /cxf/trunk/systests/jaxrs: ./ src/test/java/org/apache/cxf/systest/jaxrs/ src/test/resources/jaxrs/WEB-INF/ src/test/resources/wadl/ src/test/resources/wadl/schemas/
Date Tue, 24 May 2011 13:23:31 GMT
Author: sergeyb
Date: Tue May 24 13:23:30 2011
New Revision: 1127029

URL: http://svn.apache.org/viewvc?rev=1127029&view=rev
Log:
[CXF-3538] Adding a maven plugin-driven test

Added:
    cxf/trunk/systests/jaxrs/src/test/resources/wadl/
    cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml   (with props)
    cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/
    cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd   (with props)
    cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd   (with props)
Modified:
    cxf/trunk/systests/jaxrs/pom.xml
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml

Modified: cxf/trunk/systests/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/pom.xml?rev=1127029&r1=1127028&r2=1127029&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/pom.xml (original)
+++ cxf/trunk/systests/jaxrs/pom.xml Tue May 24 13:23:30 2011
@@ -30,39 +30,11 @@
     <name>Apache CXF JAX-RS System Tests</name>
     <version>2.4.1-SNAPSHOT</version>
     <url>http://cxf.apache.org</url>
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-jar-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <goals>
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-    <profiles>
-        <profile>
-            <id>ibmjdk</id>
-            <activation>
-                <property>
-                    <name>java.vendor</name>
-                    <value>IBM Corporation</value>
-                </property>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>org.apache.geronimo.specs</groupId>
-                    <artifactId>geronimo-ejb_3.0_spec</artifactId>
-                    <scope>provided</scope>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
+    
+    <properties>
+        <cxf.surefire.fork.mode>pertest</cxf.surefire.fork.mode>
+    </properties>
+    
     <dependencies>
         <dependency>
             <groupId>xalan</groupId>
@@ -342,7 +314,70 @@
           <version>1.2.0</version>
         </dependency>
     </dependencies>
-    <properties>
-        <cxf.surefire.fork.mode>pertest</cxf.surefire.fork.mode>
-    </properties>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-wadl2java-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+                            <wadlOptions>
+                                <wadlOption>
+                                    <wadl>${basedir}/src/test/resources/wadl/bookstoreImport.xml</wadl>
+                                    <impl>true</impl>
+                                    
+                                    <packagename>org.apache.cxf.systest.jaxrs.codegen.service</packagename>
+                                    <schemaPackagenames>
+                                       <schemaPackagename>http://superbooks=org.apache.cxf.systest.jaxrs.codegen.schema</schemaPackagename>
+                                    </schemaPackagenames>
+                                    
+                                </wadlOption>
+                            </wadlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wadl2java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <profiles>
+        <profile>
+            <id>ibmjdk</id>
+            <activation>
+                <property>
+                    <name>java.vendor</name>
+                    <value>IBM Corporation</value>
+                </property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-ejb_3.0_spec</artifactId>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+    
+    
 </project>

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1127029&r1=1127028&r2=1127029&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Tue May 24 13:23:30 2011
@@ -44,6 +44,7 @@ import org.apache.cxf.jaxrs.client.JAXRS
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
 import org.apache.cxf.jaxrs.provider.AegisElementProvider;
+import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.BeforeClass;
@@ -56,7 +57,7 @@ public class JAXRSClientServerSpringBook
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", 
-                   launchServer(BookServerSpring.class));
+                   launchServer(BookServerSpring.class, true));
     }
     
     @Test
@@ -70,6 +71,22 @@ public class JAXRSClientServerSpringBook
     }
     
     @Test
+    public void testPostGeneratedBook() throws Exception {
+        String baseAddress = "http://localhost:" + PORT + "/the/generated/bookstore/books/1";
+        JAXBElementProvider provider = new JAXBElementProvider();
+        provider.setMarshallAsJaxbElement(true);
+        WebClient wc = WebClient.create(baseAddress,
+                                        Collections.singletonList(provider));
+        wc.type("application/xml");
+        
+        org.apache.cxf.systest.jaxrs.codegen.schema.Book book = 
+            new org.apache.cxf.systest.jaxrs.codegen.schema.Book();
+        book.setId(123);
+        Response r = wc.post(book);
+        assertEquals(204, r.getStatus());
+    }
+    
+    @Test
     public void testGetBookByUriInfo() throws Exception {
         String endpointAddress =
             "http://localhost:" + PORT + "/the/thebooks/bookstore/bookinfo?"

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?rev=1127029&r1=1127028&r2=1127029&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml Tue May 24 13:23:30
2011
@@ -182,6 +182,19 @@ http://cxf.apache.org/schemas/core.xsd">
     </jaxrs:serviceBeans>
   </jaxrs:server>
 
+  <jaxrs:server id="bookserviceGenerated" address="/generated">
+    <jaxrs:serviceBeans>
+      <bean class="org.apache.cxf.systest.jaxrs.codegen.service.BookStore"/>
+    </jaxrs:serviceBeans>
+    <jaxrs:providers>
+       <ref bean="jaxbProviderForTypes"/>
+    </jaxrs:providers>
+  </jaxrs:server>
+
+  <bean id="jaxbProviderForTypes" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+      <property name="unmarshallAsJaxbElement" value="true"/>
+  </bean>
+
   <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
       <property name="schemaHandler" ref="schemaHolder"/>
   </bean>

Added: cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml?rev=1127029&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml Tue May 24 13:23:30
2011
@@ -0,0 +1,40 @@
+<?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.
+-->
+<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:prefix1="http://superbooks">
+
+ <grammars>
+    <include href="schemas/book.xsd"/>
+ </grammars>
+ <resources base="http://localhost:8080/baz">
+   <resource path="/bookstore" id="{wadl.model.jaxrs.cxf.apache.org}BookStore">
+    
+    <resource path="/books/{bookid}">
+     <param name="bookid" style="template" type="xs:int"/>
+     
+     <method name="POST" id="addBook">
+      <request>
+       <representation mediaType="application/xml" element="prefix1:thebook"/>
+      </request>
+     </method>
+    </resource>
+   </resource>
+</resources>
+
+</application>

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/bookstoreImport.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd?rev=1127029&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd Tue May 24 13:23:30
2011
@@ -0,0 +1,37 @@
+<?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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:tns="http://superbooks" attributeFormDefault="unqualified" elementFormDefault="unqualified"

+  targetNamespace="http://superbooks">
+    <xs:include schemaLocation="chapter.xsd"/>
+    <xs:element name="thebook" type="tns:book"/>
+    <xs:complexType name="book">
+        <xs:sequence>
+            <xs:element minOccurs="0" ref="tns:thechapter"/>
+            <xs:element name="id" type="xs:int"/>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="book2">
+        <xs:sequence>
+            <xs:element name="id" type="xs:int"/>
+            <xs:element minOccurs="0" name="name" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+ </xs:schema>
\ No newline at end of file

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/book.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd?rev=1127029&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd Tue May 24 13:23:30
2011
@@ -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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:tns="http://superbooks" attributeFormDefault="unqualified" elementFormDefault="unqualified"

+  targetNamespace="http://superbooks">
+    <xs:element name="thechapter" type="tns:chapter"/>
+    <xs:complexType name="chapter">
+        <xs:sequence>
+            <xs:element name="id" type="xs:int"/>
+        </xs:sequence>
+    </xs:complexType>
+ </xs:schema>
\ No newline at end of file

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/jaxrs/src/test/resources/wadl/schemas/chapter.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message