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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations