本文整理了Java中com.github.tomakehurst.wiremock.client.WireMock.head()
方法的一些代码示例,展示了WireMock.head()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WireMock.head()
方法的具体详情如下:
包路径:com.github.tomakehurst.wiremock.client.WireMock
类名称:WireMock
方法名:head
暂无
代码示例来源:origin: georocket/georocket
.withBody(nodes.encode())));
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(200)));
wireMockRule2.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(404)));
代码示例来源:origin: georocket/georocket
/**
* Check if {@link ElasticsearchClient#isRunning()} returns true
* if it is running
* @param context the test context
*/
@Test
public void isRunning(TestContext context) {
wireMockRule1.stubFor(head(urlEqualTo("/"))
.willReturn(aResponse()
.withStatus(200)));
Async async = context.async();
client.isRunning().subscribe(r -> {
context.assertTrue(r);
wireMockRule1.verify(headRequestedFor(urlEqualTo("/")));
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if the client can connect to multiple hosts
* @param context the test context
*/
@Test
public void multipleHosts(TestContext context) {
List<URI> hosts = Arrays.asList(URI.create("http://localhost:" + wireMockRule1.port()),
URI.create("http://localhost:" + wireMockRule2.port()));
client = new RemoteElasticsearchClient(hosts, INDEX, null, false, rule.vertx());
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(200)));
wireMockRule2.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(404)));
Async async = context.async();
client.indexExists()
.doOnSuccess(context::assertTrue)
.flatMap(v -> client.indexExists())
.doOnSuccess(context::assertFalse)
.subscribe(v -> async.complete(), context::fail);
}
代码示例来源:origin: biezhi/java-library-examples
throws InterruptedException, PageBiggerThanMaxSizeException, IOException {
WireMock.stubFor(WireMock.head(WireMock.urlEqualTo("/some/index.html"))
.willReturn(WireMock.aResponse()
.withStatus(200)
.withBody(new byte[] {1, 2, 3, 4})));
WireMock.stubFor(WireMock.head(WireMock.urlEqualTo("/some/invoice.pdf"))
.willReturn(WireMock.aResponse()
.withStatus(200)
代码示例来源:origin: georocket/georocket
/**
* Test if the {@link ElasticsearchClient#indexExists()} method returns
* <code>true</code> if the index exists
* @param context the test context
*/
@Test
public void indexExistsTrue(TestContext context) {
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(200)));
Async async = context.async();
client.indexExists().subscribe(f -> {
context.assertTrue(f);
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if the {@link ElasticsearchClient#typeExists(String)} method returns
* <code>false</code> if the index does not exist
* @param context the test context
*/
@Test
public void typeIndexExistsFalse(TestContext context) {
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX + "/" + TYPE))
.willReturn(aResponse()
.withStatus(404)));
Async async = context.async();
client.typeExists(TYPE).subscribe(f -> {
context.assertFalse(f);
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if the {@link ElasticsearchClient#indexExists()} method returns
* <code>false</code> if the index does not exist
* @param context the test context
*/
@Test
public void indexExistsFalse(TestContext context) {
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX))
.willReturn(aResponse()
.withStatus(404)));
Async async = context.async();
client.indexExists().subscribe(f -> {
context.assertFalse(f);
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if the {@link ElasticsearchClient#indexExists()} method returns
* <code>true</code> if the index exists
* @param context the test context
*/
@Test
public void typeIndexExistsTrue(TestContext context) {
wireMockRule1.stubFor(head(urlEqualTo("/" + INDEX + "/_mapping/" + TYPE))
.willReturn(aResponse()
.withStatus(200)));
Async async = context.async();
client.typeExists(TYPE).subscribe(f -> {
context.assertTrue(f);
async.complete();
}, context::fail);
}
代码示例来源:origin: vietj/vertx-http-proxy
.withHeader("Expires", ParseUtils.formatHttpDate(new Date(System.currentTimeMillis() + 5000)))
.withBody("content")));
stubFor(head(urlEqualTo("/img.jpg"))
.willReturn(
aResponse()
代码示例来源:origin: vietj/vertx-http-proxy
.withHeader("Expires", ParseUtils.formatHttpDate(new Date(System.currentTimeMillis() + 5000)))
.withBody("content")));
stubFor(head(urlEqualTo("/img.jpg"))
.willReturn(
aResponse()
代码示例来源:origin: vietj/vertx-http-proxy
.withHeader("Expires", ParseUtils.formatHttpDate(new Date(System.currentTimeMillis() + 5000)))
.withBody("content2")));
stubFor(head(urlEqualTo("/img.jpg")).inScenario("s").whenScenarioStateIs("abc")
.willReturn(
aResponse()
内容来源于网络,如有侵权,请联系作者删除!