Search in sources :

Example 36 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("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));
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 37 with Message

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()));
    }
}
Also used : Message(com.axibase.tsd.api.model.message.Message) Severity(com.axibase.tsd.api.model.message.Severity) Date(java.util.Date) BeforeClass(org.testng.annotations.BeforeClass)

Example 38 with Message

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);
}
Also used : Response(javax.ws.rs.core.Response) Message(com.axibase.tsd.api.model.message.Message) MessageQuery(com.axibase.tsd.api.model.message.MessageQuery)

Example 39 with Message

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

Example 40 with Message

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);
}
Also used : Message(com.axibase.tsd.api.model.message.Message) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) MessageCommand(com.axibase.tsd.api.model.command.MessageCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Message (com.axibase.tsd.api.model.message.Message)43 Test (org.testng.annotations.Test)36 Issue (io.qameta.allure.Issue)35 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)14 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)13 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)12 MessageQuerySizeCheck (com.axibase.tsd.api.method.checks.MessageQuerySizeCheck)7 Response (javax.ws.rs.core.Response)6 Period (com.axibase.tsd.api.model.Period)4 BeforeClass (org.testng.annotations.BeforeClass)3 Date (java.util.Date)2 MessageCheck (com.axibase.tsd.api.method.checks.MessageCheck)1 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)1 MessageTest (com.axibase.tsd.api.method.message.MessageTest)1 PropertyTest (com.axibase.tsd.api.method.property.PropertyTest)1 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)1 Severity (com.axibase.tsd.api.model.message.Severity)1 HashSet (java.util.HashSet)1