Search in sources :

Example 1 with Message

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

the class TokenMessageTest method testInsertMethod.

@Test(description = "Tests messages insert endpoint with tokens.")
@Issue("6052")
public void testInsertMethod() throws Exception {
    String url = "/messages/insert";
    String token = TokenRepository.getToken(username, HttpMethod.POST, url);
    Message messageToInsert = new Message(Mocks.entity(), "logger").setMessage(Mocks.message()).setDate(ISO_TIME).setSeverity("NORMAL").setSource("default");
    insertMessageReturnResponse(messageToInsert, token);
    Checker.check(new MessageCheck(messageToInsert));
}
Also used : MessageCheck(com.axibase.tsd.api.method.checks.MessageCheck) Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) MessageTest(com.axibase.tsd.api.method.message.MessageTest) Test(org.testng.annotations.Test)

Example 2 with Message

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

the class TokenMessageTest method prepareData.

@BeforeClass
public void prepareData() {
    message = new Message(entity, "logger").setMessage(Mocks.message()).setDate(ISO_TIME).setSeverity("NORMAL").setSource("default");
    insertMessageCheck(message);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with Message

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

the class DQuoteCharEscapeTest method testType.

@Issue("2854")
@Issue("6319")
@Test
public void testType() throws Exception {
    Message message = new Message(Mocks.entity(), "message-command-\"test-t2");
    message.setMessage("message2");
    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 4 with Message

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

the class DQuoteCharEscapeTest method testText.

@Issue("2854")
@Issue("6319")
@Test
public void testText() throws Exception {
    Message message = new Message(Mocks.entity(), "message-command-test-t3");
    message.setMessage("mess\"age3");
    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 5 with Message

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

the class MessageInsertTest method testISOTimezoneMinusHourMinute.

@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() {
    String entityName = "message-insert-test-iso-hm";
    Message message = new Message(entityName);
    message.setMessage("hello");
    message.setDate("2018-05-20T22:37:00-01:23");
    String date = "2018-05-21T00:00:00.000Z";
    final MessageQuery messageQuery = new MessageQuery();
    messageQuery.setEntity(entityName);
    messageQuery.setStartDate(date);
    messageQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
    insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
    List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages());
    Message storedMessage = storedMessageList.get(0);
    assertEquals("Incorrect message entity", message.getEntity(), storedMessage.getEntity());
    assertEquals("Incorrect message text", message.getMessage(), storedMessage.getMessage());
    assertEquals("Incorrect message date", date, storedMessage.getDate());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Period(com.axibase.tsd.api.model.Period) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

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