use of com.axibase.tsd.api.util.TestNameGenerator in project atsd-api-test by axibase.
the class SeriesQueryWildcardTest method testEntityWithWildcardExactMatchTrue.
@Issue("3371")
@Test
public void testEntityWithWildcardExactMatchTrue() throws Exception {
TestNameGenerator nameGenerator = new TestNameGenerator();
String metricName = Mocks.metric();
Series series1 = new Series(nameGenerator.newEntityName(), metricName);
series1.addSamples(Sample.ofDateInteger(MIN_STORABLE_DATE, 7));
Series series2 = new Series(nameGenerator.newEntityName(), metricName, "tag_key", "tag_value");
series2.addSamples(Sample.ofTimeInteger(MIN_STORABLE_TIMESTAMP, 7), Sample.ofTimeInteger(MIN_STORABLE_TIMESTAMP + 1, 8));
insertSeriesCheck(series1, series2);
SeriesQuery seriesQuery = new SeriesQuery(nameGenerator.getPrefix(TestNameGenerator.Key.ENTITY).concat("*"), series1.getMetric(), MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
seriesQuery.setExactMatch(true);
seriesQuery.setLimit(2);
seriesQuery.setSeriesLimit(1);
List<Sample> data = querySeriesAsList(seriesQuery).get(0).getData();
assertEquals("ExactMatch true with wildcard doesn't return series without tags", 1, data.size());
seriesQuery.addTag("tag_key", "tag_value");
data = querySeriesAsList(seriesQuery).get(0).getData();
assertEquals("ExactMatch true with wildcard doesn't return series with tags", 2, data.size());
}
Aggregations