use of com.navercorp.pinpoint.web.vo.stat.SampledDataSource in project pinpoint by naver.
the class DataSourceChartGroupTest method basicFunctionTest1.
@Test
public void basicFunctionTest1() {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = createSampledDataSourceList(timeWindow);
StatChartGroup dataSourceChartGroup = DataSourceChart.newDataSourceChartGroup(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
assertEquals(sampledDataSourceList, dataSourceChartGroup);
}
use of com.navercorp.pinpoint.web.vo.stat.SampledDataSource in project pinpoint by naver.
the class DataSourceChartGroupTest method basicFunctionTest2.
@Test
public void basicFunctionTest2() {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = Collections.emptyList();
DataSourceChart dataSourceChartGroup = new DataSourceChart(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
Assert.assertEquals(-1, dataSourceChartGroup.getId());
Assert.assertEquals(null, dataSourceChartGroup.getJdbcUrl());
Assert.assertEquals(null, dataSourceChartGroup.getDatabaseName());
Assert.assertEquals(null, dataSourceChartGroup.getServiceType());
Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = dataSourceChartGroup.getCharts().getCharts();
Assert.assertEquals(2, charts.size());
for (Chart<? extends Point> chart : charts.values()) {
Assert.assertTrue(CollectionUtils.isEmpty(chart.getPoints()));
}
}
use of com.navercorp.pinpoint.web.vo.stat.SampledDataSource in project pinpoint by naver.
the class DataSourceChart method newDataSourceChartGroup.
@VisibleForTesting
static DataSourceChartGroup newDataSourceChartGroup(TimeWindow timeWindow, List<SampledDataSource> sampledDataSources, ServiceTypeRegistryService serviceTypeRegistryService) {
Objects.requireNonNull(timeWindow, "timeWindow");
Map<StatChartGroup.ChartType, Chart<? extends Point>> chartTypeChartMap = newDatasourceChart(timeWindow, sampledDataSources);
if (CollectionUtils.isEmpty(sampledDataSources)) {
final Integer uncollectedValue = SampledDataSource.UNCOLLECTED_VALUE;
// TODO avoid null
final String uncollectedString = SampledDataSource.UNCOLLECTED_STRING;
return new DataSourceChartGroup(timeWindow, chartTypeChartMap, uncollectedValue, uncollectedString, uncollectedString, uncollectedString);
} else {
SampledDataSource latestSampledDataSource = CollectionUtils.lastElement(sampledDataSources);
int id = latestSampledDataSource.getId();
String serviceTypeName = serviceTypeRegistryService.findServiceType(latestSampledDataSource.getServiceTypeCode()).getName();
String databaseName = latestSampledDataSource.getDatabaseName();
String jdbcUrl = latestSampledDataSource.getJdbcUrl();
return new DataSourceChartGroup(timeWindow, chartTypeChartMap, id, serviceTypeName, databaseName, jdbcUrl);
}
}
use of com.navercorp.pinpoint.web.vo.stat.SampledDataSource in project pinpoint by naver.
the class DataSourceSamplerTest method sampleDataPointsTest1.
@Test
public void sampleDataPointsTest1() {
int testObjectSize = RandomUtils.nextInt(1, CREATE_TEST_OBJECT_MAX_SIZE);
int maxConnectionSize = RandomUtils.nextInt(MIN_VALUE_OF_MAX_CONNECTION_SIZE, MIN_VALUE_OF_MAX_CONNECTION_SIZE * 2);
List<DataSourceBo> dataSourceBoList = DataSourceTestUtils.createDataSourceBoList(1, testObjectSize, maxConnectionSize);
SampledDataSource sampledDataSource = sampler.sampleDataPoints(0, System.currentTimeMillis(), dataSourceBoList, null);
assertEquals(sampledDataSource, dataSourceBoList);
}
Aggregations