use of com.axibase.tsd.api.model.property.PropertyQuery 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.PropertyQuery 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.PropertyQuery 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);
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityTagsEmptyKeyExactFalse.
/**
* #NoTicket
*/
@Test
public void testEntityTagsEmptyKeyExactFalse() throws Exception {
final Entity entity = new Entity("query-entity23");
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.setExactMatch(false);
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 testKeyValueNullExactFalse.
@Issue("2416")
@Test
public void testKeyValueNullExactFalse() throws Exception {
final Property property = new Property("query-type-62", "query-entity62");
property.addTag("t1", "v1");
insertPropertyCheck(property);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.addKey("k1", null);
query.setExactMatch(false);
assertStoredPropertyDoesNotMatchToInserted(property, query);
}
Aggregations