Search in sources :

Example 1 with Http2HeadersAdaptor

use of io.vertx.core.http.impl.headers.Http2HeadersAdaptor in project vert.x by eclipse.

the class HeadersTestBase method testSetAllOnExistingMapUsingMultiMapHttp2.

@Test
public void testSetAllOnExistingMapUsingMultiMapHttp2() {
    MultiMap mainMap = new Http2HeadersAdaptor(new DefaultHttp2Headers());
    mainMap.add("originalKey", "originalValue");
    MultiMap setAllMap = newMultiMap();
    setAllMap.add("originalKey", "newValue");
    setAllMap.add("anotherKey", "anotherValue");
    MultiMap result = mainMap.setAll(setAllMap);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    assertEquals(2, result.size());
    assertEquals("newValue", result.get("originalKey"));
    assertEquals("anotherValue", result.get("anotherKey"));
}
Also used : MultiMap(io.vertx.core.MultiMap) HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Http2HeadersAdaptor(io.vertx.core.http.impl.headers.Http2HeadersAdaptor) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) Test(org.junit.Test)

Example 2 with Http2HeadersAdaptor

use of io.vertx.core.http.impl.headers.Http2HeadersAdaptor in project vert.x by eclipse.

the class HeadersTestBase method testSetAllOnExistingMapUsingHashMapHttp2.

@Test
public void testSetAllOnExistingMapUsingHashMapHttp2() {
    MultiMap mainMap = new Http2HeadersAdaptor(new DefaultHttp2Headers());
    mainMap.add("originalKey", "originalValue");
    Map<String, String> setAllMap = new HashMap<>();
    setAllMap.put("originalKey", "newValue");
    setAllMap.put("anotherKey", "anotherValue");
    MultiMap result = mainMap.setAll(setAllMap);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    assertEquals(2, result.size());
    assertEquals("newValue", result.get("originalKey"));
    assertEquals("anotherValue", result.get("anotherKey"));
}
Also used : MultiMap(io.vertx.core.MultiMap) HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) HashMap(java.util.HashMap) Http2HeadersAdaptor(io.vertx.core.http.impl.headers.Http2HeadersAdaptor) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) Test(org.junit.Test)

Example 3 with Http2HeadersAdaptor

use of io.vertx.core.http.impl.headers.Http2HeadersAdaptor in project vert.x by eclipse.

the class Http2HeadersAdaptorsTest method setUp.

@Before
public void setUp() {
    headers = new DefaultHttp2Headers();
    map = new Http2HeadersAdaptor(headers);
}
Also used : DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) Http2HeadersAdaptor(io.vertx.core.http.impl.headers.Http2HeadersAdaptor) Before(org.junit.Before)

Aggregations

DefaultHttp2Headers (io.netty.handler.codec.http2.DefaultHttp2Headers)3 Http2HeadersAdaptor (io.vertx.core.http.impl.headers.Http2HeadersAdaptor)3 MultiMap (io.vertx.core.MultiMap)2 HeadersMultiMap (io.vertx.core.http.impl.headers.HeadersMultiMap)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 Before (org.junit.Before)1