Search in sources :

Example 11 with HeadersMultiMap

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

the class VertxHttpHeadersTest method testContainsValue3.

@Test
public void testContainsValue3() {
    HeadersMultiMap mmap = newMultiMap();
    mmap.add("foo", "val1,,val3");
    assertTrue(mmap.containsValue("foo", "val1", true));
    assertFalse(mmap.containsValue("foo", "val2", true));
    assertTrue(mmap.containsValue("foo", "val3", true));
    assertFalse(mmap.containsValue("foo", "val4", true));
    assertFalse(mmap.containsValue("foo", "helloworld", true));
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 12 with HeadersMultiMap

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

the class VertxHttpHeadersTest method testContainsValue4.

@Test
public void testContainsValue4() {
    HeadersMultiMap mmap = newMultiMap();
    mmap.add("foo", "val1, ,val3");
    assertTrue(mmap.containsValue("foo", "val1", true));
    assertFalse(mmap.containsValue("foo", "val2", true));
    assertTrue(mmap.containsValue("foo", "val3", true));
    assertFalse(mmap.containsValue("foo", "val4", true));
    assertFalse(mmap.containsValue("foo", "helloworld", true));
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 13 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project java-chassis by ServiceComb.

the class RequestHeaderItemTest method serverFormattedElementIfNotFound.

@Test
public void serverFormattedElementIfNotFound() {
    HeadersMultiMap headers = new HeadersMultiMap();
    String testValue = "testValue";
    headers.add("anotherKey", testValue);
    when(routingContext.request()).thenReturn(serverRequest);
    when(serverRequest.headers()).thenReturn(headers);
    ELEMENT.appendServerFormattedItem(accessLogEvent, strBuilder);
    assertEquals("-", strBuilder.toString());
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 14 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project java-chassis by ServiceComb.

the class RequestHeaderItemTest method serverFormattedElement.

@Test
public void serverFormattedElement() {
    HeadersMultiMap headers = new HeadersMultiMap();
    String testValue = "testValue";
    headers.add(VAR_NAME, testValue);
    when(routingContext.request()).thenReturn(serverRequest);
    when(serverRequest.headers()).thenReturn(headers);
    ELEMENT.appendServerFormattedItem(accessLogEvent, strBuilder);
    assertEquals(testValue, strBuilder.toString());
    assertEquals(ELEMENT.getVarName(), VAR_NAME);
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Example 15 with HeadersMultiMap

use of io.vertx.core.http.impl.headers.HeadersMultiMap in project java-chassis by ServiceComb.

the class ResponseHeaderItemTest method serverFormattedElement.

@Test
public void serverFormattedElement() {
    HeadersMultiMap headers = new HeadersMultiMap();
    String headerValue = "headerValue";
    headers.add(VAR_NAME, headerValue);
    when(routingContext.response()).thenReturn(serverResponse);
    when(serverResponse.headers()).thenReturn(headers);
    ELEMENT.appendServerFormattedItem(accessLogEvent, strBuilder);
    assertEquals(headerValue, strBuilder.toString());
    assertEquals(ELEMENT.getVarName(), VAR_NAME);
}
Also used : HeadersMultiMap(io.vertx.core.http.impl.headers.HeadersMultiMap) Test(org.junit.Test)

Aggregations

HeadersMultiMap (io.vertx.core.http.impl.headers.HeadersMultiMap)16 Test (org.junit.Test)13 ByteBuf (io.netty.buffer.ByteBuf)1 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 CompositeByteBuf (io.netty.buffer.CompositeByteBuf)1 Unpooled (io.netty.buffer.Unpooled)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 SimpleChannelInboundHandler (io.netty.channel.SimpleChannelInboundHandler)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 DefaultFullHttpResponse (io.netty.handler.codec.http.DefaultFullHttpResponse)1 FullHttpResponse (io.netty.handler.codec.http.FullHttpResponse)1 HttpHeaderNames (io.netty.handler.codec.http.HttpHeaderNames)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 HttpRequest (io.netty.handler.codec.http.HttpRequest)1 HttpRequestDecoder (io.netty.handler.codec.http.HttpRequestDecoder)1 HttpResponseEncoder (io.netty.handler.codec.http.HttpResponseEncoder)1 HttpResponseStatus (io.netty.handler.codec.http.HttpResponseStatus)1 HttpVersion (io.netty.handler.codec.http.HttpVersion)1 AsciiString (io.netty.util.AsciiString)1 CharsetUtil (io.netty.util.CharsetUtil)1