use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testMultipleEntityWildcardKeyPartMatchExactFalse.
/**
* #NoTicket
*/
@Test
public void testMultipleEntityWildcardKeyPartMatchExactFalse() throws Exception {
final Property property = new Property("query-type16", "query-entity16");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
final Property secondProperty = new Property(null, "query-entity16-2");
secondProperty.setType(property.getType());
secondProperty.addTag("t2", "tv2");
secondProperty.setKey(property.getKey());
secondProperty.addKey("k2", "kv2");
insertPropertyCheck(secondProperty);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
query.setExactMatch(false);
String expected = jacksonMapper.writeValueAsString(Arrays.asList(property, secondProperty));
String given = queryProperty(query).readEntity(String.class);
assertTrue("Stored series do not match to inserted", compareJsonString(expected, given));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityTagsKeyExpression.
/**
* #NoTicket
*/
@Test
public void testEntityTagsKeyExpression() throws Exception {
final Entity entity = new Entity("query-entity25");
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.setKeyTagExpression("tags.t1 == 'tv1'");
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));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testDiffKeyExactTrue.
/**
* #NoTicket
*/
@Test
public void testDiffKeyExactTrue() throws Exception {
final Property property = new Property("query-type13", "query-entity13");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
query.addKey("k2", "k2_val");
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.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyTagExpressionTagNotEmpty.
@Issue("2908")
@Test
public void testKeyTagExpressionTagNotEmpty() throws Exception {
final Property property = new Property("query-type50", "query-entity50");
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("tags.t2 != ''");
String given = queryProperty(query).readEntity(String.class);
String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property2));
assertTrue("Only second 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 testKeyTagExpressionLowerTag.
@Issue("2908")
@Test
public void testKeyTagExpressionLowerTag() throws Exception {
final Property property = new Property("query-type51", "query-entity51");
property.addTag("t1", "TV1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setKeyTagExpression("lower(tags.t1) == 'tv1'");
assertInsertedPropertyReturned(property, query);
}
Aggregations