Search in sources :

Example 76 with PropertyQuery

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

the class PropertyQueryTest method testStartPastIntervalGiveFuture.

/**
 * #NoTicket
 */
@Test
public void testStartPastIntervalGiveFuture() throws Exception {
    final Property property = new Property("query-type5", "query-entity5");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getCurrentDate());
    insertPropertyCheck(property);
    PropertyQuery query = new PropertyQuery(property.getType(), property.getEntity());
    query.setKey(property.getKey());
    query.setStartDate(MIN_QUERYABLE_DATE);
    query.setInterval(new Period(1999, TimeUnit.YEAR));
    assertInsertedPropertyReturned(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Period(com.axibase.tsd.api.model.Period) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 77 with PropertyQuery

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

the class PropertyQueryTest method testKeyTagExpressionTagsLIKE.

@Issue("2908")
@Test
public void testKeyTagExpressionTagsLIKE() throws Exception {
    final Property property = new Property("query-type45", "query-entity45");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    insertPropertyCheck(property);
    final Property property2 = new Property();
    property2.setType(property.getType());
    property2.setEntity(property.getEntity());
    property2.addTag("t1", "tg1");
    property2.addKey("k2", "kv2");
    insertPropertyCheck(property2);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setKeyTagExpression("tags.t1 LIKE 'tv*'");
    String given = queryProperty(query).readEntity(String.class);
    String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
    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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 78 with PropertyQuery

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

the class PropertyQueryTest method testKeyTagExpressionKeyEmpty.

@Issue("2908")
@Test
public void testKeyTagExpressionKeyEmpty() throws Exception {
    final Property property = new Property("query-type48", "query-entity48");
    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", "tv2");
    insertPropertyCheck(property2);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setKeyTagExpression("keys.k2 == ''");
    String given = queryProperty(query).readEntity(String.class);
    String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
    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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 79 with PropertyQuery

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

the class PropertyQueryTest method testStartEQDate.

/**
 * #NoTicket
 */
@Test
public void testStartEQDate() throws Exception {
    final Property property = new Property("query-type4", "query-entity4");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getCurrentDate());
    insertProperty(property);
    PropertyQuery query = new PropertyQuery(property.getType(), property.getEntity());
    query.setStartDate(property.getDate());
    query.setEndDate(Util.addOneMS(property.getDate()));
    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 80 with PropertyQuery

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

the class PropertyQueryTest method testTypeEntityStartEndExactFalse.

/**
 * #NoTicket
 */
@Test
public void testTypeEntityStartEndExactFalse() throws Exception {
    final Property property = new Property("query-type1", "query-entity1");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getCurrentDate());
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setExactMatch(false);
    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)

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