Search in sources :

Example 1 with MessageCommand

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

the class BackslashNoEscapeTest method testText.

@Issue("2854")
@Test
public void testText() throws Exception {
    Message message = new Message("message-command-test-e9", "message-command-test-t9");
    message.setMessage("mess\\age9");
    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 2 with MessageCommand

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

the class BackslashNoEscapeTest method testEntity.

@Issue("2854")
@Test
public void testEntity() throws Exception {
    Message message = new Message("message-command-test\\-e7", "message-command-test-t7");
    message.setMessage("message7");
    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 3 with MessageCommand

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

the class DoubleBackslashNoEscapeTest method testEntity.

@Issue("2854")
@Test
public void testEntity() throws Exception {
    Message message = new Message("message-command-test\\\\-e10", "message-command-test-t10");
    message.setMessage("message10");
    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 4 with MessageCommand

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

the class DoubleBackslashNoEscapeTest method testText.

@Issue("2854")
@Test
public void testText() throws Exception {
    Message message = new Message("message-command-test-e12", "message-command-test-t12");
    message.setMessage("mess\\\\age12");
    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 5 with MessageCommand

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

the class LengthTest method testMaxLengthOverflow.

@Issue("2412")
@Test
public void testMaxLengthOverflow() throws Exception {
    final Message message = new Message("e-message-max-len-overflow", "t-message-max-len-overflow");
    message.setDate(getCurrentDate());
    message.setSeverity(Severity.MAJOR.name());
    message.setMessage("");
    MessageCommand command = new MessageCommand(message);
    Integer currentLength = command.compose().length();
    String newMessage = new String(new char[MAX_LENGTH - currentLength + 1]).replace("\0", "m");
    message.setMessage(newMessage);
    command = new MessageCommand(message);
    assertTrue("Command must have overflow length", command.compose().length() > MAX_LENGTH);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    String assertMessage = String.format("Result must contain one failed command with length %s", command.compose().length());
    assertEquals(assertMessage, expectedResult, CommandMethod.send(command));
}
Also used : Message(com.axibase.tsd.api.model.message.Message) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) MessageCommand(com.axibase.tsd.api.model.command.MessageCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)14 Message (com.axibase.tsd.api.model.message.Message)14 Issue (io.qameta.allure.Issue)14 Test (org.testng.annotations.Test)14 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)12 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1