Search in sources :

Example 1 with TestNameGenerator

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());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Sample(com.axibase.tsd.api.model.series.Sample) TestNameGenerator(com.axibase.tsd.api.util.TestNameGenerator) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Sample (com.axibase.tsd.api.model.series.Sample)1 Series (com.axibase.tsd.api.model.series.Series)1 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)1 TestNameGenerator (com.axibase.tsd.api.util.TestNameGenerator)1 Issue (io.qameta.allure.Issue)1 Test (org.testng.annotations.Test)1