Search in sources :

Example 46 with Invocation

use of org.apache.servicecomb.core.Invocation in project java-chassis by ServiceComb.

the class UrlPathItemTest method initStrBuilder.

@Before
public void initStrBuilder() {
    accessLogEvent = new ServerAccessLogEvent();
    routingContext = Mockito.mock(RoutingContext.class);
    finishEvent = Mockito.mock(InvocationFinishEvent.class);
    invocation = Mockito.mock(Invocation.class);
    serverRequest = Mockito.mock(HttpServerRequest.class);
    operationMeta = Mockito.mock(OperationMeta.class);
    schemaMeta = Mockito.mock(SchemaMeta.class);
    swagger = Mockito.mock(Swagger.class);
    restClientRequest = Mockito.mock(RestClientRequestImpl.class);
    clientRequest = Mockito.mock(HttpClientRequest.class);
    accessLogEvent.setRoutingContext(routingContext);
    strBuilder = new StringBuilder();
}
Also used : 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) Invocation(org.apache.servicecomb.core.Invocation) HttpServerRequest(io.vertx.core.http.HttpServerRequest) SchemaMeta(org.apache.servicecomb.core.definition.SchemaMeta) Swagger(io.swagger.models.Swagger) RestClientRequestImpl(org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta) Before(org.junit.Before)

Example 47 with Invocation

use of org.apache.servicecomb.core.Invocation in project java-chassis by ServiceComb.

the class UrlPathWithQueryAccessItem method appendClientFormattedItem.

@Override
public void appendClientFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
    Invocation invocation = finishEvent.getInvocation();
    if (null == invocation || null == invocation.getLocalContext(REST_CLIENT_REQUEST_PATH) || StringUtils.isEmpty(invocation.getLocalContext(REST_CLIENT_REQUEST_PATH).toString())) {
        builder.append(EMPTY_RESULT);
        return;
    }
    builder.append(invocation.getLocalContext(REST_CLIENT_REQUEST_PATH).toString());
}
Also used : Invocation(org.apache.servicecomb.core.Invocation)

Example 48 with Invocation

use of org.apache.servicecomb.core.Invocation in project java-chassis by ServiceComb.

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 49 with Invocation

use of org.apache.servicecomb.core.Invocation in project java-chassis by ServiceComb.

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 50 with Invocation

use of org.apache.servicecomb.core.Invocation in project java-chassis by ServiceComb.

the class TestServiceCombServerStats method testGlobalAllowIsolatedServerTryingFlag_apply_with_null_precondition.

@Test
public void testGlobalAllowIsolatedServerTryingFlag_apply_with_null_precondition() {
    Invocation invocation = new Invocation();
    Assert.assertTrue(ServiceCombServerStats.applyForTryingChance(invocation));
    Assert.assertSame(invocation, ServiceCombServerStats.globalAllowIsolatedServerTryingFlag.get().getInvocation());
}
Also used : Invocation(org.apache.servicecomb.core.Invocation) Test(org.junit.Test)

Aggregations

Invocation (org.apache.servicecomb.core.Invocation)204 Test (org.junit.Test)125 OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)52 ArrayList (java.util.ArrayList)39 HashMap (java.util.HashMap)37 Response (org.apache.servicecomb.swagger.invocation.Response)37 Before (org.junit.Before)29 MockUp (mockit.MockUp)26 AsyncResponse (org.apache.servicecomb.swagger.invocation.AsyncResponse)23 Expectations (mockit.Expectations)20 InvocationFinishEvent (org.apache.servicecomb.core.event.InvocationFinishEvent)20 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)19 HystrixCommandProperties (com.netflix.hystrix.HystrixCommandProperties)18 Transport (org.apache.servicecomb.core.Transport)18 RoutingContext (io.vertx.ext.web.RoutingContext)17 Map (java.util.Map)17 ServerAccessLogEvent (org.apache.servicecomb.core.event.ServerAccessLogEvent)17 List (java.util.List)16 Endpoint (org.apache.servicecomb.core.Endpoint)16 InvocationException (org.apache.servicecomb.swagger.invocation.exception.InvocationException)15