Search in sources :

Example 1 with AgentUriStatService

use of com.navercorp.pinpoint.collector.service.AgentUriStatService in project pinpoint by naver.

the class GrpcAgentUriStatHandlerV2Test method throwExceptionTest.

@Test(expected = StatusRuntimeException.class)
public void throwExceptionTest() {
    AgentUriStatService mockAgentUriStatService = Mockito.mock(AgentUriStatService.class);
    ServerRequest<GeneratedMessageV3> mockServerRequest = Mockito.mock(ServerRequest.class);
    GrpcAgentStatHandlerV2 handler = createMockHandler(mockAgentUriStatService, false);
    handler.handleSimple(mockServerRequest);
}
Also used : AgentUriStatService(com.navercorp.pinpoint.collector.service.AgentUriStatService) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 2 with AgentUriStatService

use of com.navercorp.pinpoint.collector.service.AgentUriStatService in project pinpoint by naver.

the class GrpcAgentUriStatHandlerV2Test method skipTest.

@Test
public void skipTest() {
    AgentUriStatService mockAgentUriStatService = Mockito.mock(AgentUriStatService.class);
    ServerRequest<GeneratedMessageV3> mockServerRequest = Mockito.mock(ServerRequest.class);
    Mockito.when(mockServerRequest.getData()).thenReturn(PAgentUriStat.getDefaultInstance());
    GrpcAgentStatHandlerV2 handler = createMockHandler(mockAgentUriStatService, false);
    handler.handleSimple(mockServerRequest);
    Mockito.verify(mockAgentUriStatService, times(0)).save(Mockito.any());
}
Also used : AgentUriStatService(com.navercorp.pinpoint.collector.service.AgentUriStatService) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 3 with AgentUriStatService

use of com.navercorp.pinpoint.collector.service.AgentUriStatService in project pinpoint by naver.

the class GrpcAgentUriStatHandlerV2Test method handleTest.

@Test
public void handleTest() {
    AgentUriStatService mockAgentUriStatService = Mockito.mock(AgentUriStatService.class);
    attachContext(new Header("name", "agentId", "agentName", "applicationName", ServiceType.UNKNOWN.getCode(), System.currentTimeMillis(), Header.SOCKET_ID_NOT_EXIST, new ArrayList<>()));
    PAgentUriStat pAgentUriStat = createPAgentUriStat();
    ServerRequest<GeneratedMessageV3> mockServerRequest = Mockito.mock(ServerRequest.class);
    Mockito.when(mockServerRequest.getData()).thenReturn(pAgentUriStat);
    GrpcAgentStatHandlerV2 handler = createMockHandler(mockAgentUriStatService, true);
    handler.handleSimple(mockServerRequest);
    Mockito.verify(mockAgentUriStatService, times(1)).save(Mockito.any());
}
Also used : Header(com.navercorp.pinpoint.grpc.Header) AgentUriStatService(com.navercorp.pinpoint.collector.service.AgentUriStatService) ArrayList(java.util.ArrayList) PAgentUriStat(com.navercorp.pinpoint.grpc.trace.PAgentUriStat) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Aggregations

GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)3 AgentUriStatService (com.navercorp.pinpoint.collector.service.AgentUriStatService)3 Test (org.junit.Test)3 Header (com.navercorp.pinpoint.grpc.Header)1 PAgentUriStat (com.navercorp.pinpoint.grpc.trace.PAgentUriStat)1 ArrayList (java.util.ArrayList)1