use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.
the class AgentStatusTimelineTest method multipleLifeCycles_overlap2.
@Test
public void multipleLifeCycles_overlap2() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
// When
long agentA = 0;
long agentB = 160;
AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 160, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN), createAgentEvent(agentB, 160, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentB, 180, AgentEventType.AGENT_PING))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertTrue(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.
the class AgentStatusTimelineTest method multipleLifeCycles_noOverlap2.
@Test
public void multipleLifeCycles_noOverlap2() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 159, AgentState.RUNNING), createSegment(159, 160, AgentState.SHUTDOWN), createSegment(160, 200, AgentState.RUNNING));
// When
long agentA = 0;
long agentB = 160;
AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 159, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN), createAgentEvent(agentB, 160, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentB, 180, AgentEventType.AGENT_PING))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertFalse(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.
the class AgentStatusTimelineTest method createAgentStatus.
private AgentStatus createAgentStatus(long timestamp, AgentLifeCycleState state) {
AgentStatus agentStatus = new AgentStatus("testAgent");
agentStatus.setEventTimestamp(timestamp);
agentStatus.setState(state);
return agentStatus;
}
use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.
the class AgentStatusTimelineTest method multipleLifeCycles_noOverlap.
@Test
public void multipleLifeCycles_noOverlap() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 140, AgentState.RUNNING), createSegment(140, 160, AgentState.SHUTDOWN), createSegment(160, 200, AgentState.RUNNING));
// When
long agentA = 0;
long agentB = 160;
AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 140, AgentEventType.AGENT_UNEXPECTED_SHUTDOWN), createAgentEvent(agentB, 160, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentB, 180, AgentEventType.AGENT_PING))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertFalse(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.AgentStatus in project pinpoint by naver.
the class AgentStatusTimelineTest method singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateRunning.
@Test
public void singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateRunning() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 150, AgentState.RUNNING), createSegment(150, 200, AgentState.RUNNING));
// When
long agentA = 150;
AgentStatus initialStatus = createAgentStatus(50, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 150, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentA, 180, AgentEventType.AGENT_PING))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertTrue(timeline.isIncludeWarning());
}
Aggregations