Search in sources :

Example 1 with Query

use of org.apache.cxf.jaxrs.Customer.Query in project cxf by apache.

the class JAXRSUtilsTest method testQueryParameter.

@Test
public void testQueryParameter() throws Exception {
    Message messageImpl = createMessage();
    ProviderFactory.getInstance(messageImpl).registerUserProvider(new GenericObjectParameterHandler());
    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, new ClassResourceInfo(Customer.class)), null, messageImpl);
    assertEquals(1, params.size());
    @SuppressWarnings("unchecked") Query<String> query = (Query<String>) params.get(0);
    assertEquals("thequery", query.getEntity());
}
Also used : Message(org.apache.cxf.message.Message) Query(org.apache.cxf.jaxrs.Customer.Query) ClassResourceInfo(org.apache.cxf.jaxrs.model.ClassResourceInfo) Method(java.lang.reflect.Method) OperationResourceInfo(org.apache.cxf.jaxrs.model.OperationResourceInfo) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Query (org.apache.cxf.jaxrs.Customer.Query)1 ClassResourceInfo (org.apache.cxf.jaxrs.model.ClassResourceInfo)1 OperationResourceInfo (org.apache.cxf.jaxrs.model.OperationResourceInfo)1 Message (org.apache.cxf.message.Message)1 Test (org.junit.Test)1