當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。