本文整理了Java中com.github.tomakehurst.wiremock.client.WireMock.put()
方法的一些代码示例,展示了WireMock.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WireMock.put()
方法的具体详情如下:
包路径:com.github.tomakehurst.wiremock.client.WireMock
类名称:WireMock
方法名:put
暂无
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Test
public void testAppendMethodPut() throws Exception {
wireMockRule.stubFor(put(urlEqualTo("/test/log4j/1234"))
.willReturn(SUCCESS_RESPONSE));
final Appender appender = HttpAppender.newBuilder()
.withName("Http")
.withLayout(JsonLayout.createDefaultLayout())
.setConfiguration(ctx.getConfiguration())
.setMethod("PUT")
.setUrl(new URL("http://localhost:" + wireMockRule.port() + "/test/log4j/1234"))
.build();
appender.append(createLogEvent());
wireMockRule.verify(putRequestedFor(urlEqualTo("/test/log4j/1234"))
.withHeader("Host", containing("localhost"))
.withHeader("Content-Type", containing("application/json"))
.withRequestBody(containing("\"message\" : \"" + LOG_MESSAGE + "\"")));
}
代码示例来源:origin: com.github.tomakehurst/wiremock-jre8
public static MappingBuilder put(String url) {
return put(urlEqualTo(url));
}
代码示例来源:origin: authorjapps/zerocode
private static MappingBuilder createPutRequestBuilder(MockStep mockStep) {
final MappingBuilder requestBuilder = put(urlEqualTo(mockStep.getUrl()));
return createRequestBuilderWithHeaders(mockStep, requestBuilder);
}
代码示例来源:origin: georocket/georocket
/**
* Test if the client can create a mapping for an index
* @param context the test context
*/
@Test
public void putMapping(TestContext context) {
wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX + "/_mapping/" + TYPE))
.willReturn(aResponse()
.withStatus(200)
.withBody(ACKNOWLEDGED.encode())));
JsonObject mappings = new JsonObject()
.put("properties", new JsonObject()
.put("name", new JsonObject()
.put("type", "text")));
Async async = context.async();
client.putMapping(TYPE, mappings).subscribe(ack -> {
wireMockRule1.verify(putRequestedFor(urlEqualTo("/" + INDEX + "/_mapping/" + TYPE))
.withRequestBody(equalToJson("{\"properties\":{\"name\":{\"type\":\"text\"}}}}}")));
context.assertTrue(ack);
async.complete();
}, context::fail);
}
代码示例来源:origin: alfa-laboratory/akita
@Test
void shouldSendPutRequest() throws Exception {
stubFor(put(urlEqualTo("/put/someInfo"))
.willReturn(aResponse()
.withStatus(205)));
api.checkResponseCode("PUT", "/put/someInfo", 205, new ArrayList<>());
}
代码示例来源:origin: georocket/georocket
/**
* Test if the client can create an index with settings
* @param context the test context
*/
@Test
public void createIndexWithSettings(TestContext context) {
StubMapping settings = wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX))
.withRequestBody(equalToJson(SETTINGS_WRAPPER.encode()))
.willReturn(aResponse()
.withBody(ACKNOWLEDGED.encode())
.withStatus(200)));
Async async = context.async();
client.createIndex(SETTINGS).subscribe(ok -> {
context.assertTrue(ok);
wireMockRule1.verify(putRequestedFor(settings.getRequest().getUrlMatcher()));
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if tags can be can be appended
* @param context the test context
*/
@Test
public void appendTags(TestContext context) {
String url = "/store/?search=test&tags=a,b,c";
stubFor(put(urlEqualTo(url))
.willReturn(aResponse()
.withStatus(204)));
List<String> tags = Arrays.asList("a", "b", "c");
Async async = context.async();
client.getStore().appendTags("test", "/", tags, ar -> {
context.assertTrue(ar.succeeded());
async.complete();
});
}
代码示例来源:origin: georocket/georocket
/**
* Test if the client can create an index
* @param context the test context
*/
@Test
public void createIndex(TestContext context) {
StubMapping settings = wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX))
.withRequestBody(equalTo(""))
.willReturn(aResponse()
.withBody(ACKNOWLEDGED.encode())
.withStatus(200)));
Async async = context.async();
client.createIndex().subscribe(ok -> {
context.assertTrue(ok);
wireMockRule1.verify(putRequestedFor(settings.getRequest().getUrlMatcher()));
async.complete();
}, context::fail);
}
代码示例来源:origin: georocket/georocket
/**
* Test if properties can be can be set
* @param context the test context
*/
@Test
public void setProperties(TestContext context) {
String url = "/store/?search=test&properties=a%3D1,b%3D2";
stubFor(put(urlEqualTo(url))
.willReturn(aResponse()
.withStatus(204)));
List<String> tags = Arrays.asList("a=1", "b=2");
Async async = context.async();
client.getStore().setProperties("test", "/", tags, ar -> {
context.assertTrue(ar.succeeded());
async.complete();
});
}
代码示例来源:origin: georocket/georocket
put(urlPathMatching(pathWithLeadingSlash(S3_BUCKET, ".*")))
.withHeader(Http.CONTENT_LENGTH, equalTo(String.valueOf(CHUNK_CONTENT.length())))
put(urlPathMatching(pathWithLeadingSlash(S3_BUCKET, TEST_FOLDER, ".*")))
.withHeader(Http.CONTENT_LENGTH, equalTo(String.valueOf(CHUNK_CONTENT.length())))
代码示例来源:origin: org.kie/kie-server-client
@Test
public void testCreateContainer() {
stubFor(put(urlEqualTo("/containers/kie1"))
.withHeader("Accept", equalTo("application/xml"))
.willReturn(aResponse()
内容来源于网络,如有侵权,请联系作者删除!