Search in sources :

Example 1 with EntityCommand

use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.

the class EntityCommandTest method testModels.

/**
 * Model test
 */
@Test
public void testModels() throws Exception {
    final Entity sourceEntity = new Entity(entity(), Mocks.TAGS);
    sourceEntity.setInterpolationMode(InterpolationMode.PREVIOUS);
    sourceEntity.setLabel(Mocks.LABEL);
    sourceEntity.setTimeZoneID(Mocks.TIMEZONE_ID);
    sourceEntity.setEnabled(true);
    EntityCommand command = new EntityCommand(sourceEntity);
    CommandMethod.send(command);
    String assertMessage = String.format("Inserted entity doesn't exist.%nCommand: %s", command);
    assertEntityExisting(assertMessage, sourceEntity);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Test(org.testng.annotations.Test)

Example 2 with EntityCommand

use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.

the class EntityCommandTest method testAddNewEntityTagsMailformedForNewEntity.

@Issue("3111")
@Test
public void testAddNewEntityTagsMailformedForNewEntity() throws Exception {
    Entity entity = new Entity("ent-for-test-add-tags-mailformed");
    entity.addTag("hello 1", "world");
    PlainCommand command = new EntityCommand(entity);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    assertEquals(expectedResult, CommandMethod.send(command));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 with EntityCommand

use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.

the class TCPSenderTest method testDebugSend.

@Test
public void testDebugSend() throws Exception {
    Entity entity = new Entity(entity(), TAGS);
    entity.setTimeZoneID(TIMEZONE_ID);
    entity.setInterpolationMode(InterpolationMode.LINEAR);
    entity.setLabel(LABEL);
    String result = TCPSender.send(singletonList(new EntityCommand(entity)), true);
    assertEquals("ok", result);
    assertCheck(new EntityCheck(entity));
}
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) Test(org.testng.annotations.Test)

Example 4 with EntityCommand

use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.

the class EntityCommandTest method testUpdateEntityTagsForExistEntity.

@Issue("3111")
@Test
public void testUpdateEntityTagsForExistEntity() throws Exception {
    Entity storedEntityUpdateTags = new Entity("e-for-test-update-tags");
    storedEntityUpdateTags.addTag(E_TAG_1, E_VAL_1);
    createOrReplaceEntityCheck(storedEntityUpdateTags);
    storedEntityUpdateTags.setTags(Collections.singletonMap(E_TAG_1, E_VAL_1_UPD));
    PlainCommand command = new EntityCommand(storedEntityUpdateTags);
    CommandMethod.send(command);
    assertEntityExisting("Entity tag isn't update for existing entity.", storedEntityUpdateTags);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with EntityCommand

use of com.axibase.tsd.api.model.command.EntityCommand in project atsd-api-test by axibase.

the class EntityCommandTest method testNullEnabled.

@Issue("3550")
@Test
public void testNullEnabled() throws Exception {
    Entity entity = new Entity(entity());
    entity.setEnabled(null);
    EntityCommand command = new EntityCommand(entity);
    CommandMethod.send(command);
    Checker.check(new EntityCheck(entity));
    Entity actualEntity = EntityMethod.getEntity(entity.getName());
    assertTrue("Failed to omit enabled", 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

EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)9 Entity (com.axibase.tsd.api.model.entity.Entity)9 Test (org.testng.annotations.Test)9 Issue (io.qameta.allure.Issue)7 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)4 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)4 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1