Search in sources :

Example 21 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery 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 22 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery 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 23 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery 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)

Example 24 with PropertyQuery

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

the class PropertyQueryTest method testLimit2.

@Issue("2946")
@Test
public void testLimit2() throws Exception {
    final int limit = 2;
    final Property property = new Property("query-type56", "query-entity56");
    property.addTag("t1", "tv1");
    insertPropertyCheck(property);
    final Property property2 = new Property();
    property2.setType(property.getType());
    property2.setEntity(property.getEntity());
    property2.addTag("t2", "tv2");
    property2.addKey("k2", "kv2");
    insertPropertyCheck(property2);
    final Property property3 = new Property();
    property3.setType(property.getType());
    property3.setEntity(property.getEntity());
    property3.addTag("t3", "tv3");
    property3.addKey("k3", "kv3");
    insertPropertyCheck(property3);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setLimit(limit);
    int actual = calculateJsonArraySize(queryProperty(query).readEntity(String.class));
    assertEquals("Two property should be received", limit, actual);
}
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 25 with PropertyQuery

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

the class PropertyQueryTest method testMultipleEntityWildcardKeyNotMatchExactTrue.

/**
 * #NoTicket
 */
@Test
public void testMultipleEntityWildcardKeyNotMatchExactTrue() throws Exception {
    final Property property = new Property("query-type17", "query-entity17");
    property.addTag("t1", "tv1");
    insertPropertyCheck(property);
    final Property secondProperty = new Property(null, "query-entity17-2");
    secondProperty.setType(property.getType());
    secondProperty.addTag("t2", "tv2");
    secondProperty.addKey("k2", "kv2");
    insertPropertyCheck(secondProperty);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
    query.setExactMatch(true);
    String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
    String given = queryProperty(query).readEntity(String.class);
    assertTrue("Only first property should be returned", compareJsonString(expected, given));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Aggregations

PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)112 Test (org.testng.annotations.Test)109 Property (com.axibase.tsd.api.model.property.Property)94 Issue (io.qameta.allure.Issue)44 Entity (com.axibase.tsd.api.model.entity.Entity)12 Response (javax.ws.rs.core.Response)11 Period (com.axibase.tsd.api.model.Period)6 List (java.util.List)6 NotCheckedException (com.axibase.tsd.api.util.NotCheckedException)1