use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityTagsEmptyKeyExactTrue.
/**
* #NoTicket
*/
@Test
public void testEntityTagsEmptyKeyExactTrue() throws Exception {
final Entity entity = new Entity("query-entity24");
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(true);
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.entity.Entity in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityTagsExpressionCaseSensitiveValue.
/**
* #NoTicket
*/
@Test
public void testEntityTagsExpressionCaseSensitiveValue() throws Exception {
Entity entity = new Entity("query-entity41");
entity.addTag("t1", "tv1");
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 emptyJsonList = "[]";
assertTrue("No property should be returned", compareJsonString(emptyJsonList, given));
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class PropertyQueryTest method testEntityTagsTagsAsKeyExactTrue.
/**
* #NoTicket
*/
@Test
public void testEntityTagsTagsAsKeyExactTrue() throws Exception {
final Entity entity = new Entity("query-entity21");
entity.addTag("t1", "tv1");
entity.addTag("t2", "tv2");
EntityMethod.createOrReplaceEntityCheck(entity);
PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, entity.getName());
query.setKey(entity.getTags());
query.setExactMatch(true);
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.entity.Entity 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.entity.Entity in project atsd-api-test by axibase.
the class CSVInsertTest method testEntityNames.
@Issue("1278")
@Test(dataProvider = "entityNameProvider")
public void testEntityNames(String queryName, String expectedName) throws Exception {
Entity entity = new Entity(queryName);
Metric metric = new Metric(metric());
String csvPayload = String.format("time, %s%n0, 0%n", metric.getName());
Response response = csvInsert(entity.getName(), csvPayload);
String assertMessage = String.format("Failed to insert entity with name: %s", entity);
assertEquals(assertMessage, OK.getStatusCode(), response.getStatus());
entity.setName(expectedName);
assertEntityExisting(entity);
}
Aggregations