cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
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 GMT
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<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,
null),
+                                                           null, 
+                                                           messageImpl);
+        assertEquals(1, params.size());
+        @SuppressWarnings("unchecked")
+        Query<String> query = (Query<String>)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<Query<String>>
{
+
+        public Query<String> fromString(String s) {
+            return new Query<String>(s);
+        }
+        
+    }
+    
     private static class GenericObjectParameterHandler implements ParamConverterProvider,

         ParamConverter<Query<String>> {
 



Mime
View raw message