本文整理汇总了Java中io.vertx.core.MultiMap.add方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.add方法的具体用法?Java MultiMap.add怎么用?Java MultiMap.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.MultiMap
的用法示例。
在下文中一共展示了MultiMap.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testArrayMulti
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test()
public void testArrayMulti() {
String name = "myName";
SerializableParameter parameter = new QueryParameter();
parameter.setName("myName");
parameter.setType("array");
parameter.setCollectionFormat("multi");
List<String> paramsList = new ArrayList<>();
paramsList.add("toto");
paramsList.add("tutu");
paramsList.add("titi");
MultiMap params = MultiMap.caseInsensitiveMultiMap();
params.add(name, paramsList);
Object result = abstractSerializableParameterExtractor.extract(name, parameter, params);
Assert.assertArrayEquals(paramsList.toArray(), ((List) result).toArray());
}
示例2: getActionContext
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public ActionContext getActionContext(String query) {
MultiMap params = MultiMap.caseInsensitiveMultiMap();
for (Entry<String, String> entry : HttpQueryUtils.splitQuery(query).entrySet()) {
params.add(entry.getKey(), entry.getValue());
}
ActionContext mock = Mockito.mock(ActionContext.class);
Mockito.when(mock.getParameters()).thenReturn(params);
Mockito.when(mock.getParameter(Mockito.anyString())).thenAnswer(answer -> {
String key = (String) answer.getArguments()[0];
return params.get(key);
});
return mock;
}
示例3: testGetHeader
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetHeader() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "value");
new Expectations() {
{
clientRequest.headers();
result = headers;
}
};
Assert.assertEquals("value", request.getHeader("name"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxClientRequestToHttpServletRequest.java
示例4: testGetHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetHeaders() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "value");
new Expectations() {
{
clientRequest.headers();
result = headers;
}
};
Assert.assertThat(Collections.list(request.getHeaders("name")), Matchers.contains("value"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxClientRequestToHttpServletRequest.java
示例5: testGetHeaderNames
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetHeaderNames() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "value");
new Expectations() {
{
clientRequest.headers();
result = headers;
}
};
Assert.assertThat(Collections.list(request.getHeaderNames()), Matchers.contains("name"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxClientRequestToHttpServletRequest.java
示例6: getHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void getHeaders() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "v1");
headers.add("name", "v2");
new Expectations() {
{
clientResponse.headers();
result = headers;
}
};
Assert.assertThat(response.getHeaders("name"), Matchers.contains("v1", "v2"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestVertxClientResponseToHttpServletResponse.java
示例7: getHeaderNames
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void getHeaderNames() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("n1", "v1");
headers.add("n2", "v2");
new Expectations() {
{
clientResponse.headers();
result = headers;
}
};
Assert.assertThat(response.getHeaderNames(), Matchers.contains("n1", "n2"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestVertxClientResponseToHttpServletResponse.java
示例8: testGetParameterValuesNormal
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetParameterValuesNormal() {
MultiMap params = MultiMap.caseInsensitiveMultiMap();
params.add("name", "value");
new Expectations() {
{
vertxRequest.params();
result = params;
}
};
Assert.assertThat(request.getParameterValues("name"), Matchers.arrayContaining("value"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestVertxServerRequestToHttpServletRequest.java
示例9: testGetHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetHeaders() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "value");
new Expectations() {
{
vertxRequest.headers();
result = headers;
}
};
Assert.assertThat(Collections.list(request.getHeaders("name")), Matchers.contains("value"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxServerRequestToHttpServletRequest.java
示例10: testGetHeaderNames
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testGetHeaderNames() {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
headers.add("name", "value");
new Expectations() {
{
vertxRequest.headers();
result = headers;
}
};
Assert.assertThat(Collections.list(request.getHeaderNames()), Matchers.contains("name"));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestVertxServerRequestToHttpServletRequest.java
示例11: testAfterReceiveResponseNormal
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test
public void testAfterReceiveResponseNormal(@Mocked Invocation invocation,
@Mocked HttpServletResponseEx responseEx,
@Mocked Buffer bodyBuffer,
@Mocked OperationMeta operationMeta,
@Mocked ResponseMeta responseMeta,
@Mocked RestOperationMeta swaggerRestOperation,
@Mocked ProduceProcessor produceProcessor) throws Exception {
MultiMap responseHeader = new CaseInsensitiveHeaders();
responseHeader.add("b", "bValue");
Object decodedResult = new Object();
new Expectations() {
{
responseEx.getHeader(HttpHeaders.CONTENT_TYPE);
result = "json";
responseEx.getHeaderNames();
result = Arrays.asList("a", "b");
responseEx.getHeaders("b");
result = responseHeader.getAll("b");
swaggerRestOperation.findProduceProcessor("json");
result = produceProcessor;
produceProcessor.decodeResponse(bodyBuffer, responseMeta.getJavaType());
result = decodedResult;
invocation.getOperationMeta();
result = operationMeta;
operationMeta.getExtData(RestConst.SWAGGER_REST_OPERATION);
result = swaggerRestOperation;
responseEx.getStatusType();
result = Status.OK;
}
};
Response response = filter.afterReceiveResponse(invocation, responseEx);
Assert.assertSame(decodedResult, response.getResult());
Assert.assertEquals(1, response.getHeaders().getHeaderMap().size());
Assert.assertEquals(response.getHeaders().getHeader("b"), Arrays.asList("bValue"));
}
示例12: initWebPostRequest
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private HttpRequest<Buffer> initWebPostRequest(final String destination) {
final WebClient client = this.initWebClient();
final HttpRequest<Buffer> request = client.post(Constants.TLS_PORT, this.authInfo.serverName, destination)
.ssl(true).putHeader("Authorization", this.authInfo.sessionToken)
.putHeader("Content-Type", "application/json;charset=UTF-8");
final MultiMap headers = request.headers();
headers.add("Cookie", this.cookies.values());
return request;
}
示例13: testNotAllowEmptyValueWithEmptyParameter
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testNotAllowEmptyValueWithEmptyParameter() {
String name = "myName";
SerializableParameter parameter = new QueryParameter();
parameter.setName("myName");
parameter.setAllowEmptyValue(false);
MultiMap params = MultiMap.caseInsensitiveMultiMap();
params.add(name, "");
abstractSerializableParameterExtractor.extract(name, parameter, params);
}
示例14: testNullAllowEmptyValueWithEmptyParameter
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testNullAllowEmptyValueWithEmptyParameter() {
String name = "myName";
SerializableParameter parameter = new QueryParameter();
parameter.setName("myName");
MultiMap params = MultiMap.caseInsensitiveMultiMap();
params.add(name, "");
abstractSerializableParameterExtractor.extract(name, parameter, params);
}
示例15: testArray
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Test()
public void testArray() {
String name = "myName";
SerializableParameter parameter = new QueryParameter();
parameter.setName("myName");
parameter.setType("array");
parameter.setCollectionFormat(null);
String param = "toto,tutu,titi";
MultiMap params = MultiMap.caseInsensitiveMultiMap();
params.add(name, param);
Object result = abstractSerializableParameterExtractor.extract(name, parameter, params);
Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" },
((List) result).toArray());
}