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