Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 65AE9D7BE for ; Mon, 4 Mar 2013 10:37:26 +0000 (UTC) Received: (qmail 37439 invoked by uid 500); 4 Mar 2013 10:37:26 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 37310 invoked by uid 500); 4 Mar 2013 10:37:26 -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 37299 invoked by uid 99); 4 Mar 2013 10:37:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Mar 2013 10:37:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED 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; Mon, 04 Mar 2013 10:37:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 256B023888EA; Mon, 4 Mar 2013 10:37:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1452244 - /cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Date: Mon, 04 Mar 2013 10:37:03 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130304103703.256B023888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Mon Mar 4 10:37:02 2013 New Revision: 1452244 URL: http://svn.apache.org/r1452244 Log: One more test to check extension parameter handlers Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=1452244&r1=1452243&r2=1452244&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java (original) +++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Mon Mar 4 10:37:02 2013 @@ -21,7 +21,9 @@ package org.apache.cxf.jaxrs.utils; import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.lang.annotation.Annotation; import java.lang.reflect.Method; +import java.lang.reflect.Type; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collections; @@ -46,6 +48,8 @@ import javax.ws.rs.core.Request; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.ParamConverter; +import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Providers; import javax.xml.bind.JAXBContext; @@ -903,6 +907,24 @@ public class JAXRSUtilsTest extends Asse } @Test + public void testQueryParameter2() throws Exception { + Message messageImpl = createMessage(); + ProviderFactory.getInstance(messageImpl).registerUserProvider( + new GenericObjectParameterHandlerExtension()); + Class[] argType = {Query.class}; + Method m = Customer.class.getMethod("testGenericObjectParam", argType); + + messageImpl.put(Message.QUERY_STRING, "p1=thequery"); + List params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null), + null, + messageImpl); + assertEquals(1, params.size()); + @SuppressWarnings("unchecked") + Query query = (Query)params.get(0); + assertEquals("thequery", query.getEntity()); + } + + @Test public void testConstructorFirstAndParameterHandler() throws Exception { Message messageImpl = createMessage(); ProviderFactory.getInstance(messageImpl).registerUserProvider( @@ -1879,6 +1901,14 @@ public class JAXRSUtilsTest extends Asse } + private static class GenericObjectParameterHandlerExtension implements ParameterHandler> { + + public Query fromString(String s) { + return new Query(s); + } + + } + private static class GenericObjectParameterHandler implements ParamConverterProvider, ParamConverter> {