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);
}
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());
}
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());
}
Aggregations