Package com.thoughtworks.inproctester.core

Examples of com.thoughtworks.inproctester.core.InProcResponse


    public ClientResponse execute(ClientRequest clientRequest) throws Exception {

        final InProcRequest testerRequest = new RestEasyClientInProcRequest(clientRequest);

        final InProcResponse testerResponse = routeToTesterApplication(testerRequest.getUri()).getResponses(testerRequest);

        BaseClientResponse<?> clientResponse = new BaseClientResponse(new BaseClientResponse.BaseClientResponseStreamFactory() {
            InputStream stream;

            public InputStream getInputStream() {
                if (stream == null) {
                    stream = new SelfExpandingBufferredInputStream(new ByteArrayInputStream(testerResponse.getContentBytes()));
                }
                return stream;
            }

            public void performReleaseConnection() {
                try {
                    stream.close();
                } catch (Exception ignored) {
                }
            }
        }, this);
        clientResponse.setStatus(testerResponse.getStatus());
        clientResponse.setHeaders(extractHeaders(testerResponse));
        clientResponse.setProviderFactory(clientRequest.getProviderFactory());

        return clientResponse;
    }
View Full Code Here


    }

    public ClientResponse handle(ClientRequest clientRequest) {
        final InProcRequest cRequest = new JerseyClientInprocRequest(clientRequest);

        InProcResponse cResponse = w.getResponses(cRequest);

        return new ClientResponse(
                cResponse.getStatus(),
                getInBoundHeaders(cResponse),
                new ByteArrayInputStream(cResponse.getContentBytes()),
                getMessageBodyWorkers());
    }
View Full Code Here

        return new WebResponse(adaptResponse(processTesterRequest(adaptRequest(webRequest))), webRequest, 0);
    }

    private InProcResponse processTesterRequest(InProcRequest inProcRequest) throws IOException {
        addCookiesToRequest(inProcRequest);
        InProcResponse inProcResponse = inProcConnection.getResponses(inProcRequest);
        storeCookiesFromResponse(inProcRequest, inProcResponse);
        return inProcResponse;
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.inproctester.core.InProcResponse

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.