Search in sources :

Example 11 with EntityCheck

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

the class SqlInsertNonExistentEntityTest method testEntityCreationWithLabelWhenInserting.

@Test(description = "Tests that entity with label is created after INSERT INTO command if it did not exist.")
@Issue("5962")
public void testEntityCreationWithLabelWhenInserting() {
    Entity entity = new Entity(Mocks.entity()).setLabel(Mocks.LABEL);
    String sqlQuery = insertionType.insertionQuery(metric, ImmutableMap.of("entity", entity.getName(), "datetime", ISO_TIME, "value", VALUE, "entity.label", entity.getLabel()));
    assertOkRequest("Insertion of series with nonexistent entity with label 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 12 with EntityCheck

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

the class SqlInsertNonExistentEntityTest method testEntityCreationWithWhitespacesWhenInserting.

@Test(description = "Tests that entity with whitespaces in is created after INSERT INTO command if it did not exist.")
@Issue("5962")
public void testEntityCreationWithWhitespacesWhenInserting() {
    String entityNameWithWhiteSpaces = Mocks.entity().replaceAll("-", " ");
    Entity entity = new Entity(entityNameWithWhiteSpaces.replaceAll(" ", "_"));
    String sqlQuery = insertionType.insertionQuery(metric, ImmutableMap.of("entity", entityNameWithWhiteSpaces, "datetime", ISO_TIME, "value", VALUE));
    assertOkRequest("Insertion of series with nonexistent entity with whitespaces in name 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 13 with EntityCheck

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

the class EntityCommandTest method testNullEnabled.

@Issue("3550")
@Issue("6319")
@Test
public void testNullEnabled() throws Exception {
    Entity entity = new Entity(Mocks.entity());
    entity.setEnabled(null);
    EntityCommand command = new EntityCommand(entity);
    String assertMessage = "Failed to omit enabled";
    assertTrue(assertMessage, transport.send(command));
    Checker.check(new EntityCheck(entity));
    Entity actualEntity = EntityMethod.getEntity(entity.getName());
    assertTrue(assertMessage, actualEntity.getEnabled());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 14 with EntityCheck

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

the class EntityCommandTest method testRawEnabled.

@Issue("3550")
@Issue("6319")
@Test(dataProvider = "correctEnabledProvider")
public void testRawEnabled(String enabled) throws Exception {
    String entityName = Mocks.entity();
    Entity entity = new Entity(entityName);
    StringCommand command = new StringCommand(String.format("entity  e:%s b:%s", entityName, enabled));
    String assertMessage = "Failed to set enabled (raw)";
    assertTrue(assertMessage, transport.send(command));
    Checker.check(new EntityCheck(entity));
    Entity actualEntity = EntityMethod.getEntity(entityName);
    assertEquals(assertMessage, enabled.replaceAll("[\\'\\\"]", ""), actualEntity.getEnabled().toString());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) StringCommand(com.axibase.tsd.api.model.command.StringCommand) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 15 with EntityCheck

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

the class EntityCommandTest method testEnabled.

@Issue("3550")
@Issue("6319")
@Test
public void testEnabled() throws Exception {
    Entity entity = new Entity(Mocks.entity());
    entity.setEnabled(true);
    EntityCommand command = new EntityCommand(entity);
    String assertMessage = "Failed to set enabled";
    assertTrue(assertMessage, transport.send(command));
    Checker.check(new EntityCheck(entity));
    Entity actualEntity = EntityMethod.getEntity(entity.getName());
    assertTrue(assertMessage, actualEntity.getEnabled());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) 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