Search in sources :

Example 1 with SeriesSearchResult

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);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) SeriesSearchResultRecord(com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord) SeriesSearchQuery(com.axibase.tsd.api.model.series.search.SeriesSearchQuery) Metric(com.axibase.tsd.api.model.metric.Metric) SeriesSearchResult(com.axibase.tsd.api.model.series.search.SeriesSearchResult) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with SeriesSearchResult

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");
    }
}
Also used : SeriesSearchResultRecord(com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord) SeriesSearchResult(com.axibase.tsd.api.model.series.search.SeriesSearchResult)

Aggregations

SeriesSearchResult (com.axibase.tsd.api.model.series.search.SeriesSearchResult)2 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)2 Entity (com.axibase.tsd.api.model.entity.Entity)1 Metric (com.axibase.tsd.api.model.metric.Metric)1 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)1 Issue (io.qameta.allure.Issue)1 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1