Search in sources :

Example 21 with Message

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()));
    }
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Severity(com.axibase.tsd.api.model.message.Severity) Date(java.util.Date) BeforeClass(org.testng.annotations.BeforeClass)

Example 22 with Message

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);
}
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 23 with 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);
}
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 24 with 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);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) MessageCommand(com.axibase.tsd.api.model.command.MessageCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 25 with 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);
}
Also used : Response(javax.ws.rs.core.Response) Message(com.axibase.tsd.api.model.message.Message) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery)

Aggregations

Message (com.axibase.tsd.api.model.message.Message)35 Issue (io.qameta.allure.Issue)32 Test (org.testng.annotations.Test)32 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)14 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)12 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)10 List (java.util.List)8 Response (javax.ws.rs.core.Response)4 Period (com.axibase.tsd.api.model.Period)3 Date (java.util.Date)2 BeforeClass (org.testng.annotations.BeforeClass)2 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1 Severity (com.axibase.tsd.api.model.message.Severity)1 GenericType (javax.ws.rs.core.GenericType)1