use of com.github.tomakehurst.wiremock.junit.WireMockRule in project blueocean-plugin by jenkinsci.
the class WireMockBase method createWireMockServerRule.
protected static WireMockRule createWireMockServerRule(String resourceFolder, String baseUrl) {
ReplaceUrlTransformer replaceUrlTransformer = new ReplaceUrlTransformer();
final WireMockRule rule = new WireMockRule(wireMockConfig().dynamicPort().dynamicHttpsPort().usingFilesUnderClasspath(resourceFolder).extensions(new GzipDecompressTransformer(), replaceUrlTransformer));
String mappingsPath = String.format("src/test/resources/%s/mappings", resourceFolder);
String filesPath = String.format("src/test/resources/%s/__files", resourceFolder);
new File(mappingsPath).mkdirs();
new File(filesPath).mkdirs();
rule.enableRecordMappings(new SingleRootFileSource(mappingsPath), new SingleRootFileSource(filesPath));
rule.stubFor(WireMock.get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom(baseUrl)));
replaceUrlTransformer.configure(baseUrl, rule);
return rule;
}
use of com.github.tomakehurst.wiremock.junit.WireMockRule in project blueocean-plugin by jenkinsci.
the class BitbucketWireMockBase method setup.
@Before
public void setup() throws Exception {
super.setup();
this.authenticatedUser = login();
WireMockRule bitbucketApi = getWireMockRule();
String files = wireMockFileSystemPath() + "__files";
String mappings = wireMockFileSystemPath() + "mappings";
String proxyUrl = wireMockProxyUrl();
new File(mappings).mkdirs();
new File(files).mkdirs();
bitbucketApi.enableRecordMappings(new SingleRootFileSource(mappings), new SingleRootFileSource(files));
bitbucketApi.stubFor(WireMock.get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom(proxyUrl)));
this.apiUrl = String.format("http://localhost:%s", bitbucketApi.port());
}
use of com.github.tomakehurst.wiremock.junit.WireMockRule in project blueocean-plugin by jenkinsci.
the class HttpRequestTest method createWireMockServerRule.
private static WireMockRule createWireMockServerRule(String resourceFolder) {
final WireMockRule rule = new WireMockRule(wireMockConfig().dynamicPort().usingFilesUnderClasspath(resourceFolder));
String mappingsPath = String.format("src/test/resources/%s/mappings", resourceFolder);
String filesPath = String.format("src/test/resources/%s/__files", resourceFolder);
new File(mappingsPath).mkdirs();
new File(filesPath).mkdirs();
rule.enableRecordMappings(new SingleRootFileSource(mappingsPath), new SingleRootFileSource(filesPath));
return rule;
}
use of com.github.tomakehurst.wiremock.junit.WireMockRule in project syndesis by syndesisio.
the class DynamicActionSalesforceITCase method startMockIfNeeded.
@BeforeClass
public static void startMockIfNeeded() {
if (wireMock == null || !wireMock.isRunning()) {
wireMock = new WireMockRule(wireMockConfig().dynamicPort());
wireMock.start();
}
}
use of com.github.tomakehurst.wiremock.junit.WireMockRule in project syndesis by syndesisio.
the class DynamicActionSqlStoredITCase method startMockIfNeeded.
@BeforeClass
public static void startMockIfNeeded() {
if (wireMock == null || !wireMock.isRunning()) {
wireMock = new WireMockRule(wireMockConfig().dynamicPort());
wireMock.start();
}
}
Aggregations