当前位置: 首页>>代码示例>>Java>>正文


Java MultiMap.add方法代码示例

本文整理汇总了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());
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:18,代码来源:AbstractSerializableParameterExtractorTest.java

示例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;

}
 
开发者ID:gentics,项目名称:mesh,代码行数:17,代码来源:ImageManipulationParametersTest.java

示例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"));
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:41,代码来源:TestDefaultHttpClientFilter.java

示例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;
}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:10,代码来源:CometD.java

示例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);
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:12,代码来源:AbstractSerializableParameterExtractorTest.java

示例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);
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:11,代码来源:AbstractSerializableParameterExtractorTest.java

示例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());
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:16,代码来源:AbstractSerializableParameterExtractorTest.java


注:本文中的io.vertx.core.MultiMap.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。