Package org.mockserver.model

Examples of org.mockserver.model.HttpRequest


        });

        // when
        proxyClient
                .verify(
                        new HttpRequest()
                                .withPath("/some_path")
                                .withBody(new StringBody("some_request_body", Body.Type.STRING)),
                        Times.exactly(1)
                );
View Full Code Here


        });

        // when
        proxyClient
                .verify(
                        new HttpRequest()
                                .withPath("/some_path")
                                .withBody(new StringBody("some_request_body", Body.Type.STRING)),
                        Times.exactly(1)
                );
    }
View Full Code Here

        });

        // when
        proxyClient
                .verify(
                        new HttpRequest()
                                .withPath("/some_path")
                                .withBody(new StringBody("some_request_body", Body.Type.STRING)),
                        Times.atLeast(1)
                );
View Full Code Here

        });

        // when
        proxyClient
                .verify(
                        new HttpRequest()
                                .withPath("/some_path")
                                .withBody(new StringBody("some_request_body", Body.Type.STRING)),
                        Times.atLeast(1)
                );
View Full Code Here

        });

        // when
        proxyClient
                .verify(
                        new HttpRequest()
                                .withPath("/some_path")
                                .withBody(new StringBody("some_request_body", Body.Type.STRING)),
                        Times.exactly(2)
                );
    }
View Full Code Here

                .withBody("a_callback_response");

        // then
        // - in http
        HttpResponse actual = makeRequest(
                new HttpRequest()
                        .withURL("http://localhost:" + getMockServerPort() + "/" + servletContext + (servletContext.length() > 0 && !servletContext.endsWith("/") ? "/" : "") + "callback")
                        .withMethod("POST")
                        .withHeaders(
                                new Header("X-Test", "test_headers_and_body"),
                                new Header("Content-Type", "text/plain")
                        )
                        .withBody("an_example_body_http"),
                false
        );
        assertEquals(
                StaticTestExpectationCallback.httpResponse,
                actual
        );
        assertEquals(StaticTestExpectationCallback.httpRequests.get(0).getBody().getValue(), "an_example_body_http");
        assertEquals(StaticTestExpectationCallback.httpRequests.get(0).getPath(), "/callback");

        // - in https
        assertEquals(
                StaticTestExpectationCallback.httpResponse,
                makeRequest(
                        new HttpRequest()
                                .withURL("https://localhost:" + getMockServerSecurePort() + "/" + servletContext + (servletContext.length() > 0 && !servletContext.endsWith("/") ? "/" : "") + "callback")
                                .withMethod("POST")
                                .withHeaders(
                                        new Header("X-Test", "test_headers_and_body"),
                                        new Header("Host", "127.0.0.1:" + getTestServerPort()),
View Full Code Here

        assertEquals(
                new HttpResponse()
                        .withStatusCode(HttpStatusCode.OK_200.code())
                        .withBody("test_initializer_response_body"),
                makeRequest(
                        new HttpRequest()
                                .withMethod("POST")
                                .withURL("http://localhost:" + SERVER_HTTP_PORT + "/test_initializer_path")
                                .withBody("test_initializer_request_body")
                )
        );
        // - in https
        assertEquals(
                new HttpResponse()
                        .withStatusCode(HttpStatusCode.OK_200.code())
                        .withBody("test_initializer_response_body"),
                makeRequest(
                        new HttpRequest()
                                .withMethod("POST")
                                .withURL("https://localhost:" + SERVER_HTTPS_PORT + "/test_initializer_path")
                                .withBody("test_initializer_request_body")
                )
        );
View Full Code Here

    private ApacheHttpClient apacheHttpClient = new ApacheHttpClient(true);
    private LogFilter logFilter = new LogFilter();
    private Filters filters = new Filters();

    public ProxyServlet() {
        filters.withFilter(new HttpRequest(), new HopByHopHeaderFilter());
        filters.withFilter(new HttpRequest(), logFilter);
    }
View Full Code Here

                ctx.close();
                server.stop();

            } else {

                HttpRequest httpRequest = nettyToMockServerRequestMapper.mapNettyRequestToMockServerRequest(request, secure);
                writeResponse(ctx, request, actionHandler.processAction(mockServerMatcher.handle(httpRequest), httpRequest));

            }
        } catch (Exception e) {
            logger.error("Exception processing " + request, e);
View Full Code Here

public class ExpectationDTOTest {

    @Test
    public void shouldReturnValueSetInConstructor() {
        // given
        HttpRequest httpRequest = new HttpRequest().withBody("some_body");
        HttpResponse httpResponse = new HttpResponse().withBody("some_response_body");
        HttpForward httpForward = new HttpForward().withHost("some_host");
        HttpCallback httpCallback = new HttpCallback().withCallbackClass("some_class");

        // when
View Full Code Here

TOP

Related Classes of org.mockserver.model.HttpRequest

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.