use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class RecordApiAcceptanceTest method proxyServerStart.
private void proxyServerStart(WireMockConfiguration config) {
proxyingService = new WireMockServer(config.dynamicPort());
proxyingService.start();
proxyTargetUrl = "http://localhost:" + wireMockServer.port();
proxyingService.stubFor(proxyAllTo(proxyTargetUrl).withMetadata(metadata().attr("proxy", true)));
proxyingTestClient = new WireMockTestClient(proxyingService.port());
wireMockServer.stubFor(any(anyUrl()).willReturn(ok()));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class StubRequestLoggingAcceptanceTest method doesNotLogEventsToNotifierWhenDisabled.
@Test
public void doesNotLogEventsToNotifierWhenDisabled() {
TestNotifier notifier = new TestNotifier();
WireMockServer wm = new WireMockServer(wireMockConfig().dynamicPort().stubRequestLoggingDisabled(true).notifier(notifier));
wm.start();
testClient = new WireMockTestClient(wm.port());
wm.stubFor(get("/log-me").willReturn(ok("body")));
testClient.get("/log-me");
assertThat(notifier.infoMessages.size(), is(0));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class TransferEncodingAcceptanceTest method startWithChunkedEncodingPolicy.
private void startWithChunkedEncodingPolicy(Options.ChunkedEncodingPolicy chunkedEncodingPolicy) {
wm = new WireMockServer(wireMockConfig().dynamicPort().withRootDirectory(filePath("test-file-root")).useChunkedTransferEncoding(chunkedEncodingPolicy));
wm.start();
testClient = new WireMockTestClient(wm.port());
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class WarDeploymentAcceptanceTest method init.
@BeforeEach
public void init() throws Exception {
String webAppRootPath = sampleWarRootDir() + "/src/main/webapp";
WebAppContext context = new WebAppContext(webAppRootPath, "/wiremock");
int port = attemptToStartOnRandomPort(context);
WireMock.configureFor("localhost", port, "/wiremock");
testClient = new WireMockTestClient(port);
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class WarDeploymentParameterAcceptanceTest method init.
/**
* Start jetty and wiremock. This is not an @Before method since we need to pass a parameter
*
* @param webInfPath Path where the WEB-INF directory for jetty resides
* @param mappingPath Path where wiremock is mapped
*/
private void init(String webInfPath, String mappingPath) throws Exception {
int port = Network.findFreePort();
jetty = new Server(port);
WebAppContext context = new WebAppContext(webInfPath, "/wiremock");
jetty.setHandler(context);
jetty.start();
WireMock.configureFor("localhost", port, "/wiremock" + mappingPath);
testClient = new WireMockTestClient(port);
}
Aggregations