Search in sources :

Example 31 with Message

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

the class MessageInsertTest method testTimeRangeMaxTimeOverflow.

@Issue("2957")
@Test
public void testTimeRangeMaxTimeOverflow() throws Exception {
    Message message = new Message("e-time-range-msg-4");
    message.setMessage("msg-time-range-msg-4");
    message.setDate(addOneMS(MAX_STORABLE_DATE));
    Boolean success = insertMessage(message);
    if (success) {
        fail("Managed to insert message with date out of range");
    }
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 32 with Message

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

the class MessageQueryTest method testEntitiesWildcardStarChar.

@Issue("2979")
@Test
public void testEntitiesWildcardStarChar() throws Exception {
    Message message = new Message("message-query-wildcard-2-1");
    message.setMessage("msgtext");
    message.setDate("2018-01-01T00:00:00.000Z");
    insertMessageCheck(message);
    Map<String, Object> query = new HashMap<>();
    query.put("entities", Arrays.asList("message-query-wildcard-2*"));
    query.put("startDate", message.getDate());
    query.put("endDate", Util.addOneMS(message.getDate()));
    final String given = queryMessageResponse(query).readEntity(String.class);
    final String expected = jacksonMapper.writeValueAsString(Arrays.asList(message));
    assertTrue("Message in response does not match to inserted", compareJsonString(expected, given));
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 33 with Message

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

the class MessageQueryTest method testISOTimezoneMinusHourMinute.

@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() throws Exception {
    MessageQuery messageQuery = buildMessageQuery();
    messageQuery.setStartDate("2018-05-20T22:37:00-01:23");
    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 34 with Message

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

the class MessageQueryTest method testISOTimezonePlusHourMinute.

@Issue("2850")
@Test
public void testISOTimezonePlusHourMinute() throws Exception {
    MessageQuery messageQuery = buildMessageQuery();
    messageQuery.setStartDate("2018-05-21T01:23:00+01:23");
    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 35 with Message

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

the class MessageQueryTest method testEntitiesWildcardQuestionChar.

@Issue("2979")
@Test
public void testEntitiesWildcardQuestionChar() throws Exception {
    Message message = new Message("message-query-wildcard-3-1");
    message.setMessage("msgtext");
    message.setDate("2018-01-01T00:00:00.000Z");
    insertMessageCheck(message);
    Map<String, Object> query = new HashMap<>();
    query.put("entities", Arrays.asList("message-query-wildcard-3-?"));
    query.put("startDate", message.getDate());
    query.put("endDate", Util.addOneMS(message.getDate()));
    final String given = queryMessageResponse(query).readEntity(String.class);
    final String expected = jacksonMapper.writeValueAsString(Arrays.asList(message));
    assertTrue("Message in response does not match to inserted", compareJsonString(expected, given));
}
Also used : Message(com.axibase.tsd.api.model.message.Message) 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