Search in sources :

Example 1 with MessageQuery

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

the class MessageInsertTest method testISOTimezoneMinusHourMinute.

@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() throws Exception {
    String entityName = "message-insert-test-iso-hm";
    Message message = new Message(entityName);
    message.setMessage("hello");
    message.setDate("2017-05-20T22:37:00-01:23");
    String date = "2017-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(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", date, storedMessage.getDate());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Period(com.axibase.tsd.api.model.Period) List(java.util.List) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 2 with MessageQuery

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

the class MessageInsertTest method testTimeRangeMinSaved.

@Issue("2957")
@Test
public void testTimeRangeMinSaved() throws Exception {
    Message message = new Message("e-time-range-msg-1");
    message.setMessage("msg-time-range-msg-1");
    calendar.setTime(new Date());
    calendar.add(Calendar.YEAR, -1);
    calendar.add(Calendar.DAY_OF_YEAR, 1);
    message.setDate(calendar.getTime());
    MessageQuery messageQuery = new MessageQuery();
    messageQuery.setEntity(message.getEntity());
    messageQuery.setStartDate(MIN_QUERYABLE_DATE);
    messageQuery.setEndDate(MAX_QUERYABLE_DATE);
    insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
    List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(new GenericType<List<Message>>() {
    });
    Message msgResponse = storedMessageList.get(0);
    assertEquals("Incorrect stored date", message.getDate(), msgResponse.getDate());
    assertEquals("Incorrect stored message", message.getMessage(), msgResponse.getMessage());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) List(java.util.List) Date(java.util.Date) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 with MessageQuery

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

the class MessageQueryTest method testXXTimezoneUnsupported.

@Issue("2850")
@Test
public void testXXTimezoneUnsupported() throws Exception {
    MessageQuery messageQuery = buildMessageQuery();
    messageQuery.setStartDate("2017-07-20T22:50:00-0110");
    Response response = queryMessageResponse(messageQuery);
    assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
    JSONAssert.assertEquals("{\"error\":\"IllegalArgumentException: Wrong startDate syntax: 2017-07-20T22:50:00-0110\"}", response.readEntity(String.class), true);
}
Also used : Response(javax.ws.rs.core.Response) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 4 with MessageQuery

use of com.axibase.tsd.api.model.message.MessageQuery 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 5 with MessageQuery

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

the class MessageQueryTest method testMillisecondsUnsupported.

@Issue("2850")
@Test
public void testMillisecondsUnsupported() throws Exception {
    MessageQuery messageQuery = buildMessageQuery();
    messageQuery.setStartDate("1500595200000");
    Response response = queryMessageResponse(messageQuery);
    assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
    JSONAssert.assertEquals("{\"error\":\"IllegalArgumentException: Wrong startDate syntax: 1500595200000\"}", response.readEntity(String.class), true);
}
Also used : Response(javax.ws.rs.core.Response) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)16 Issue (io.qameta.allure.Issue)12 Test (org.testng.annotations.Test)12 Message (com.axibase.tsd.api.model.message.Message)10 List (java.util.List)6 Response (javax.ws.rs.core.Response)5 Period (com.axibase.tsd.api.model.Period)4 Date (java.util.Date)1 GenericType (javax.ws.rs.core.GenericType)1 BeforeMethod (org.testng.annotations.BeforeMethod)1