use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testLimit2.
@Issue("2946")
@Test
public void testLimit2() throws Exception {
final int limit = 2;
final Property property = new Property("query-type56", "query-entity56");
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);
final Property property3 = new Property();
property3.setType(property.getType());
property3.setEntity(property.getEntity());
property3.addTag("t3", "tv3");
property3.addKey("k3", "kv3");
insertPropertyCheck(property3);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setLimit(limit);
int actual = calculateJsonArraySize(queryProperty(query).readEntity(String.class));
assertEquals("Two property should be received", limit, actual);
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testMultipleEntityWildcardKeyNotMatchExactTrue.
/**
* #NoTicket
*/
@Test
public void testMultipleEntityWildcardKeyNotMatchExactTrue() throws Exception {
final Property property = new Property("query-type17", "query-entity17");
property.addTag("t1", "tv1");
insertPropertyCheck(property);
final Property secondProperty = new Property(null, "query-entity17-2");
secondProperty.setType(property.getType());
secondProperty.addTag("t2", "tv2");
secondProperty.addKey("k2", "kv2");
insertPropertyCheck(secondProperty);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
query.setExactMatch(true);
String expected = jacksonMapper.writeValueAsString(Collections.singletonList(property));
String given = queryProperty(query).readEntity(String.class);
assertTrue("Only first property should be returned", compareJsonString(expected, given));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyQueryTest method testLimitWithEntityFilter.
@Issue("3110")
@Test
public void testLimitWithEntityFilter() throws Exception {
final Property property = new Property("query-type57-b", "query-entity57-b-limitentityold");
property.setDate("2016-07-18T02:35:00.000Z");
property.addKey("uniq", "key1");
property.addTag("tag_key", "tag_value");
insertPropertyCheck(property);
final Property property2 = new Property(null, "query-entity57-b-limitentity-2");
property2.setType(property.getType());
property2.setDate(Util.addOneMS(property.getDate()));
property2.addKey("uniq", "key2");
property2.addTag("tag_key2", "tag_value2");
insertPropertyCheck(property2);
final Property property3 = new Property(null, "query-entity57-b-limitentity-3");
property3.setType(property.getType());
property3.setDate(Util.addOneMS(property.getDate()));
property3.addKey("uniq", "key3");
property3.addTag("tag_key2", "tag_value2");
insertPropertyCheck(property3);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "query-entity57-b-limitentity-*");
query.setLimit(2);
assertEquals("Two property should be received", 2, calculateJsonArraySize(queryProperty(query).readEntity(String.class)));
query.setEntity("query-entity57-b-limitentityo*");
query.setLimit(1);
assertEquals("One property should be received", 1, 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 testKeyTagExpressionOR.
@Issue("2908")
@Test
public void testKeyTagExpressionOR() throws Exception {
final Property property = new Property("query-type43", "query-entity43");
property.addTag("t1", "tv1");
property.addKey("k1", "kv1");
insertPropertyCheck(property);
final Property property2 = new Property();
property2.setType(property.getType());
property2.setEntity(property.getEntity());
property2.addTag("t1", "tv1");
insertPropertyCheck(property2);
final Property property3 = new Property();
property3.setType(property.getType());
property3.setEntity(property.getEntity());
property3.addTag("t3", "tv3");
property3.addKey("k3", "kv3");
insertPropertyCheck(property3);
PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
query.setKeyTagExpression("tags.t1 == 'tv1' OR keys.k3 == 'kv3'");
String given = queryProperty(query).readEntity(String.class);
String expected = jacksonMapper.writeValueAsString(Arrays.asList(property, property2, property3));
assertTrue("All inserted properties should be returned", compareJsonString(expected, given));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyUrlQueryTest method testTypeContainsCyrillic.
@Issue("1278")
@Test
public void testTypeContainsCyrillic() throws Exception {
Property property = new Property("urlquery-propertyйёtype-6", "urlquery-entityname-6");
assertUrlencodedPathHandledSuccessfullyOnUrlQuery(property);
}
Aggregations