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("2105-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));
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class MessageSeverityQueryTest method insertMessages.
@BeforeClass
public void insertMessages() throws Exception {
message = new Message("message-query-test-severity");
message.setMessage("message-text");
calendar.setTime(new Date());
calendar.add(Calendar.YEAR, -1);
calendar.add(Calendar.DAY_OF_YEAR, 1);
message.setDate(calendar.getTime());
for (Severity severity : values()) {
message.setSeverity(severity.name());
insertMessageCheck(message);
message.setDate(Util.addOneMS(message.getDate()));
}
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class ParserEncodingTest method checkCsvCorrectTextEncoding.
private void checkCsvCorrectTextEncoding(String controlSequence, String entityName, File csvPath, String textEncoding) {
Registry.Entity.checkExists(entityName);
Response response = binaryCsvUpload(csvPath, PARSER_NAME, textEncoding, null);
assertSame(Response.Status.Family.SUCCESSFUL, Util.responseFamily(response));
MessageQuery query = new MessageQuery();
query.setEntity(entityName);
query.setStartDate(MIN_QUERYABLE_DATE);
query.setEndDate(MAX_QUERYABLE_DATE);
assertMessageQuerySize(query, 1);
List<Message> messageList = MessageMethod.queryMessage(query);
assertEquals("Unexpected message body", messageList.get(0).getMessage(), controlSequence);
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class MessageSeverityQueryTest method testMinSeverityFilter.
@Issue("2917")
@Test(dataProvider = "severities", description = "minSeverity is >= filter")
public void testMinSeverityFilter(Severity severity) throws Exception {
String key = severity.name();
Integer minimumSeverity = severity.getNumVal();
messageQuery.setMinSeverity(key);
List<Message> messages = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages());
for (Message m : messages) {
int actualSeverity = valueOf(m.getSeverity()).getNumVal();
String errMessage = String.format("Received severity (%d) should be greater than minSeverity (%d)", actualSeverity, minimumSeverity);
assertTrue(errMessage, actualSeverity >= minimumSeverity);
}
}
use of com.axibase.tsd.api.model.message.Message in project atsd-api-test by axibase.
the class BackslashNoEscapeTest method testType.
@Issue("2854")
@Test
public void testType() throws Exception {
Message message = new Message(Mocks.entity(), "message-command-\\test-t8");
message.setMessage("message8");
message.setDate(getCurrentDate());
PlainCommand command = new MessageCommand(message);
transport.send(command);
assertMessageExisting("Inserted message can not be received", message);
}
Aggregations