Search in sources :

Example 26 with PlainCommand

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

the class BackslashNoEscapeTest method testType.

@Issue("2854")
@Test
public void testType() throws Exception {
    Message message = new Message("message-command-test-e8", "message-command-\\test-t8");
    message.setMessage("message8");
    message.setDate(getCurrentDate());
    PlainCommand command = new MessageCommand(message);
    CommandMethod.send(command);
    assertMessageExisting("Inserted message can not be received", message);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) MessageCommand(com.axibase.tsd.api.model.command.MessageCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 27 with PlainCommand

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

the class DoubleBackslashNoEscapeTest method testType.

@Issue("2854")
@Test
public void testType() throws Exception {
    Message message = new Message("message-command-test-e11", "message-command-\\\\test-t11");
    message.setMessage("message11");
    message.setDate(getCurrentDate());
    PlainCommand command = new MessageCommand(message);
    CommandMethod.send(command);
    assertMessageExisting("Inserted message can not be received", message);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) MessageCommand(com.axibase.tsd.api.model.command.MessageCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 28 with PlainCommand

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

the class BackslashCharEscapeTest method testEntity.

@Issue("2854")
@Test
public void testEntity() throws Exception {
    Property property = new Property("property-command-test-t6", "property-command-test\\-e6");
    property.setTags(DEFAULT_PROPERTY_TAGS);
    property.setDate(getCurrentDate());
    PlainCommand command = new PropertyCommand(property);
    CommandMethod.send(command);
    assertPropertyExisting("Inserted property can not be received", property);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 29 with PlainCommand

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

the class DoubleBackslashCharEscapeTest method testEntity.

@Issue("2854")
@Test
public void testEntity() throws Exception {
    Property property = new Property("property-command-test-t8", "property-command-test\\\\-e8");
    property.setTags(DEFAULT_PROPERTY_TAGS);
    property.setDate(getCurrentDate());
    PlainCommand command = new PropertyCommand(property);
    CommandMethod.send(command);
    assertPropertyExisting("Inserted property can not be received", property);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 30 with PlainCommand

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

the class LengthTest method testMaxLengthOverflow.

@Issue("2412")
@Test
public void testMaxLengthOverflow() throws Exception {
    final Property property = new Property(propertyType(), entity());
    property.setDate(Mocks.ISO_TIME);
    property.setKey(Collections.EMPTY_MAP);
    property.addTag("type", property.getType());
    PlainCommand command = new PropertyCommand(property);
    Integer currentLength = command.compose().length();
    for (int i = 0; currentLength < MAX_LENGTH + 1; i++) {
        String tagName = "name" + i;
        String textValue = "sda" + i;
        currentLength += String.format(" v:%s=%s", tagName, textValue).length();
        property.addTag(tagName, textValue);
    }
    command = new PropertyCommand(property);
    CommandSendingResult actualResult = CommandMethod.send(command);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    assertTrue("Command length is not greater than max", MAX_LENGTH < currentLength);
    assertEquals("Managed to insert command that length is overflow max", expectedResult, actualResult);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)32 Issue (io.qameta.allure.Issue)31 Test (org.testng.annotations.Test)31 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)12 Message (com.axibase.tsd.api.model.message.Message)12 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)10 Property (com.axibase.tsd.api.model.property.Property)10 CommandMethodTest (com.axibase.tsd.api.extended.CommandMethodTest)5 SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)5 Series (com.axibase.tsd.api.model.series.Series)5 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)4 Entity (com.axibase.tsd.api.model.entity.Entity)4 ArrayList (java.util.ArrayList)4 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)2 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)1 IOException (java.io.IOException)1