Search in sources :

Example 6 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TradeEntityTest method prepareData.

@BeforeClass
public void prepareData() throws Exception {
    Entity entity = new Entity();
    entity.setName(entity());
    Entity entityTwo = new Entity();
    entityTwo.setName(entityTwo());
    Trade tradeOne = fromISOString("2020-06-15T10:21:49.123456Z").setPrice(BigDecimal.ONE);
    Trade tradeTwo = fromISOString("2020-06-15T12:21:49.123456Z").setSymbol(symbolTwo()).setPrice(BigDecimal.TEN);
    insert(tradeOne, tradeTwo);
    Checker.check(new EntityCheck(entity));
    Checker.check(new EntityCheck(entityTwo));
    entity.setTags(TestUtil.createTags("a", "10", "b", "abc"));
    entity.setLabel("entity1");
    EntityMethod.updateEntity(entity);
    entityTwo.setEnabled(false);
    entityTwo.setLabel("entity2");
    entityTwo.setTags(TestUtil.createTags("a", "15", "b", "def"));
    EntityMethod.updateEntity(entityTwo);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Trade(com.axibase.tsd.api.model.financial.Trade) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class SqlInsertNonExistentEntityTest method testEntityCreationWithAtsdSeriesWhenInserting.

@Test(description = "Tests that entity is created after INSERT INTO command with atsd_series if it did not exist.")
@Issue("5962")
public void testEntityCreationWithAtsdSeriesWhenInserting() {
    Entity entity = new Entity(Mocks.entity());
    String sqlQuery = insertionType.insertionQuery("atsd_series", ImmutableMap.of("entity", entity.getName(), "datetime", ISO_TIME, String.format("\"%s\"", metric), VALUE));
    assertOkRequest("Insertion of series with nonexistent entity via atsd_series failed!", sqlQuery);
    Checker.check(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 8 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class SqlInsertNonExistentEntityTest method testEntityCreationWhenInserting.

@Test(description = "Tests that entity is created after INSERT INTO command if it did not exist.")
@Issue("5962")
public void testEntityCreationWhenInserting() {
    Entity entity = new Entity(Mocks.entity());
    String sqlQuery = insertionType.insertionQuery(metric, ImmutableMap.of("entity", entity.getName(), "datetime", ISO_TIME, "value", VALUE));
    assertOkRequest("Insertion of series with nonexistent entity failed!", sqlQuery);
    Checker.check(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 9 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TokenEntityTest method testUpdateMethod.

@Test(description = "Tests entity update endpoint.")
@Issue("6052")
public void testUpdateMethod() throws Exception {
    String entityName = Mocks.entity();
    String url = "/entities/" + entityName;
    String token = TokenRepository.getToken(username, "PATCH", url);
    Entity entity = new Entity(entityName);
    createOrReplaceEntityCheck(entity);
    entity.setLabel(Mocks.LABEL);
    updateEntity(entity, token);
    Checker.check(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) EntityTest(com.axibase.tsd.api.method.entity.EntityTest) Test(org.testng.annotations.Test)

Example 10 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class DualTokenTest method testFirstUrl.

@Test(description = "Tests work of first url with dual token.")
@Issue("6052")
public void testFirstUrl() {
    Entity entity = new Entity(entityName);
    EntityMethod.createOrReplaceEntity(entity, token);
    Checker.check(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)16 Entity (com.axibase.tsd.api.model.entity.Entity)16 Test (org.testng.annotations.Test)13 Issue (io.qameta.allure.Issue)12 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)4 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)4 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)3 BeforeClass (org.testng.annotations.BeforeClass)3 DeletionCheck (com.axibase.tsd.api.method.checks.DeletionCheck)1 StringCommand (com.axibase.tsd.api.model.command.StringCommand)1 Trade (com.axibase.tsd.api.model.financial.Trade)1 Property (com.axibase.tsd.api.model.property.Property)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1