Search in sources :

Example 41 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")
@Issue("6319")
@Test
public void testType() throws Exception {
    Message message = new Message(Mocks.entity(), "message-command-\\\\test-t11");
    message.setMessage("message11");
    message.setDate(getCurrentDate());
    PlainCommand command = new MessageCommand(message);
    transport.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 42 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")
@Issue("6319")
@Test
public void testMaxLength() throws Exception {
    final Message message = new Message(Mocks.entity(), "t-message-max-cmd-length");
    message.setDate(getCurrentDate());
    message.setSeverity(Severity.MAJOR.name());
    String msg = "Length-Test-";
    message.setMessage(msg);
    MessageCommand command = new MessageCommand(message);
    int currentLength = command.compose().length();
    message.setMessage(msg + StringUtils.repeat('m', MAX_LENGTH - currentLength));
    command = new MessageCommand(message);
    assertEquals("Command length is not maximal", MAX_LENGTH, command.compose().length());
    transport.sendNoDebug(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 43 with Message

use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.

the class MessageQuerySizeCheck method isChecked.

@Override
public boolean isChecked() {
    Response response = MessageMethod.queryMessageResponse(query);
    if (Response.Status.Family.SUCCESSFUL != Util.responseFamily(response)) {
        return false;
    }
    List<Message> storedMessageList = response.readEntity(ResponseAsList.ofMessages());
    return storedMessageList.size() == size;
}
Also used : Response(javax.ws.rs.core.Response) Message(com.axibase.tsd.api.model.message.Message)

Aggregations

Message (com.axibase.tsd.api.model.message.Message)43 Test (org.testng.annotations.Test)36 Issue (io.qameta.allure.Issue)35 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)14 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)13 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)12 MessageQuerySizeCheck (com.axibase.tsd.api.method.checks.MessageQuerySizeCheck)7 Response (javax.ws.rs.core.Response)6 Period (com.axibase.tsd.api.model.Period)4 BeforeClass (org.testng.annotations.BeforeClass)3 Date (java.util.Date)2 MessageCheck (com.axibase.tsd.api.method.checks.MessageCheck)1 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)1 MessageTest (com.axibase.tsd.api.method.message.MessageTest)1 PropertyTest (com.axibase.tsd.api.method.property.PropertyTest)1 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)1 Severity (com.axibase.tsd.api.model.message.Severity)1 HashSet (java.util.HashSet)1