use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentEventTimelineTest method leftBiasedSpread.
@Test
public void leftBiasedSpread() {
// Given
Range range = new Range(100, 200);
AgentEvent event1 = createAgentEvent(0, AgentEventType.AGENT_CONNECTED);
AgentEvent event2 = createAgentEvent(5, AgentEventType.AGENT_PING);
AgentEvent event3 = createAgentEvent(50, AgentEventType.AGENT_PING);
AgentEvent event4 = createAgentEvent(100, AgentEventType.AGENT_PING);
AgentEvent event5 = createAgentEvent(150, AgentEventType.AGENT_PING);
AgentEvent event6 = createAgentEvent(220, AgentEventType.AGENT_SHUTDOWN);
List<AgentEventTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 101, Arrays.asList(event1, event2, event3, event4)), createSegment(150, 151, Collections.singletonList(event5)), createSegment(199, 200, Collections.singletonList(event6)));
// When
AgentEventTimeline timeline = new AgentEventTimelineBuilder(range, 100).from(Arrays.asList(event1, event2, event3, event4, event5, event6)).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentStatusTimelineTest method nullAgentStatus_nullAgentEvents.
@Test
public void nullAgentStatus_nullAgentEvents() {
// Given
Range timelineRange = new Range(0, 100);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(0, 100, AgentState.UNKNOWN));
// When
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, null).from(null).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertFalse(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentStatusTimelineTest method singleLifeCycle_endedBeforeTimelineEndTimestamp.
@Test
public void singleLifeCycle_endedBeforeTimelineEndTimestamp() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 180, AgentState.RUNNING), createSegment(180, 200, AgentState.SHUTDOWN));
// When
long agentA = 0;
AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentA, 150, AgentEventType.AGENT_PING), createAgentEvent(agentA, 180, AgentEventType.AGENT_SHUTDOWN))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertFalse(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentStatusTimelineTest method singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateShutdown.
@Test
public void singleLifeCycle_startedAfterTimelineStartTimestamp_initialStateShutdown() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Arrays.asList(createSegment(100, 150, AgentState.SHUTDOWN), createSegment(150, 200, AgentState.RUNNING));
// When
long agentA = 150;
AgentStatus initialStatus = createAgentStatus(50, AgentLifeCycleState.SHUTDOWN);
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.assertFalse(timeline.isIncludeWarning());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentStatusTimelineTest method multipleLifeCycles_overlap3.
@Test
public void multipleLifeCycles_overlap3() {
// Given
Range timelineRange = new Range(100, 200);
List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
// When
long agentA = 80;
long agentB = 90;
long agentC = 110;
AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentB, 130, AgentEventType.AGENT_PING), createAgentEvent(agentC, 140, AgentEventType.AGENT_PING), createAgentEvent(agentA, 150, AgentEventType.AGENT_PING), createAgentEvent(agentB, 170, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentA, 180, AgentEventType.AGENT_PING), createAgentEvent(agentC, 190, AgentEventType.AGENT_SHUTDOWN))).build();
// Then
Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
Assert.assertTrue(timeline.isIncludeWarning());
}
Aggregations