You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by jr...@apache.org on 2009/12/17 19:49:27 UTC

svn commit: r891833 - in /incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers: ./ src/main/java/org/apache/wink/jaxrs/test/ src/main/java/org/apache/wink/jaxrs/test/jaxb/ src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ src/main/j...

Author: jramos
Date: Thu Dec 17 18:49:26 2009
New Revision: 891833

URL: http://svn.apache.org/viewvc?rev=891833&view=rev
Log:
[#Wink-239] Add wink jaxbcollection provider integration tests to wink-itest-extra-providers module

Added:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Author.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Book.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ObjectFactory.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/Person.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionHTTPClientTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionTest.java
Modified:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/pom.xml
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/Application.java

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/pom.xml?rev=891833&r1=891832&r2=891833&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/pom.xml (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/pom.xml Thu Dec 17 18:49:26 2009
@@ -1,30 +1,44 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
-<!--
-    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.
--->
-  <parent>
-    <artifactId>wink-itest</artifactId>
+<?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.
+    -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>wink-itest</artifactId>
+        <groupId>org.apache.wink</groupId>
+        <version>1.1-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.wink</groupId>
-    <version>1.1-incubating-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.wink</groupId>
-  <artifactId>wink-itest-extra-providers</artifactId>
-  <packaging>war</packaging>
-  <name>Apache Wink Integration Extra Providers Tests</name>
+    <artifactId>wink-itest-extra-providers</artifactId>
+    <packaging>war</packaging>
+    <name>Apache Wink Integration Extra Providers Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.wink</groupId>
+            <artifactId>wink-jaxbcollection-provider</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>wstx-asl</artifactId>
+            <version>3.2.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/Application.java?rev=891833&r1=891832&r2=891833&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/Application.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/Application.java Thu Dec 17 18:49:26 2009
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 import org.apache.wink.jaxrs.test.atom.BlogService;
+import org.apache.wink.jaxrs.test.jaxb.JAXBResource;
 
 public class Application extends javax.ws.rs.core.Application {
 
@@ -30,6 +31,7 @@
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(BlogService.class);
+        classes.add(JAXBResource.class);
         return classes;
     }
 

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.wink.jaxrs.test.jaxb.book.Author;
+import org.apache.wink.jaxrs.test.jaxb.book.Book;
+import org.apache.wink.jaxrs.test.jaxb.person.Person;
+
+@Path("jaxbresource")
+public class JAXBResource {
+
+    @Path("booklist")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public List<Book> echoBookList(List<Book> books) {
+        List<Book> ret = new ArrayList<Book>();
+        Author author = null;
+        Author retAuthor = null;
+        Book retBook = null;
+        for(Book book : books) {
+            author = book.getAuthor();
+            retAuthor = new Author();
+            retAuthor.setFirstName("echo " + author.getFirstName());
+            retAuthor.setLastName("echo " + author.getLastName());
+            retBook = new Book();
+            retBook.setAuthor(retAuthor);
+            retBook.setTitle("echo " + book.getTitle());
+            ret.add(retBook);
+        }
+        return ret;
+    }
+    
+    @Path("bookarray")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public Book[] echoBookArray(Book[] books) {
+        Book[] ret = new Book[books.length];
+        Author author = null;
+        Author retAuthor = null;
+        Book retBook = null;
+        int i = 0;
+        for(Book book : books) {
+            author = book.getAuthor();
+            retAuthor = new Author();
+            retAuthor.setFirstName("echo " + author.getFirstName());
+            retAuthor.setLastName("echo " + author.getLastName());
+            retBook = new Book();
+            retBook.setAuthor(retAuthor);
+            retBook.setTitle("echo " + book.getTitle());
+            ret[i++] = retBook;
+        }
+        return ret;
+    }
+    
+    @Path("booklistresponse")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public Response echoBookListResponse(List<Book> books) {
+        List<Book> ret = echoBookList(books);
+        Response response = Response.ok(new GenericEntity<List<Book>>(ret){}, MediaType.APPLICATION_XML).build();
+        return response;
+    }
+    
+    @Path("booklistjaxbelement")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public List<JAXBElement<Book>> echoJAXBElementBookList(List<JAXBElement<Book>> bookElements) {
+        List<JAXBElement<Book>> ret = new ArrayList<JAXBElement<Book>>();
+        Author author = null;
+        Author retAuthor = null;
+        Book retBook = null;
+        for(JAXBElement<Book> bookElement : bookElements) {
+            author = bookElement.getValue().getAuthor();
+            retAuthor = new Author();
+            retAuthor.setFirstName("echo " + author.getFirstName());
+            retAuthor.setLastName("echo " + author.getLastName());
+            retBook = new Book();
+            retBook.setAuthor(retAuthor);
+            retBook.setTitle("echo " + bookElement.getValue().getTitle());
+            JAXBElement<Book> element = new JAXBElement<Book>(new QName("book"), Book.class, retBook);
+            ret.add(element);
+        }
+        return ret;
+    }
+    
+    @Path("personlist")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public List<Person> echoPersonList(List<Person> people) {
+        List<Person> ret = new ArrayList<Person>();
+        Person retPerson = null;
+        for(Person person : people) {
+            retPerson = new Person();
+            retPerson.setName("echo " + person.getName());
+            retPerson.setDesc("echo " + person.getDesc());
+            ret.add(retPerson);
+        }
+        return ret;
+    }
+    
+    @Path("personlistresponse")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public Response echoPersonListResponse(List<Person> people) {
+        List<Person> ret = echoPersonList(people);
+        Response response = Response.ok(new GenericEntity<List<Person>>(ret){}, MediaType.APPLICATION_XML).build();
+        return response;
+    }
+    
+    @Path("personarray")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public Person[] echoPersonArray(Person[] people) {
+        Person[] ret = new Person[people.length];
+        Person retPerson = null;
+        int i = 0;
+        for(Person person : people) {
+            retPerson = new Person();
+            retPerson.setName("echo " + person.getName());
+            retPerson.setDesc("echo " + person.getDesc());
+            ret[i++] = retPerson;
+        }
+        return ret;
+    }
+    
+    @Path("personlistjaxbelement")
+    @Produces(MediaType.APPLICATION_XML)
+    @Consumes(MediaType.APPLICATION_XML)
+    @POST
+    public List<JAXBElement<Person>> echoPersonJAXBElementList(List<JAXBElement<Person>> peopleElements) {
+        List<JAXBElement<Person>> ret = new ArrayList<JAXBElement<Person>>();
+        Person retPerson = null;
+        for(JAXBElement<Person> personElement : peopleElements) {
+            retPerson = new Person();
+            retPerson.setName("echo " + personElement.getValue().getName());
+            retPerson.setDesc("echo " + personElement.getValue().getDesc());
+            JAXBElement<Person> element = new JAXBElement<Person>(new QName("person"), Person.class, retPerson);
+            ret.add(element);
+        }
+        return ret;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Author.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Author.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Author.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Author.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb.book;
+
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType
+public class Author {
+
+    private String firstName;
+    private String lastName;
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public boolean equals(Object other) {
+        if (!(other instanceof Author))
+            return false;
+
+        Author o = (Author)other;
+        return (((this.firstName == null && o.firstName == null) || (this.firstName != null && this.firstName
+            .equals(o.firstName))) && ((this.lastName == null && o.lastName == null) || (this.lastName != null && this.lastName
+            .equals(o.lastName))));
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Book.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Book.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Book.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/Book.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb.book;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Book {
+
+    private Author author;
+    private String title;
+
+    public Author getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(Author author) {
+        this.author = author;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public boolean equals(Object other) {
+        if (!(other instanceof Book))
+            return false;
+
+        Book o = (Book)other;
+        return (((this.author == null && o.author == null) || (this.author != null && this.author
+            .equals(o.getAuthor()))) && ((this.title == null && o.title == null) || (this.title != null && this.title
+            .equals(o.title))));
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ObjectFactory.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/book/ObjectFactory.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb.book;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public Book createBook() {
+        return new Book();
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/Person.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/Person.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/Person.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/person/Person.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb.person;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Person {
+
+    private String name;
+
+    private String desc;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public boolean equals(Object other) {
+        if (!(other instanceof Person))
+            return false;
+
+        Person o = (Person)other;
+        return (((this.name == null && o.name == null) || (this.name != null && this.name
+            .equals(o.name))) && ((this.desc == null && o.desc == null) || (this.desc != null && this.desc
+            .equals(o.desc))));
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionHTTPClientTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionHTTPClientTest.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionHTTPClientTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionHTTPClientTest.java Thu Dec 17 18:49:26 2009
@@ -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.
+ *  
+ *******************************************************************************/
+
+package org.apache.wink.jaxrs.test;
+
+import org.apache.wink.client.ApacheHttpClientConfig;
+import org.apache.wink.client.RestClient;
+
+public class JAXBCollectionHTTPClientTest extends JAXBCollectionTest {
+
+    public void setUp() throws Exception {
+        ApacheHttpClientConfig config = new ApacheHttpClientConfig();
+        client = new RestClient(config);
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionTest.java?rev=891833&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionTest.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/test/java/org/apache/wink/jaxrs/test/JAXBCollectionTest.java Thu Dec 17 18:49:26 2009
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * 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.wink.jaxrs.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+
+import junit.framework.TestCase;
+
+import org.apache.wink.client.ClientConfig;
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.EntityType;
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.jaxrs.test.jaxb.book.Author;
+import org.apache.wink.jaxrs.test.jaxb.book.Book;
+import org.apache.wink.jaxrs.test.jaxb.person.Person;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class JAXBCollectionTest extends TestCase {
+
+    private static String BASE_URI =
+                                       ServerEnvironmentInfo.getBaseURI() + "/optionalproviders/jaxbresource";
+    protected RestClient  client;
+
+    static {
+        if (ServerEnvironmentInfo.isRestFilterUsed()) {
+            BASE_URI = ServerEnvironmentInfo.getBaseURI() + "/jaxbresource";
+        }
+    }
+
+    public void setUp() throws Exception {
+        ClientConfig config = new ClientConfig();
+        client = new RestClient(config);
+    }
+
+    public void testXMLRootWithObjectFactoryList() throws Exception {
+        List<Book> source = getBookSource();
+        Resource resource = client.resource(BASE_URI + "/booklist");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Book>>(source) {
+                });
+        List<Book> responseEntity = response.getEntity(new EntityType<List<Book>>() {
+        });
+
+        verifyResponse(responseEntity, Book.class);
+    }
+    
+    public void testXMLRootWithObjectFactoryArray() throws Exception {
+        Book[] source = getBookSource().toArray(new Book[]{});
+        Resource resource = client.resource(BASE_URI + "/bookarray");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<Book[]>(source) {
+                });
+        Book[] responseEntity = response.getEntity(new EntityType<Book[]>() {
+        });
+
+        verifyResponse(responseEntity, Book.class);
+    }
+    
+    public void testXMLRootWithObjectFactoryListResponse() throws Exception {
+        List<Book> source = getBookSource();
+        Resource resource = client.resource(BASE_URI + "/booklistresponse");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Book>>(source) {
+                });
+        List<Book> responseEntity = response.getEntity(new EntityType<List<Book>>() {
+        });
+
+        verifyResponse(responseEntity, Book.class);
+    }
+    
+    public void testXMLRootWithObjectFactoryJAXBElement() throws Exception {
+        List<Book> source = getBookSource();
+        Resource resource = client.resource(BASE_URI + "/booklistjaxbelement");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Book>>(source) {
+                });
+        List<Book> responseEntity = response.getEntity(new EntityType<List<Book>>() {
+        });
+
+        verifyResponse(responseEntity, Book.class);
+    }
+    
+    public void testXMLRootNoObjectFactoryList() throws Exception {
+        List<Person> source = getPersonSource();
+        Resource resource = client.resource(BASE_URI + "/personlist");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Person>>(source) {
+                });
+        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
+        });
+
+        verifyResponse(responseEntity, Person.class);
+    }
+    
+    public void testXMLRootNoObjectFactoryArray() throws Exception {
+        Person[] source = getPersonSource().toArray(new Person[]{});
+        Resource resource = client.resource(BASE_URI + "/personarray");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<Person[]>(source) {
+                });
+        Person[] responseEntity = response.getEntity(new EntityType<Person[]>() {
+        });
+
+        verifyResponse(responseEntity, Person.class);
+    }
+    
+    public void testXMLRootNoObjectFactoryListResponse() throws Exception {
+        List<Person> source = getPersonSource();
+        Resource resource = client.resource(BASE_URI + "/personlistresponse");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Person>>(source) {
+                });
+        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
+        });
+
+        verifyResponse(responseEntity, Person.class);
+    }
+    
+    public void testXMLRootNoObjectFactoryJAXBElement() throws Exception {
+        List<Person> source = getPersonSource();
+        Resource resource = client.resource(BASE_URI + "/personlistjaxbelement");
+        ClientResponse response =
+            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
+                .post(new GenericEntity<List<Person>>(source) {
+                });
+        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
+        });
+
+        verifyResponse(responseEntity, Person.class);
+    }
+    
+    private List<Book> getBookSource() {
+        List<Book> source = new ArrayList<Book>();
+        Book book = new Book();
+        Author author = new Author();
+        author.setFirstName("Eddie");
+        author.setLastName("Vedder");
+        book.setAuthor(author);
+        book.setTitle("Vitalogy");
+        source.add(book);
+        book = new Book();
+        author = new Author();
+        author.setFirstName("Stone");
+        author.setLastName("Gossard");
+        book.setAuthor(author);
+        book.setTitle("Ten");
+        source.add(book);
+        return source;
+    }
+    
+    @SuppressWarnings("unchecked")
+    private <T> void verifyResponse(Object response, Class<T> type) {
+        List<?> expected = null;
+        List<Object> actual = null;
+        if(type == Book.class) {
+            expected = getBookSource();
+            actual = new ArrayList();
+        } else {
+            expected = getPersonSource();
+            actual = new ArrayList();
+        }
+        if(response.getClass().isArray()) {
+            for(int i = 0; i < ((T[])response).length; ++i)
+                actual.add(((T[])response)[i]);
+        }  else
+            actual = (List)response;
+        for(Object o : expected) {
+            if(type == Book.class) {
+                Book b = (Book)o;
+                Author author = b.getAuthor();
+                author.setFirstName("echo " + author.getFirstName());
+                author.setLastName("echo " + author.getLastName());
+                b.setTitle("echo " + b.getTitle());
+            } else {
+                Person person = (Person)o;
+                person.setName("echo " + person.getName());
+                person.setDesc("echo " + person.getDesc());
+            }
+        }
+        assertEquals(expected, actual);
+    }
+    
+    private List<Person> getPersonSource() {
+        List<Person> people = new ArrayList<Person>();
+        Person person = new Person();
+        person.setName("Eddie Vedder");
+        person.setDesc("Author of Vitalogy");
+        people.add(person);
+        person = new Person();
+        person.setName("Stone Gossard");
+        person.setDesc("Author of Ten");
+        people.add(person);
+        return people;
+    }
+}