use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testLimitWithKeyExpression.
@Issue("3110")
@Test
public void testLimitWithKeyExpression() throws Exception {
final int limit = 1;
final Property property = new Property("query-type57-c", "query-entity57-c");
final String tag = "key1";
property.addKey("uniq", tag);
property.addTag("tag_key", "tag_value");
insertPropertyCheck(property);
final Property property2 = new Property();
property2.setType(property.getType());
property2.setEntity(property.getEntity());
property2.addKey("uniq", tag.toUpperCase());
property2.addTag("tag_key2", "tag_value2");
insertPropertyCheck(property2);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setKeyTagExpression("keys.uniq = '" + tag + "'");
query.setLimit(limit);
assertEquals("One property should be received", limit, calculateJsonArraySize(queryProperty(query).readEntity(String.class)));
query.setKeyTagExpression("keys.uniq = '" + tag.toUpperCase() + "'");
assertEquals("One property should be received", limit, calculateJsonArraySize(queryProperty(query).readEntity(String.class)));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testExactTruePartialMatch.
/**
* #NoTicket
*/
@Test
public void testExactTruePartialMatch() throws Exception {
final Property property = new Property("query-type12", "query-entity12");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
property.addKey("k2", "kv2");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
query.addKey("k1", "kv1");
query.setExactMatch(true);
String emptyJsonList = "[]";
Response response = queryProperty(query);
assertTrue("Should not receive any properties", compareJsonString(emptyJsonList, response.readEntity(String.class)));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyValueBoolean.
@Issue("2416")
@Test
public void testKeyValueBoolean() throws Exception {
final Property property = new Property("query-type-67", "query-entity67");
property.addTag("t1", "v1");
property.addKey("k1", "true");
insertPropertyCheck(property);
Map<String, Object> query = new HashMap<>();
query.put("type", property.getType());
query.put("entity", property.getEntity());
query.put("startDate", MIN_QUERYABLE_DATE);
query.put("endDate", MAX_QUERYABLE_DATE);
Map<String, Object> key = new HashMap<>();
key.put("k1", true);
query.put("key", key);
assertStoredPropertyDoesNotMatchToInserted(property, query);
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testLastTrueReturnMultipleProperty.
/**
* #NoTicket
*/
@Test
public void testLastTrueReturnMultipleProperty() throws Exception {
final Property property = new Property("query-type6.1", "query-entity6.1");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
property.setDate(getPreviousDay());
insertPropertyCheck(property);
final Property lastProperty = new Property();
lastProperty.setType(property.getType());
lastProperty.setEntity(property.getEntity());
lastProperty.addTag("t1l", "tv1l");
lastProperty.setDate(getCurrentDate());
insertPropertyCheck(lastProperty);
final Property lastPropertySecond = new Property();
lastPropertySecond.setType(property.getType());
lastPropertySecond.setEntity(property.getEntity());
lastPropertySecond.addTag("t1l", "tv1l");
lastPropertySecond.addKey("k2", "kv2");
lastPropertySecond.setDate(lastProperty.getDate());
insertPropertyCheck(lastPropertySecond);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setLast(true);
String expected = jacksonMapper.writeValueAsString(Arrays.asList(lastProperty, lastPropertySecond));
String given = queryProperty(query).readEntity(String.class);
assertTrue("Only two last properties should be in response", compareJsonString(expected, given));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyValueNullExactTrue.
@Issue("2416")
@Test
public void testKeyValueNullExactTrue() throws Exception {
final Property property = new Property("query-type-61", "query-entity61");
property.addTag("t1", "v1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.addKey("k1", null);
query.setExactMatch(true);
assertStoredPropertyDoesNotMatchToInserted(property, query);
}
Aggregations