Search in sources :

Example 56 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SeriesSearchTest method testFieldsTags.

@Issue("4404")
@Test(description = "Test explicitly requested fields and tags are returned")
public void testFieldsTags() {
    SeriesSearchQuery query = new SeriesSearchQuery("sst_1*");
    query.addEntityFields("interpolate", "timezone");
    query.addEntityTags("sst_11_entity_tag");
    query.addMetricFields("datatype", "timeprecision");
    query.addMetricTags("sst_11_metric_tag");
    Entity entity1 = new Entity().setName(resultRecord1.getEntity().getName()).setLabel(resultRecord1.getEntity().getLabel()).setInterpolationMode(resultRecord1.getEntity().getInterpolationMode()).setTimeZoneID(resultRecord1.getEntity().getTimeZoneID());
    Metric metirc1 = new Metric().setName(resultRecord1.getMetric().getName()).setLabel(resultRecord1.getMetric().getLabel()).setDataType(resultRecord1.getMetric().getDataType()).setTimePrecision(resultRecord1.getMetric().getTimePrecision());
    SeriesSearchResultRecord expectedResult1 = new SeriesSearchResultRecord(entity1, metirc1, resultRecord1.getSeriesTags(), 1.0);
    Entity entity2 = new Entity().setName(resultRecord3.getEntity().getName()).setLabel(resultRecord3.getEntity().getLabel()).setInterpolationMode(resultRecord3.getEntity().getInterpolationMode()).setTimeZoneID(resultRecord3.getEntity().getTimeZoneID()).setTags(resultRecord3.getEntity().getTags());
    Metric metirc2 = new Metric().setName(resultRecord3.getMetric().getName()).setLabel(resultRecord3.getMetric().getLabel()).setDataType(resultRecord3.getMetric().getDataType()).setTimePrecision(resultRecord3.getMetric().getTimePrecision()).setTags(resultRecord3.getMetric().getTags());
    SeriesSearchResultRecord expectedResult3 = new SeriesSearchResultRecord(entity2, metirc2, resultRecord3.getSeriesTags(), 1.0);
    SeriesSearchResultRecord[] expectedResult = { expectedResult1, expectedResult3 };
    checkQueryWithoutRelevance(query, Sets.newHashSet(Arrays.asList(expectedResult)));
}
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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 57 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class PropertyDeleteTest method testEntityTagsExactFalse.

@Test
public void testEntityTagsExactFalse() throws Exception {
    final String entityTagsType = "$entity_tags";
    final Entity entity = new Entity("delete-entity11");
    entity.addTag("t1", "v1");
    entity.addTag("t2", "v2");
    final Property property = new Property();
    property.setType(entityTagsType);
    property.setEntity(entity.getName());
    property.setTags(entity.getTags());
    EntityMethod.createOrReplaceEntityCheck(entity);
    assertTrue(propertyExist(property));
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType("$entity_tags");
    deleteQuery.setEntity(entity.getName());
    deleteQuery.setExactMatch(false);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertTrue(propertyExist(property));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 58 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlSelectEntityFieldsTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    Entity entity = new Entity(TEST_ENTITY, Mocks.TAGS);
    entity.setLabel(Mocks.LABEL);
    entity.setEnabled(true);
    entity.setInterpolationMode(InterpolationMode.PREVIOUS);
    entity.setTimeZoneID(Mocks.TIMEZONE_ID);
    Series series = new Series(TEST_ENTITY, TEST_METRIC);
    series.addSamples(Mocks.SAMPLE);
    EntityMethod.createOrReplaceEntityCheck(entity);
    SeriesMethod.insertSeriesCheck(series);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Series(com.axibase.tsd.api.model.series.Series) BeforeClass(org.testng.annotations.BeforeClass)

Example 59 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlStandardCollectionViewTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    // Series data
    List<Series> seriesList = new ArrayList<>();
    seriesList.add(new Series(TEST_ENTITY1_NAME, TEST_METRIC1_NAME, TAGS) {

        {
            addSamples(Sample.ofDateInteger("2016-06-29T08:00:00.000Z", 0));
        }
    });
    seriesList.add(new Series(TEST_ENTITY2_NAME, TEST_METRIC2_NAME) {

        {
            addSamples(Sample.ofDateInteger("2016-06-29T08:00:00.000Z", 1));
        }
    });
    // Entity data
    EntityMethod.createOrReplaceEntity(new Entity(TEST_ENTITY1_NAME, TAGS));
    // Metric data
    MetricMethod.createOrReplaceMetric(new Metric(TEST_METRIC1_NAME, TAGS));
    SeriesMethod.insertSeriesCheck(seriesList);
    // Entity groups data
    EntityGroupMethod.createOrReplaceEntityGroup(new EntityGroup(TEST_ENTITY_GROUP1_NAME));
    EntityGroupMethod.createOrReplaceEntityGroup(new EntityGroup(TEST_ENTITY_GROUP2_NAME));
    EntityGroupMethod.addEntities(TEST_ENTITY_GROUP1_NAME, Collections.singletonList(TEST_ENTITY1_NAME));
    EntityGroupMethod.addEntities(TEST_ENTITY_GROUP2_NAME, Collections.singletonList(TEST_ENTITY1_NAME));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) EntityGroup(com.axibase.tsd.api.model.entitygroup.EntityGroup) Metric(com.axibase.tsd.api.model.metric.Metric) BeforeClass(org.testng.annotations.BeforeClass)

Example 60 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class EntityCreateOrReplaceTest method testEntityNameContainsCyrillic.

@Issue("1278")
@Test
public void testEntityNameContainsCyrillic() throws Exception {
    Entity entity = new Entity("createйёentity3");
    assertEquals("Fail to execute createOrReplaceEntity query", OK.getStatusCode(), createOrReplaceEntity(entity).getStatus());
    assertTrue("Fail to get required entity", entityExist(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Entity (com.axibase.tsd.api.model.entity.Entity)77 Test (org.testng.annotations.Test)60 Issue (io.qameta.allure.Issue)43 Metric (com.axibase.tsd.api.model.metric.Metric)21 Series (com.axibase.tsd.api.model.series.Series)21 BeforeClass (org.testng.annotations.BeforeClass)15 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)12 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)9 HashMap (java.util.HashMap)9 Property (com.axibase.tsd.api.model.property.Property)8 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)6 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)5 Response (javax.ws.rs.core.Response)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)4 File (java.io.File)4 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)3 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)3 Sample (com.axibase.tsd.api.model.series.Sample)2 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)2 BigDecimal (java.math.BigDecimal)2