use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testTagValInteger.
@Issue("1968")
@Test
public void testTagValInteger() throws Exception {
final String entityName = "create-entity-13";
Registry.Entity.checkExists(entityName);
Map<String, Object> createOrReplaceEntityQuery = new HashMap<>();
Map<String, Object> tags = new HashMap<>();
tags.put("a", 123);
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", "123");
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 testEntityNameConvertedToLowerCase.
@Issue("1968")
@Test
public void testEntityNameConvertedToLowerCase() throws Exception {
Entity entity = new Entity("CreateEntity6");
createOrReplaceEntity(entity);
Entity savedEntity = getEntityResponse(entity.getName()).readEntity(Entity.class);
assertEquals("Entity name should be converted to lower case", entity.getName().toLowerCase(), savedEntity.getName());
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testTagNameConvertedToLowerCase.
@Issue("1968")
@Test
public void testTagNameConvertedToLowerCase() throws Exception {
Entity entity = new Entity("createentity4");
entity.addTag("TagKey", "tagvalue");
createOrReplaceEntity(entity);
Entity savedEntity = getEntityResponse(entity.getName()).readEntity(Entity.class);
Map<String, String> formattedTags = new HashMap<>();
for (Map.Entry<String, String> e : entity.getTags().entrySet()) {
formattedTags.put(e.getKey().toLowerCase(), e.getValue());
}
assertEquals("Tags name should be converted to lower case", formattedTags, savedEntity.getTags());
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class EntityCreateOrReplaceTest method testTagValBooleanInteger.
@Issue("1968")
@Test
public void testTagValBooleanInteger() throws Exception {
final String entityName = "create-entity-14";
Registry.Entity.checkExists(entityName);
Map<String, Object> createOrReplaceEntityQuery = new HashMap<>();
Map<String, Object> tags = new HashMap<>();
tags.put("a", 123);
tags.put("b", 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", "123");
expectedTags.put("b", "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 testTagValueRetainCase.
@Issue("1968")
@Test
public void testTagValueRetainCase() throws Exception {
Entity entity = new Entity("createentity5");
entity.addTag("tag-key", "TaValue");
createOrReplaceEntity(entity);
Entity savedEntity = getEntityResponse(entity.getName()).readEntity(Entity.class);
assertEquals("Tags Value should retain case", entity.getTags(), savedEntity.getTags());
}
Aggregations