use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testNoTagsReplaceExisting.
@Issue("1968")
@Test
public void testNoTagsReplaceExisting() throws Exception {
Entity entity = new Entity("create-entity-8");
entity.addTag("tagkey", "tagvalue");
createOrReplaceEntityCheck(entity);
entity.setTags(null);
try {
createOrReplaceEntityCheck(entity);
} catch (IllegalStateException e) {
fail("Fail to replace tags if new tags are absent");
}
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testTagValBoolean.
@Issue("1968")
@Test
public void testTagValBoolean() throws Exception {
final String entityName = "create-entity-12";
Registry.Entity.checkExists(entityName);
Map<String, Object> createOrReplaceEntityQuery = new HashMap<>();
Map<String, Object> tags = new HashMap<>();
tags.put("a", true);
createOrReplaceEntityQuery.put("tags", tags);
assertEquals("Fail to execute createOrReplaceEntity query", OK.getStatusCode(), createOrReplaceEntity(entityName, createOrReplaceEntityQuery).getStatus());
Entity storedEntity = getEntityResponse(entityName).readEntity(Entity.class);
Map<String, String> expectedTags = new HashMap<>();
expectedTags.put("a", "true");
assertEquals("Stored tags are incorrect", expectedTags, storedEntity.getTags());
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testAreplaceAF.
@Issue("1968")
@Test
public void testAreplaceAF() throws Exception {
Entity entity = new Entity("create-entity-10");
entity.addTag("a", "c");
entity.addTag("f", "g");
createOrReplaceEntityCheck(entity);
entity.setTags(null);
entity.addTag("a", "b");
createOrReplaceEntityCheck(entity);
Entity storedEntity = getEntityResponse(entity.getName()).readEntity(Entity.class);
assertEquals("Stored tags are incorrect", entity.getTags(), storedEntity.getTags());
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testEntityNameContainsWhitespace.
@Issue("1278")
@Test
public void testEntityNameContainsWhitespace() throws Exception {
Entity entity = new Entity("createentity 1");
assertEquals("Method should fail if entityName contains whitespace", BAD_REQUEST.getStatusCode(), createOrReplaceEntity(entity).getStatus());
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testSeriesRemain.
@Issue("1968")
@Test
public void testSeriesRemain() throws Exception {
Series series = new Series("create-entity-17", "create-entity-metric-17");
series.addSamples(Sample.ofDateInteger(MIN_STORABLE_DATE, 0));
SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
Entity entity = new Entity();
entity.setName(series.getEntity());
createOrReplaceEntityCheck(entity);
assertTrue("Inserted Series should remain", new SeriesCheck(Collections.singletonList(series)).isChecked());
}
Aggregations