Search in sources :

Example 61 with Entity

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());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 62 with Entity

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());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 63 with Entity

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());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 64 with Entity

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());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 65 with Entity

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());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Entity (com.axibase.tsd.api.model.entity.Entity)77 Test (org.testng.annotations.Test)60 Issue (io.qameta.allure.Issue)43 Metric (com.axibase.tsd.api.model.metric.Metric)21 Series (com.axibase.tsd.api.model.series.Series)21 BeforeClass (org.testng.annotations.BeforeClass)15 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)12 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)9 HashMap (java.util.HashMap)9 Property (com.axibase.tsd.api.model.property.Property)8 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)6 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)5 Response (javax.ws.rs.core.Response)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)4 File (java.io.File)4 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)3 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)3 Sample (com.axibase.tsd.api.model.series.Sample)2 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)2 BigDecimal (java.math.BigDecimal)2