Package org.apache.cxf.jaxrs.model

Examples of org.apache.cxf.jaxrs.model.ClassResourceInfo


    }
   
    @Test
    public void testPerRequestHttpContextFields() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        cri.setResourceProvider(new PerRequestResourceProvider(Customer.class));
        OperationResourceInfo ori = new OperationResourceInfo(null, cri);
       
        Customer c = new Customer();
       
        Message m = createMessage();
View Full Code Here


    }
   
    @Test
    public void testSingletonHttpContextFields() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        Customer c = new Customer();
        cri.setResourceProvider(new SingletonResourceProvider(c));
               
        Message m = createMessage();
        m.put(Message.PROTOCOL_HEADERS, new HashMap<String, List<String>>());
        ServletContext servletContextMock = EasyMock.createNiceMock(ServletContext.class);
        m.put(AbstractHTTPDestination.HTTP_CONTEXT, servletContextMock);
        HttpServletRequest httpRequest = EasyMock.createNiceMock(HttpServletRequest.class);
        m.put(AbstractHTTPDestination.HTTP_REQUEST, httpRequest);
        HttpServletResponse httpResponse = EasyMock.createMock(HttpServletResponse.class);
        m.put(AbstractHTTPDestination.HTTP_RESPONSE, httpResponse);
       
        InjectionUtils.injectContextProxies(cri, cri.getResourceProvider().getInstance(null));
        InjectionUtils.injectContextFields(c, cri, m);
        InjectionUtils.injectContextMethods(c, cri, m);
        assertSame(ThreadLocalUriInfo.class, c.getUriInfo2().getClass());
        assertSame(UriInfoImpl.class,
                   ((ThreadLocalProxy)c.getUriInfo2()).get().getClass());
View Full Code Here

    }
   
    @Test
    public void testSingletonHttpResourceFields() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        Customer c = new Customer();
        cri.setResourceProvider(new SingletonResourceProvider(c));
               
        Message m = new MessageImpl();
        ServletContext servletContextMock = EasyMock.createNiceMock(ServletContext.class);
        m.put(AbstractHTTPDestination.HTTP_CONTEXT, servletContextMock);
        HttpServletRequest httpRequest = EasyMock.createNiceMock(HttpServletRequest.class);
        m.put(AbstractHTTPDestination.HTTP_REQUEST, httpRequest);
        HttpServletResponse httpResponse = EasyMock.createMock(HttpServletResponse.class);
        m.put(AbstractHTTPDestination.HTTP_RESPONSE, httpResponse);
        InjectionUtils.injectContextProxies(cri, cri.getResourceProvider().getInstance(null));
        InjectionUtils.injectResourceFields(c, cri, m);
        assertSame(servletContextMock,
                   ((ThreadLocalProxy)c.getServletContextResource()).get());
        assertSame(httpRequest,
                   ((ThreadLocalProxy)c.getServletRequestResource()).get());
View Full Code Here

    }
   
    @Test
    public void testContextAnnotationOnMethod() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        Customer c = new Customer();
        cri.setResourceProvider(new SingletonResourceProvider(c));
        InjectionUtils.injectContextProxies(cri, cri.getResourceProvider().getInstance(null));
       
        OperationResourceInfo ori = new OperationResourceInfo(Customer.class.getMethods()[0],
                                                              cri);
        Message message = new MessageImpl();
        InjectionUtils.injectContextMethods(c, ori.getClassResourceInfo(), message);
View Full Code Here

    }
   
    @Test
    public void testParamAnnotationOnMethod() throws Exception {

        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        Customer c = new Customer();
        OperationResourceInfo ori = new OperationResourceInfo(Customer.class.getMethods()[0],
                                                              cri);
        Message m = createMessage();
        MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
View Full Code Here

    }
   
    @Test
    public void testParamAnnotationOnField() throws Exception {

        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        Customer c = new Customer();
        OperationResourceInfo ori = new OperationResourceInfo(Customer.class.getMethods()[0],
                                                              cri);
        Message m = createMessage();
       
View Full Code Here

    }
   
    @Test
    public void testContextResolverParam() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        OperationResourceInfo ori =
            new OperationResourceInfo(
                Customer.class.getMethod("testContextResolvers",
                                         new Class[]{ContextResolver.class}),
                                         cri);
View Full Code Here

    }
   
    @Test
    public void testContextResolverFields() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        cri.setResourceProvider(new PerRequestResourceProvider(Customer.class));
        OperationResourceInfo ori = new OperationResourceInfo(null, cri);
       
        Message m = createMessage();
        HttpServletResponse response = EasyMock.createMock(HttpServletResponse.class);
        m.put(AbstractHTTPDestination.HTTP_RESPONSE, response);
View Full Code Here

    }
   
    @Test
    public void testServletResourceFields() throws Exception {
       
        ClassResourceInfo cri = new ClassResourceInfo(Customer.class, true);
        cri.setResourceProvider(new PerRequestResourceProvider(Customer.class));
        OperationResourceInfo ori = new OperationResourceInfo(null, cri);
       
        Customer c = new Customer();
       
        // Creating mocks for the servlet request, response and context
View Full Code Here

        assertSame(context.getClass(), c.getServletContext().getClass());
    }
   
    @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}),
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.model.ClassResourceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.