use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class BFSLinkSelectorTest method testCaller_3tier.
@Test
public void testCaller_3tier() throws Exception {
// APP_A -> APP_B -> APP_C
int callCount_A_B = 10;
LinkDataMap link_A_B = new LinkDataMap();
link_A_B.addLinkData(APP_A, "agentA", APP_B, "agentB", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_A_B);
when(callerDao.selectCaller(eq(APP_A), any(Range.class))).thenReturn(link_A_B);
LinkDataMap link_B_C = new LinkDataMap();
int callCount_B_C = 20;
link_B_C.addLinkData(APP_B, "agentB", APP_C, "agentC", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_B_C);
when(callerDao.selectCaller(eq(APP_B), any(Range.class))).thenReturn(link_B_C);
when(calleeDao.selectCallee(any(Application.class), any(Range.class))).thenReturn(newEmptyLinkDataMap());
when(hostApplicationMapDao.findAcceptApplicationName(any(Application.class), any(Range.class))).thenReturn(new HashSet<AcceptApplication>());
// depth 1
LinkSelector linkSelector = createLinkSelector();
LinkDataDuplexMap linkData = linkSelector.select(APP_A, range, oneDepth);
Assert.assertEquals(linkData.size(), 1);
Assert.assertEquals(linkData.getTotalCount(), callCount_A_B);
Assert.assertEquals(linkData.getSourceLinkDataList().size(), 1);
Assert.assertEquals(linkData.getSourceLinkDataMap().getTotalCount(), callCount_A_B);
assertSource_Target_TotalCount("APP_A->APP_B", linkData, new LinkKey(APP_A, APP_B), callCount_A_B);
Assert.assertEquals(linkData.getTargetLinkDataList().size(), 0);
// depth 2
LinkSelector linkSelector2 = createLinkSelector();
LinkDataDuplexMap linkData_depth2 = linkSelector2.select(APP_A, range, twoDepth);
Assert.assertEquals(linkData_depth2.size(), 2);
Assert.assertEquals(linkData_depth2.getTotalCount(), callCount_A_B + callCount_B_C);
LinkKey linkKey_A_B = new LinkKey(APP_A, APP_B);
assertSource_Target_TotalCount("APP_A->APP_B", linkData_depth2, linkKey_A_B, callCount_A_B);
LinkKey linkKey_B_C = new LinkKey(APP_B, APP_C);
assertSource_Target_TotalCount("APP_B->APP_C", linkData_depth2, linkKey_B_C, callCount_B_C);
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class DateLimiterTest method checkRange.
@Test
public void checkRange() {
Limiter limiter = new DateLimiter(2);
limiter.limit(new Range(0, TimeUnit.DAYS.toMillis(2)));
long time = 1000;
limiter.limit(new Range(time, time + TimeUnit.DAYS.toMillis(2)));
limiter.limit(new Range(TimeUnit.DAYS.toMillis(2), TimeUnit.DAYS.toMillis(2)));
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_5_seconds.
@Test
public void getWindowSizeFor_5_seconds() {
// Given
final long from = START_TIME_STAMP;
final long to = START_TIME_STAMP + (5 * ONE_SECOND);
final Range range = new Range(from, to);
// When
final long idealWindowSize = sampler.getWindowSize(range);
// Then
assertWindowSizeIsIdeal(from, to, idealWindowSize);
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_6_hours.
@Test
public void getWindowSizeFor_6_hours() {
// Given
final long from = START_TIME_STAMP;
final long to = START_TIME_STAMP + (6 * ONE_HOUR);
final Range range = new Range(from, to);
// When
final long idealWindowSize = sampler.getWindowSize(range);
// Then
assertWindowSizeIsIdeal(from, to, idealWindowSize);
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class TimeWindowSlotCentricSamplerTest method getWindowSizeFor_1_day.
@Test
public void getWindowSizeFor_1_day() {
// Given
final long from = START_TIME_STAMP;
final long to = START_TIME_STAMP + ONE_DAY;
final Range range = new Range(from, to);
// When
final long idealWindowSize = sampler.getWindowSize(range);
// Then
assertWindowSizeIsIdeal(from, to, idealWindowSize);
}
Aggregations