use of com.navercorp.pinpoint.web.vo.stat.chart.agent.DataSourceChart in project pinpoint by naver.
the class DataSourceChartService method selectAgentChartList.
@Override
public List<StatChart> selectAgentChartList(String agentId, TimeWindow timeWindow) {
Objects.requireNonNull(agentId, "agentId");
Objects.requireNonNull(timeWindow, "timeWindow");
List<SampledDataSourceList> sampledAgentStatList = this.sampledDataSourceDao.getSampledAgentStatList(agentId, timeWindow);
if (CollectionUtils.isEmpty(sampledAgentStatList)) {
List<StatChart> result = new ArrayList<>(1);
result.add(new DataSourceChart(timeWindow, Collections.emptyList(), serviceTypeRegistryService));
return result;
} else {
List<StatChart> result = new ArrayList<>(sampledAgentStatList.size());
for (SampledDataSourceList sampledDataSourceList : sampledAgentStatList) {
result.add(new DataSourceChart(timeWindow, sampledDataSourceList.getSampledDataSourceList(), serviceTypeRegistryService));
}
return result;
}
}
use of com.navercorp.pinpoint.web.vo.stat.chart.agent.DataSourceChart in project pinpoint by naver.
the class DataSourceChartSerializerTest method serializeTest.
@Test
public void serializeTest() throws Exception {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = createSampledDataSourceList(timeWindow);
DataSourceChart dataSourceChartGroup = new DataSourceChart(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
String jsonValue = mapper.writeValueAsString(dataSourceChartGroup);
Map<?, ?> map = mapper.readValue(jsonValue, Map.class);
Assert.assertTrue(map.containsKey("id"));
Assert.assertTrue(map.containsKey("jdbcUrl"));
Assert.assertTrue(map.containsKey("databaseName"));
Assert.assertTrue(map.containsKey("serviceType"));
Assert.assertTrue(map.containsKey("charts"));
}
Aggregations