Search in sources :

Example 51 with Property

use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.

the class PropertyQueryTest method testEntityTagsEmptyKeyExactFalse.

/**
 * #NoTicket
 */
@Test
public void testEntityTagsEmptyKeyExactFalse() throws Exception {
    final Entity entity = new Entity("query-entity23");
    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);
    PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, entity.getName());
    query.setExactMatch(false);
    String given = queryProperty(query).readEntity(String.class);
    String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
    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)

Example 52 with Property

use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.

the class PropertyQueryTest method testKeyValueNullExactFalse.

@Issue("2416")
@Test
public void testKeyValueNullExactFalse() throws Exception {
    final Property property = new Property("query-type-62", "query-entity62");
    property.addTag("t1", "v1");
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.addKey("k1", null);
    query.setExactMatch(false);
    assertStoredPropertyDoesNotMatchToInserted(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 53 with Property

use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.

the class PropertyQueryTest method testExtraKeyExactTrue.

/**
 * #NoTicket
 */
@Test
public void testExtraKeyExactTrue() throws Exception {
    final Property property = new Property("query-type14", "query-entity14");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
    query.setKey(property.getKey());
    query.addKey("extra_key", "extra_key_val");
    query.setExactMatch(true);
    String emptyJsonList = "[]";
    Response response = queryProperty(query);
    assertTrue("Stored series do not match to inserted", compareJsonString(emptyJsonList, response.readEntity(String.class)));
}
Also used : Response(javax.ws.rs.core.Response) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 54 with Property

use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.

the class PropertyQueryTest method testPartKey.

/**
 * #NoTicket
 */
@Test
public void testPartKey() throws Exception {
    final Property property = new Property("query-type41.5", "query-entity41.5");
    property.addTag("fs_type", "ext4");
    property.addKey("file_system", "/");
    property.addKey("mount_point", "/sda1");
    property.setDate("2016-05-25T04:00:00.000Z");
    insertPropertyCheck(property);
    PropertyQuery query = new PropertyQuery(property.getType(), property.getEntity());
    query.addKey("file_system", "/");
    query.setStartDate("2016-05-25T04:00:00Z");
    query.setEndDate("2016-05-25T05:00:00Z");
    assertInsertedPropertyReturned(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 55 with Property

use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.

the class PropertyQueryTest method testKeyTagExpressionLowerKey.

@Issue("2908")
@Test
public void testKeyTagExpressionLowerKey() throws Exception {
    final Property property = new Property("query-type52", "query-entity52");
    property.addTag("t1", "tv1");
    property.addKey("k1", "KV1");
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setKeyTagExpression("lower(keys.k1) == 'kv1'");
    assertInsertedPropertyReturned(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Property (com.axibase.tsd.api.model.property.Property)146 Test (org.testng.annotations.Test)143 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)94 Issue (io.qameta.allure.Issue)84 Response (javax.ws.rs.core.Response)23 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)10 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)10 HashMap (java.util.HashMap)9 Entity (com.axibase.tsd.api.model.entity.Entity)8 List (java.util.List)6 Period (com.axibase.tsd.api.model.Period)5 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)1 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1 Series (com.axibase.tsd.api.model.series.Series)1 BeforeClass (org.testng.annotations.BeforeClass)1