Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 18358 invoked from network); 8 Dec 2009 13:54:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Dec 2009 13:54:41 -0000 Received: (qmail 74951 invoked by uid 500); 8 Dec 2009 13:54:41 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 74874 invoked by uid 500); 8 Dec 2009 13:54:41 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 74865 invoked by uid 99); 8 Dec 2009 13:54:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 13:54:41 +0000 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 13:54:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2E6642388998; Tue, 8 Dec 2009 13:54:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r888400 - in /cxf/trunk/systests/jaxrs/src/test: java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java resources/jaxrs_atom/WEB-INF/beans.xml Date: Tue, 08 Dec 2009 13:54:17 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091208135417.2E6642388998@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Tue Dec 8 13:54:16 2009 New Revision: 888400 URL: http://svn.apache.org/viewvc?rev=888400&view=rev Log: Testing custom atom provider Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java (with props) Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java?rev=888400&view=auto ============================================================================== --- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java (added) +++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java Tue Dec 8 13:54:16 2009 @@ -0,0 +1,47 @@ +/** + * 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.jaxrs; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.Provider; + +import org.apache.abdera.model.Feed; +import org.apache.cxf.jaxrs.provider.AtomFeedProvider; + +@Produces({"application/atom+xml", "application/atom+xml;type=feed", "application/json" }) +@Consumes({"application/atom+xml", "application/atom+xml;type=feed" }) +@Provider +public class CustomAtomFeedProvider extends AtomFeedProvider { + + @Override + public void writeTo(Feed element, Class clazz, Type type, Annotation[] a, + MediaType mt, MultivaluedMap headers, OutputStream os) + throws IOException { + os.write("".getBytes()); + super.writeTo(element, clazz, type, a, mt, headers, os); + } +} Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java?rev=888400&r1=888399&r2=888400&view=diff ============================================================================== --- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java (original) +++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java Tue Dec 8 13:54:16 2009 @@ -149,6 +149,16 @@ "*/*"); } + @Test + public void testGetBooksWithCustomProvider() throws Exception { + String endpointAddress = + "http://localhost:9081/bookstore/bookstore4/books/feed"; + Feed feed = getFeed(endpointAddress, null); + assertEquals("http://localhost:9081/bookstore/bookstore4/books/feed", + feed.getBaseUri().toString()); + assertEquals("Collection of Books", feed.getTitle()); + } + private void getAndCompareJson(String address, String resourcePath, String type) throws Exception { Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml?rev=888400&r1=888399&r2=888400&view=diff ============================================================================== --- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml (original) +++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml Tue Dec 8 13:54:16 2009 @@ -85,6 +85,15 @@ + + + + + + + + + @@ -92,6 +101,11 @@ + + +