use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyValueEmptyExactFalse.
@Issue("2416")
@Test
public void testKeyValueEmptyExactFalse() throws Exception {
final Property property = new Property("query-type-64", "query-entity64");
property.addTag("t1", "v1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.addKey("k1", "");
query.setExactMatch(false);
assertStoredPropertyDoesNotMatchToInserted(property, query);
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyTagExpressionKeyTagCompareEQ.
@Issue("2908")
@Test
public void testKeyTagExpressionKeyTagCompareEQ() throws Exception {
final Property property = new Property("query-type46", "query-entity46");
property.addTag("t1", "tv1");
property.addKey("k1", "tv1");
insertPropertyCheck(property);
final Property property2 = new Property();
property2.setType(property.getType());
property2.setEntity(property.getEntity());
property2.addTag("t1", "tv1");
property2.addKey("k1", "tv2");
insertPropertyCheck(property2);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setKeyTagExpression("tags.t1 == keys.k1");
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 testEntityTagsKeyTagExpressionCaseInsensitiveName.
/**
* #NoTicket
*/
@Test
public void testEntityTagsKeyTagExpressionCaseInsensitiveName() throws Exception {
Entity entity = new Entity("query-entity42");
entity.addTag("t1", "tv1");
EntityMethod.createOrReplaceEntityCheck(entity);
final Property property = new Property();
property.setType(ENTITY_TAGS_PROPERTY_TYPE);
property.setEntity(entity.getName());
property.setTags(entity.getTags());
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 testEntityTagsKeyExpressionNoMatch.
/**
* #NoTicket
*/
@Test
public void testEntityTagsKeyExpressionNoMatch() throws Exception {
final Entity entity = new Entity("query-entity26");
entity.addTag("t1", "tv1");
entity.addTag("t2", "tv2");
EntityMethod.createOrReplaceEntityCheck(entity);
PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, entity.getName());
query.setKeyTagExpression("tags.t1 == 'v2'");
String given = queryProperty(query).readEntity(String.class);
String emptyJsonList = "[]";
assertTrue("No property should be returned", compareJsonString(emptyJsonList, given));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testLimit1.
@Issue("2946")
@Test
public void testLimit1() throws Exception {
final int limit = 1;
final Property property = new Property("query-type55", "query-entity55");
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);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setLimit(limit);
int actual = calculateJsonArraySize(queryProperty(query).readEntity(String.class));
assertEquals("One property should be received", limit, actual);
}
Aggregations