Search in sources :

Example 6 with Entity

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

Example 7 with Entity

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());
}
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 8 with Entity

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

Example 9 with Entity

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

Example 10 with Entity

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());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) 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