use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testKeyValueContainsSpaces.
@Issue("2416")
@Test
public void testKeyValueContainsSpaces() throws Exception {
final Property property = new Property("query-type-66", "query-entity66");
property.addTag("t1", "v1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.addKey("k1", " kv1 ");
assertStoredPropertyDoesNotMatchToInserted(property, query);
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityWildcardTagsAsKey.
/**
* #NoTicket
*/
@Test
public void testEntityWildcardTagsAsKey() throws Exception {
final Entity entity = new Entity("wck-query-entity33");
entity.addTag("wct1", "wcv1");
EntityMethod.createOrReplaceEntityCheck(entity);
PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, "wck-*");
query.setKey(entity.getTags());
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 testMultipleEntityWildcardKeyPartMatchExactTrue.
/**
* #NoTicket
*/
@Test
public void testMultipleEntityWildcardKeyPartMatchExactTrue() throws Exception {
final Property property = new Property("query-type15", "query-entity15");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
final Property secondProperty = new Property(null, "query-entity15-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.setKey(property.getKey());
query.setExactMatch(true);
String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
String given = queryProperty(query).readEntity(String.class);
assertTrue("Stored property 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 testKeyMatchExactTrue.
@Test
public void testKeyMatchExactTrue() throws Exception {
final Property property = new Property("query-type10", "query-entity10");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
query.setKey(property.getKey());
query.setExactMatch(true);
assertInsertedPropertyReturned(property, query);
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityWildcardExpression.
/**
* #NoTicket
*/
@Test
public void testEntityWildcardExpression() throws Exception {
Entity entity1 = new Entity("wcke-query-entity37");
entity1.addTag("wc2t1", "wc2v1");
Entity entity2 = new Entity("wcke-query-entity38");
entity2.addTag("wc2t1", "wc2V1");
Entity entity3 = new Entity("wcke-query-entity39");
entity3.addTag("wc2t1", "wc2v1");
entity3.addTag("wc2t2", "wc2v2");
Entity entity4 = new Entity("wcke-query-entity40");
entity4.addTag("wc2t2", "wc2V2");
EntityMethod.createOrReplaceEntityCheck(entity1);
EntityMethod.createOrReplaceEntityCheck(entity2);
EntityMethod.createOrReplaceEntityCheck(entity3);
EntityMethod.createOrReplaceEntityCheck(entity4);
final Property property3 = new Property();
property3.setType(ENTITY_TAGS_PROPERTY_TYPE);
property3.setEntity(entity3.getName());
property3.setTags(entity3.getTags());
PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, "wcke-*");
query.setKeyTagExpression("keys.wc2t1 = 'wc2V1' OR tags.wc2t2 = 'wc2v2'");
String given = queryProperty(query).readEntity(String.class);
String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property3));
assertTrue(String.format("Property with type %s for inserted entity should be returned", ENTITY_TAGS_PROPERTY_TYPE), compareJsonString(expected, given));
}
Aggregations