Search in sources :

Example 1 with MessageQuerySizeCheck

use of com.axibase.tsd.api.method.checks.MessageQuerySizeCheck 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());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Period(com.axibase.tsd.api.model.Period) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 2 with MessageQuerySizeCheck

use of com.axibase.tsd.api.method.checks.MessageQuerySizeCheck in project atsd-api-test by axibase.

the class MessageInsertTest method testTimeRangeMinSaved.

@Issue("2957")
@Test
public void testTimeRangeMinSaved() {
    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(ResponseAsList.ofMessages());
    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) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) 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 MessageQuerySizeCheck

use of com.axibase.tsd.api.method.checks.MessageQuerySizeCheck in project atsd-api-test by axibase.

the class MessageInsertTest method testRfc822TimezoneOffsetSupported.

@Issue("2850")
@Issue("5272")
@Test
public void testRfc822TimezoneOffsetSupported() {
    String entityName = "message-insert-test-rfc+hm";
    Message message = new Message(entityName).setMessage("hello").setDate("2018-07-20T22:50:00-0110");
    String date = "2018-07-21T00:00:00.000Z";
    final MessageQuery messageQuery = new MessageQuery().setEntity(entityName).setStartDate(date).setInterval(new Period(1, TimeUnit.MILLISECOND));
    insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
    Message storedMessage = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages()).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) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 4 with MessageQuerySizeCheck

use of com.axibase.tsd.api.method.checks.MessageQuerySizeCheck in project atsd-api-test by axibase.

the class MessageInsertTest method testTrimmedMessages.

@Issue("2903")
@Test
public void testTrimmedMessages() {
    String entityName = "          nurswgvml022    \n    ";
    String messageText = "          NURSWGVML007 ssh: error: connect_to localhost port 8881: failed.     \n     ";
    String type = "      application    \n      ";
    String date = "2018-05-21T00:00:00Z";
    String endDate = "2018-05-21T00:00:01Z";
    Message message = new Message(entityName, type);
    message.setMessage(messageText);
    message.setDate(date);
    MessageQuery messageQuery = new MessageQuery();
    messageQuery.setEntity("nurswgvml022");
    messageQuery.setStartDate(date);
    messageQuery.setEndDate(endDate);
    insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
    List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages());
    Message storedMessage = storedMessageList.get(0);
    assertEquals("nurswgvml022", storedMessage.getEntity());
    assertEquals("NURSWGVML007 ssh: error: connect_to localhost port 8881: failed.", storedMessage.getMessage());
    assertEquals("application", storedMessage.getType());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with MessageQuerySizeCheck

use of com.axibase.tsd.api.method.checks.MessageQuerySizeCheck in project atsd-api-test by axibase.

the class MessageInsertTest method testISOTimezonePlusHourMinute.

@Issue("2850")
@Test
public void testISOTimezonePlusHourMinute() {
    String entityName = "message-insert-test-iso+hm";
    Message message = new Message(entityName);
    message.setMessage("hello");
    message.setDate("2018-05-21T01:23:00+01:23");
    String date = "2018-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(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());
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Period(com.axibase.tsd.api.model.Period) MessageQuerySizeCheck(com.axibase.tsd.api.method.checks.MessageQuerySizeCheck) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

MessageQuerySizeCheck (com.axibase.tsd.api.method.checks.MessageQuerySizeCheck)7 Message (com.axibase.tsd.api.model.message.Message)7 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)7 Issue (io.qameta.allure.Issue)7 Test (org.testng.annotations.Test)7 Period (com.axibase.tsd.api.model.Period)4 Date (java.util.Date)1