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);
}
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));
}
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));
}
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);
}
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);
}
Aggregations