Search in sources :

Example 11 with Message

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

the class MessageQueryTest method testISOTimezoneZ.

@Issue("2850")
@Test
public void testISOTimezoneZ() throws Exception {
    MessageQuery messageQuery = buildMessageQuery();
    messageQuery.setStartDate("2018-05-21T00:00:00Z");
    List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(new GenericType<List<Message>>() {
    });
    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", message.getDate(), storedMessage.getDate());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 12 with Message

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

the class MessageQueryTest method testEntityEntitiesWildcardSame.

@Issue("2979")
@Test
public void testEntityEntitiesWildcardSame() throws Exception {
    Message message = new Message("message-query-wildcard-4-1");
    message.setMessage("msgtext");
    message.setDate("2018-01-01T00:00:00.000Z");
    insertMessageCheck(message);
    message.setEntity("message-query-wildcard-4-2");
    insertMessageCheck(message);
    message.setEntity("message-query-wildcard-4-3");
    insertMessageCheck(message);
    final String pattern = "message-query-wildcard-4*";
    Map<String, Object> query = new HashMap<>();
    query.put("entity", pattern);
    query.put("startDate", message.getDate());
    query.put("endDate", Util.addOneMS(message.getDate()));
    final String entitiesResponse = queryMessageResponse(query).readEntity(String.class);
    query.remove("entity");
    query.put("entities", Collections.singletonList(pattern));
    final String entityResponse = queryMessageResponse(query).readEntity(String.class);
    assertEquals("Message in response does not match to inserted", entitiesResponse, entityResponse);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 13 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")
@Test
public void testType() throws Exception {
    Message message = new Message("message-command-test-e2", "message-command-\"test-t2");
    message.setMessage("message2");
    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 14 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")
@Test
public void testText() throws Exception {
    Message message = new Message("message-command-test-e3", "message-command-test-t3");
    message.setMessage("mess\"age3");
    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 15 with Message

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

the class EqualCharEscapeTest method testEscapeText.

@Issue("2854")
@Test
public void testEscapeText() throws Exception {
    Message message = new Message("message-command-test-e6", "message-command-test-t6");
    message.setMessage("mess=age6");
    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)

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