use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class MessageSeverityQueryTest method insertMessages.
@BeforeClass
public void insertMessages() throws Exception {
message = new Message("message-query-test-severity");
message.setMessage("message-text");
calendar.setTime(new Date());
calendar.add(Calendar.YEAR, -1);
calendar.add(Calendar.DAY_OF_YEAR, 1);
message.setDate(calendar.getTime());
for (Severity severity : values()) {
message.setSeverity(severity.name());
insertMessageCheck(message);
message.setDate(Util.addOneMS(message.getDate()));
}
}
use of com.axibase.tsd.api.model.message.Message 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);
}
use of com.axibase.tsd.api.model.message.Message 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);
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class LengthTest method testMaxLength.
@Issue("2412")
@Test
public void testMaxLength() throws Exception {
final Message message = new Message("e-message-max-cmd-length", "t-message-max-cmd-length");
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]).replace("\0", "m");
message.setMessage(newMessage);
command = new MessageCommand(message);
assertEquals("Command length is not maximal", command.compose().length(), MAX_LENGTH);
CommandMethod.send(command);
assertMessageExisting("Inserted message can not be received", message);
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class ParserEncodingTest method checkCsvCorrectTextEncoding.
private void checkCsvCorrectTextEncoding(String controlSequence, String entityName, File csvPath, String textEncoding) throws Exception {
Registry.Entity.checkExists(entityName);
Response response = binaryCsvUpload(csvPath, PARSER_NAME, textEncoding, null);
assertEquals(response.getStatus(), OK.getStatusCode());
MessageQuery query = new MessageQuery();
query.setEntity(entityName);
query.setStartDate(MIN_QUERYABLE_DATE);
query.setEndDate(MAX_QUERYABLE_DATE);
assertMessageQuerySize(query, 1);
List<Message> messageList = MessageMethod.queryMessage(query);
assertEquals("Unexpected message body", messageList.get(0).getMessage(), controlSequence);
}
Aggregations