Package org.springframework.http.client

Examples of org.springframework.http.client.ClientHttpRequestFactory.createRequest()


    @Test(expected = IllegalArgumentException.class)
    public void testCreateFactoryWrapperIllegalRequest() throws Exception {
        ClientHttpFactoryProcessorParam params = new ClientHttpFactoryProcessorParam();
        final ClientHttpRequestFactory factoryWrapper = restrictUrisProcessor.createFactoryWrapper(params, requestFactory);
        factoryWrapper.createRequest(new URI("http://www.google.com/q"), HttpMethod.GET);
    }
}
View Full Code Here


        when(client.getHeaders()).thenReturn(headers);
        when(client.getBody()).thenReturn(buffer);
        when(client.execute()).thenReturn(resp);

        ClientHttpRequestFactory factory = mock(ClientHttpRequestFactory.class);
        when(factory.createRequest(any(URI.class), any(HttpMethod.class))).thenReturn(client);

        // add the new interceptor...
        BasicAuthInterceptor interceptor = new BasicAuthInterceptor();
        interceptor.setPropertyResolver(resolver);
        interceptor.setId(id);
View Full Code Here

        when(client.getHeaders()).thenReturn(headers);
        when(client.getBody()).thenReturn(buffer);
        when(client.execute()).thenReturn(resp);

        ClientHttpRequestFactory factory = mock(ClientHttpRequestFactory.class);
        when(factory.createRequest(any(URI.class), any(HttpMethod.class))).thenReturn(client);

        // add the new interceptor...
        ZeroLeggedOAuthInterceptor interceptor = new ZeroLeggedOAuthInterceptor();
        interceptor.setPropertyResolver(resolver);
        interceptor.setId(id);
View Full Code Here

    when(mockResponse.getBody()).thenReturn(new ByteArrayInputStream("Test Body".getBytes()));
    when(mockRequest.getHeaders()).thenReturn(new HttpHeaders());
    when(mockRequest.getBody()).thenReturn(new ByteArrayOutputStream());
    when(mockRequest.execute()).thenReturn(mockResponse);
    ClientHttpRequestFactory mockRequestFactory = mock(ClientHttpRequestFactory.class);
    when(mockRequestFactory.createRequest(new URI("http://somehost.com/test"), HttpMethod.GET)).thenReturn(mockRequest);
    ClientHttpRequestFactory bufferingRequestFactory = ClientHttpRequestFactorySelector.bufferRequests(mockRequestFactory);
    ClientHttpRequest request = bufferingRequestFactory.createRequest(new URI("http://somehost.com/test"), HttpMethod.GET);
    ClientHttpResponse response = request.execute();
    response.getBody();
    response.getBody();
View Full Code Here

    when(mockRequest.getBody()).thenReturn(new ByteArrayOutputStream());
    when(mockRequest.execute()).thenReturn(mockResponse);
    ClientHttpRequestFactory mockRequestFactory = mock(ClientHttpRequestFactory.class);
    when(mockRequestFactory.createRequest(new URI("http://somehost.com/test"), HttpMethod.GET)).thenReturn(mockRequest);
    ClientHttpRequestFactory bufferingRequestFactory = ClientHttpRequestFactorySelector.bufferRequests(mockRequestFactory);
    ClientHttpRequest request = bufferingRequestFactory.createRequest(new URI("http://somehost.com/test"), HttpMethod.GET);
    ClientHttpResponse response = request.execute();
    response.getBody();
    response.getBody();
    response.getBody();
    verify(mockRequest, times(1)).getBody();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.