Search in sources :

Example 1 with SimpleFactory

use of org.apache.cxf.jaxrs.SimpleFactory in project cxf by apache.

the class JAXRSUtilsTest method testConversion.

@Test
public void testConversion() throws Exception {
    ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
    OperationResourceInfo ori = new OperationResourceInfo(Customer.class.getMethod("testConversion", new Class[] { PathSegmentImpl.class, SimpleFactory.class }), cri);
    ori.setHttpMethod("GET");
    ori.setURITemplate(new URITemplate("{id1}/{id2}"));
    MultivaluedMap<String, String> values = new MetadataMap<String, String>();
    values.putSingle("id1", "1");
    values.putSingle("id2", "2");
    Message m = createMessage();
    List<Object> params = JAXRSUtils.processParameters(ori, values, m);
    PathSegment ps = (PathSegment) params.get(0);
    assertEquals("1", ps.getPath());
    SimpleFactory sf = (SimpleFactory) params.get(1);
    assertEquals(2, sf.getId());
}
Also used : Message(org.apache.cxf.message.Message) Customer(org.apache.cxf.jaxrs.Customer) ClassResourceInfo(org.apache.cxf.jaxrs.model.ClassResourceInfo) URITemplate(org.apache.cxf.jaxrs.model.URITemplate) SimpleFactory(org.apache.cxf.jaxrs.SimpleFactory) PathSegment(javax.ws.rs.core.PathSegment) MetadataMap(org.apache.cxf.jaxrs.impl.MetadataMap) PathSegmentImpl(org.apache.cxf.jaxrs.impl.PathSegmentImpl) OperationResourceInfo(org.apache.cxf.jaxrs.model.OperationResourceInfo) Test(org.junit.Test)

Aggregations

PathSegment (javax.ws.rs.core.PathSegment)1 Customer (org.apache.cxf.jaxrs.Customer)1 SimpleFactory (org.apache.cxf.jaxrs.SimpleFactory)1 MetadataMap (org.apache.cxf.jaxrs.impl.MetadataMap)1 PathSegmentImpl (org.apache.cxf.jaxrs.impl.PathSegmentImpl)1 ClassResourceInfo (org.apache.cxf.jaxrs.model.ClassResourceInfo)1 OperationResourceInfo (org.apache.cxf.jaxrs.model.OperationResourceInfo)1 URITemplate (org.apache.cxf.jaxrs.model.URITemplate)1 Message (org.apache.cxf.message.Message)1 Test (org.junit.Test)1