use of com.axibase.tsd.api.model.series.search.SeriesSearchResult in project atsd-api-test by axibase.
the class SeriesSearchTest method testAllFields.
@Issue("4404")
@Test(description = "Test all fields returned")
public void testAllFields() {
Entity expectedEntity = EntityMethod.getEntity(resultRecord4.getEntity().getName());
Metric expectedMetric = MetricMethod.getMetric(resultRecord4.getMetric().getName());
SeriesSearchQuery query = new SeriesSearchQuery("sst_22*");
query.addEntityFields("*");
query.addEntityTags("*");
query.addMetricFields("*");
query.addMetricTags("*");
SeriesSearchResult result = SeriesMethod.searchSeries(query);
SeriesSearchResultRecord[] resultRecords = result.getData();
assertTrue(resultRecords != null && resultRecords.length == 1, "Incorrect series count");
SeriesSearchResultRecord resultRecord = resultRecords[0];
Entity resultEntity = resultRecord.getEntity();
Metric resultMetric = resultRecord.getMetric();
assertEquals(resultEntity, expectedEntity);
assertEquals(resultMetric, expectedMetric);
}
use of com.axibase.tsd.api.model.series.search.SeriesSearchResult in project atsd-api-test by axibase.
the class SeriesSearchTest method checkQueryWithoutRelevance.
private static void checkQueryWithoutRelevance(SeriesSearchQuery query, Set<SeriesSearchResultRecord> expectedResult) {
SeriesSearchResult result = searchSeries(query);
HashMap<String, SeriesSearchResultRecord> actualRecords = new HashMap<>();
for (SeriesSearchResultRecord resultRecord : result.getData()) {
actualRecords.put(resultRecord.getEntity().getName(), resultRecord);
}
assertEquals(expectedResult.size(), actualRecords.size(), "Expected and actual result sets has different sizes");
for (SeriesSearchResultRecord expectedRecord : expectedResult) {
SeriesSearchResultRecord actualRecord = actualRecords.get(expectedRecord.getEntity().getName());
assertNotNull(actualRecord, "Requested series not found");
assertEquals(actualRecord.getEntity(), expectedRecord.getEntity(), "Entities are different");
assertEquals(actualRecord.getMetric(), expectedRecord.getMetric(), "Metrics are different");
assertEquals(actualRecord.getSeriesTags(), expectedRecord.getSeriesTags(), "Tags are different");
}
}
Aggregations