Search in sources :

Example 66 with Entity

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

the class EntityGetPropertyTypesTest method testEntityNameContainsSlash.

@Issue("1278")
@Test
public void testEntityNameContainsSlash() throws Exception {
    Entity entity = new Entity("get_property_types_/entity-2");
    createOrReplaceEntityCheck(entity);
    assertUrlencodedPathHandledSuccessfullyOnGetPropertyTypes(entity);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 67 with Entity

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

the class PropertyQueryTest method testEntityTagsTagsAsPartKeyExactFalse.

/**
 * #NoTicket
 */
@Test
public void testEntityTagsTagsAsPartKeyExactFalse() throws Exception {
    final Entity entity = new Entity("query-entity22");
    entity.addTag("t1", "tv1");
    entity.addTag("t2", "tv2");
    EntityMethod.createOrReplaceEntityCheck(entity);
    PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, entity.getName());
    query.addKey("t1", "tv1");
    query.setExactMatch(false);
    String given = queryProperty(query).readEntity(String.class);
    String emptyJsonList = "[]";
    assertTrue("No property should be returned", compareJsonString(emptyJsonList, given));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 68 with Entity

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

the class PropertyQueryTest method testEntityTags.

/**
 * #NoTicket
 */
@Test
public static void testEntityTags() throws Exception {
    final Entity entity = new Entity("query-entity20");
    entity.addTag("t1", "tv1");
    entity.addTag("t2", "tv2");
    final Property property = new Property();
    property.setType(ENTITY_TAGS_PROPERTY_TYPE);
    property.setEntity(entity.getName());
    property.setTags(entity.getTags());
    EntityMethod.createOrReplaceEntityCheck(entity);
    assertTrue("Properties with entityTag should be specified", propertyExist(property));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 69 with Entity

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

the class PropertyQueryTest method testEntityWildcardTagsAsKey.

/**
 * #NoTicket
 */
@Test
public void testEntityWildcardTagsAsKey() throws Exception {
    final Entity entity = new Entity("wck-query-entity33");
    entity.addTag("wct1", "wcv1");
    EntityMethod.createOrReplaceEntityCheck(entity);
    PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, "wck-*");
    query.setKey(entity.getTags());
    String given = queryProperty(query).readEntity(String.class);
    String emptyJsonList = "[]";
    assertTrue("No property should be returned", compareJsonString(emptyJsonList, given));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 70 with Entity

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

the class PropertyQueryTest method testEntityWildcardExpression.

/**
 * #NoTicket
 */
@Test
public void testEntityWildcardExpression() throws Exception {
    Entity entity1 = new Entity("wcke-query-entity37");
    entity1.addTag("wc2t1", "wc2v1");
    Entity entity2 = new Entity("wcke-query-entity38");
    entity2.addTag("wc2t1", "wc2V1");
    Entity entity3 = new Entity("wcke-query-entity39");
    entity3.addTag("wc2t1", "wc2v1");
    entity3.addTag("wc2t2", "wc2v2");
    Entity entity4 = new Entity("wcke-query-entity40");
    entity4.addTag("wc2t2", "wc2V2");
    EntityMethod.createOrReplaceEntityCheck(entity1);
    EntityMethod.createOrReplaceEntityCheck(entity2);
    EntityMethod.createOrReplaceEntityCheck(entity3);
    EntityMethod.createOrReplaceEntityCheck(entity4);
    final Property property3 = new Property();
    property3.setType(ENTITY_TAGS_PROPERTY_TYPE);
    property3.setEntity(entity3.getName());
    property3.setTags(entity3.getTags());
    PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, "wcke-*");
    query.setKeyTagExpression("keys.wc2t1 = 'wc2V1' OR tags.wc2t2 = 'wc2v2'");
    String given = queryProperty(query).readEntity(String.class);
    String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property3));
    assertTrue(String.format("Property with type %s for inserted entity should be returned", ENTITY_TAGS_PROPERTY_TYPE), compareJsonString(expected, given));
}
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)

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