Search in sources :

Example 1 with ParsedHeaderValues

use of io.vertx.ext.web.ParsedHeaderValues in project hono by eclipse.

the class AbstractVertxBasedHttpProtocolAdapterTest method newHttpContext.

private HttpContext newHttpContext(final Buffer payload, final String contentType, final HttpServerRequest request, final HttpServerResponse response) {
    when(response.setStatusCode(anyInt())).thenReturn(response);
    when(response.closed()).thenReturn(false);
    final RoutingContext ctx = mock(RoutingContext.class);
    when(ctx.getBody()).thenReturn(payload);
    when(ctx.response()).thenReturn(response);
    when(ctx.request()).thenReturn(request);
    when(ctx.get(TracingHandler.CURRENT_SPAN)).thenReturn(mock(Span.class));
    when(ctx.vertx()).thenReturn(vertx);
    when(ctx.get(CommandContext.KEY_COMMAND_CONTEXT)).thenReturn(null);
    when(ctx.get(MetricsTags.TtdStatus.class.getName())).thenReturn(MetricsTags.TtdStatus.NONE);
    if (contentType != null) {
        final MIMEHeader headerContentType = mock(MIMEHeader.class);
        when(headerContentType.value()).thenReturn(contentType);
        final ParsedHeaderValues headers = mock(ParsedHeaderValues.class);
        when(headers.contentType()).thenReturn(headerContentType);
        when(ctx.parsedHeaders()).thenReturn(headers);
    }
    return HttpContext.from(ctx);
}
Also used : ParsedHeaderValues(io.vertx.ext.web.ParsedHeaderValues) RoutingContext(io.vertx.ext.web.RoutingContext) TtdStatus(org.eclipse.hono.service.metric.MetricsTags.TtdStatus) Span(io.opentracing.Span) MIMEHeader(io.vertx.ext.web.MIMEHeader)

Aggregations

Span (io.opentracing.Span)1 MIMEHeader (io.vertx.ext.web.MIMEHeader)1 ParsedHeaderValues (io.vertx.ext.web.ParsedHeaderValues)1 RoutingContext (io.vertx.ext.web.RoutingContext)1 TtdStatus (org.eclipse.hono.service.metric.MetricsTags.TtdStatus)1