Search in sources :

Example 41 with ServerAccessLogEvent

use of org.apache.servicecomb.core.event.ServerAccessLogEvent in project incubator-servicecomb-java-chassis by apache.

the class DatetimeConfigurableItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    invocation = Mockito.mock(Invocation.class);
    invocationStageTrace = Mockito.mock(InvocationStageTrace.class);
    when(finishEvent.getInvocation()).thenReturn(invocation);
    when(invocation.getInvocationStageTrace()).thenReturn(invocationStageTrace);
    when(invocationStageTrace.getStartSend()).thenReturn(0L);
    when(invocationStageTrace.getStart()).thenReturn(0L);
    when(invocationStageTrace.getStartTimeMillis()).thenReturn(START_MILLISECOND);
    accessLogEvent = new ServerAccessLogEvent();
    accessLogEvent.setMilliStartTime(START_MILLISECOND);
    strBuilder = new StringBuilder();
}
Also used : InvocationFinishEvent(org.apache.servicecomb.core.event.InvocationFinishEvent) ServerAccessLogEvent(org.apache.servicecomb.core.event.ServerAccessLogEvent) Invocation(org.apache.servicecomb.core.Invocation) InvocationStageTrace(org.apache.servicecomb.core.invocation.InvocationStageTrace) Before(org.junit.Before)

Example 42 with ServerAccessLogEvent

use of org.apache.servicecomb.core.event.ServerAccessLogEvent in project incubator-servicecomb-java-chassis by apache.

the class CookieItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    mockContext = Mockito.mock(RoutingContext.class);
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    invocation = Mockito.mock(Invocation.class);
    restClientRequest = Mockito.mock(RestClientRequestImpl.class);
    accessLogEvent = new ServerAccessLogEvent();
    strBuilder = new StringBuilder();
}
Also used : RoutingContext(io.vertx.ext.web.RoutingContext) InvocationFinishEvent(org.apache.servicecomb.core.event.InvocationFinishEvent) ServerAccessLogEvent(org.apache.servicecomb.core.event.ServerAccessLogEvent) Invocation(org.apache.servicecomb.core.Invocation) RestClientRequestImpl(org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl) Before(org.junit.Before)

Example 43 with ServerAccessLogEvent

use of org.apache.servicecomb.core.event.ServerAccessLogEvent in project incubator-servicecomb-java-chassis by apache.

the class DurationMillisecondItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    invocation = Mockito.mock(Invocation.class);
    invocationStageTrace = Mockito.mock(InvocationStageTrace.class);
    when(finishEvent.getInvocation()).thenReturn(invocation);
    when(invocation.getInvocationStageTrace()).thenReturn(invocationStageTrace);
    when(invocationStageTrace.getStartSend()).thenReturn(0L);
    when(invocationStageTrace.getFinish()).thenReturn(1000_000L);
    accessLogEvent = new ServerAccessLogEvent();
    accessLogEvent.setMilliStartTime(1L);
    accessLogEvent.setMilliEndTime(2L);
    strBuilder = new StringBuilder();
}
Also used : InvocationFinishEvent(org.apache.servicecomb.core.event.InvocationFinishEvent) ServerAccessLogEvent(org.apache.servicecomb.core.event.ServerAccessLogEvent) Invocation(org.apache.servicecomb.core.Invocation) InvocationStageTrace(org.apache.servicecomb.core.invocation.InvocationStageTrace) Before(org.junit.Before)

Example 44 with ServerAccessLogEvent

use of org.apache.servicecomb.core.event.ServerAccessLogEvent in project incubator-servicecomb-java-chassis by apache.

the class FirstLineOfRequestItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    mockContext = Mockito.mock(RoutingContext.class);
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    invocation = Mockito.mock(Invocation.class);
    restClientRequest = Mockito.mock(RestClientRequestImpl.class);
    clientRequest = Mockito.mock(HttpClientRequest.class);
    endpoint = Mockito.mock(Endpoint.class);
    urlEndpoint = Mockito.mock(URIEndpointObject.class);
    Map<String, Object> handlerMap = new HashMap<>();
    handlerMap.put(RestConst.INVOCATION_HANDLER_REQUESTCLIENT, restClientRequest);
    when(finishEvent.getInvocation()).thenReturn(invocation);
    when(invocation.getHandlerContext()).thenReturn(handlerMap);
    when(restClientRequest.getRequest()).thenReturn(clientRequest);
    when(invocation.getEndpoint()).thenReturn(endpoint);
    when(endpoint.getAddress()).thenReturn(urlEndpoint);
    accessLogEvent = new ServerAccessLogEvent();
    accessLogEvent.setRoutingContext(mockContext);
    strBuilder = new StringBuilder();
}
Also used : Invocation(org.apache.servicecomb.core.Invocation) HashMap(java.util.HashMap) RestClientRequestImpl(org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl) RoutingContext(io.vertx.ext.web.RoutingContext) HttpClientRequest(io.vertx.core.http.HttpClientRequest) InvocationFinishEvent(org.apache.servicecomb.core.event.InvocationFinishEvent) ServerAccessLogEvent(org.apache.servicecomb.core.event.ServerAccessLogEvent) Endpoint(org.apache.servicecomb.core.Endpoint) URIEndpointObject(org.apache.servicecomb.foundation.common.net.URIEndpointObject) URIEndpointObject(org.apache.servicecomb.foundation.common.net.URIEndpointObject) Before(org.junit.Before)

Example 45 with ServerAccessLogEvent

use of org.apache.servicecomb.core.event.ServerAccessLogEvent in project incubator-servicecomb-java-chassis by apache.

the class LocalHostItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    accessLogEvent = new ServerAccessLogEvent();
    routingContext = Mockito.mock(RoutingContext.class);
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    serverRequest = Mockito.mock(HttpServerRequest.class);
    socketAddress = Mockito.mock(SocketAddress.class);
    invocation = Mockito.mock(Invocation.class);
    restClientRequest = Mockito.mock(RestClientRequestImpl.class);
    clientRequest = Mockito.mock(HttpClientRequest.class);
    connection = Mockito.mock(HttpConnection.class);
    Map<String, Object> handlerMap = new HashMap<>();
    handlerMap.put(RestConst.INVOCATION_HANDLER_REQUESTCLIENT, restClientRequest);
    when(finishEvent.getInvocation()).thenReturn(invocation);
    when(invocation.getHandlerContext()).thenReturn(handlerMap);
    accessLogEvent.setRoutingContext(routingContext);
    strBuilder = new StringBuilder();
}
Also used : Invocation(org.apache.servicecomb.core.Invocation) HttpConnection(io.vertx.core.http.HttpConnection) HashMap(java.util.HashMap) HttpServerRequest(io.vertx.core.http.HttpServerRequest) RestClientRequestImpl(org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl) RoutingContext(io.vertx.ext.web.RoutingContext) HttpClientRequest(io.vertx.core.http.HttpClientRequest) ServerAccessLogEvent(org.apache.servicecomb.core.event.ServerAccessLogEvent) InvocationFinishEvent(org.apache.servicecomb.core.event.InvocationFinishEvent) SocketAddress(io.vertx.core.net.SocketAddress) Before(org.junit.Before)

Aggregations

ServerAccessLogEvent (org.apache.servicecomb.core.event.ServerAccessLogEvent)48 Before (org.junit.Before)44 InvocationFinishEvent (org.apache.servicecomb.core.event.InvocationFinishEvent)42 RoutingContext (io.vertx.ext.web.RoutingContext)36 Invocation (org.apache.servicecomb.core.Invocation)34 HttpServerRequest (io.vertx.core.http.HttpServerRequest)20 RestClientRequestImpl (org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl)16 HttpClientRequest (io.vertx.core.http.HttpClientRequest)14 Endpoint (org.apache.servicecomb.core.Endpoint)10 HashMap (java.util.HashMap)8 URIEndpointObject (org.apache.servicecomb.foundation.common.net.URIEndpointObject)8 HttpServerResponse (io.vertx.core.http.HttpServerResponse)6 SocketAddress (io.vertx.core.net.SocketAddress)6 InvocationStageTrace (org.apache.servicecomb.core.invocation.InvocationStageTrace)6 HttpConnection (io.vertx.core.http.HttpConnection)4 Response (org.apache.servicecomb.swagger.invocation.Response)4 Swagger (io.swagger.models.Swagger)2 MultiMap (io.vertx.core.MultiMap)2 HeadersMultiMap (io.vertx.core.http.impl.headers.HeadersMultiMap)2 SimpleDateFormat (java.text.SimpleDateFormat)2