use of com.axibase.tsd.api.model.message.MessageQuery in project atsd-api-test by axibase.
the class MessageInsertTest method testISOTimezoneZ.
@Issue("2850")
@Test
public void testISOTimezoneZ() throws Exception {
String entityName = "message-insert-test-isoz";
Message message = new Message(entityName);
message.setMessage("hello");
message.setDate("2017-05-21T00:00:00Z");
String date = "2017-05-21T00:00:00.000Z";
MessageQuery messageQuery = new MessageQuery();
messageQuery.setEntity(entityName);
messageQuery.setStartDate(date);
messageQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
MessageMethod.insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
GenericType<List<Message>> generic = new GenericType<List<Message>>() {
};
List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(generic);
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());
}
use of com.axibase.tsd.api.model.message.MessageQuery in project atsd-api-test by axibase.
the class MessageInsertTest method testISOTimezonePlusHourMinute.
@Issue("2850")
@Test
public void testISOTimezonePlusHourMinute() throws Exception {
String entityName = "message-insert-test-iso+hm";
Message message = new Message(entityName);
message.setMessage("hello");
message.setDate("2017-05-21T01:23:00+01:23");
String date = "2017-05-21T00:00:00.000Z";
MessageQuery messageQuery = new MessageQuery();
messageQuery.setEntity(entityName);
messageQuery.setStartDate(date);
messageQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
MessageMethod.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());
}
use of com.axibase.tsd.api.model.message.MessageQuery in project atsd-api-test by axibase.
the class MessageQueryTest method buildMessageQuery.
private MessageQuery buildMessageQuery() {
MessageQuery messageQuery = new MessageQuery();
messageQuery.setEntity(message.getEntity());
messageQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
return messageQuery;
}
use of com.axibase.tsd.api.model.message.MessageQuery 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());
}
use of com.axibase.tsd.api.model.message.MessageQuery in project atsd-api-test by axibase.
the class MessageQueryTest method testLocalTimeUnsupported.
@Issue("2850")
@Test
public void testLocalTimeUnsupported() throws Exception {
MessageQuery messageQuery = buildMessageQuery();
messageQuery.setStartDate("2017-07-21 00:00:00");
Response response = queryMessageResponse(messageQuery);
assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
JSONAssert.assertEquals("{\"error\":\"IllegalArgumentException: Wrong startDate syntax: 2017-07-21 00:00:00\"}", response.readEntity(String.class), true);
}
Aggregations