Search in sources :

Example 1 with MessageCheck

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

the class TokenMessageTest method testInsertMethod.

@Test(description = "Tests messages insert endpoint with tokens.")
@Issue("6052")
public void testInsertMethod() throws Exception {
    String url = "/messages/insert";
    String token = TokenRepository.getToken(username, HttpMethod.POST, url);
    Message messageToInsert = new Message(Mocks.entity(), "logger").setMessage(Mocks.message()).setDate(ISO_TIME).setSeverity("NORMAL").setSource("default");
    insertMessageReturnResponse(messageToInsert, token);
    Checker.check(new MessageCheck(messageToInsert));
}
Also used : MessageCheck(com.axibase.tsd.api.method.checks.MessageCheck) Message(com.axibase.tsd.api.model.message.Message) Issue(io.qameta.allure.Issue) MessageTest(com.axibase.tsd.api.method.message.MessageTest) Test(org.testng.annotations.Test)

Example 2 with MessageCheck

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

the class MessageTest method assertMessageExist.

/**
 * Try to find provided message in ATSD, and check that found message has the same values of the specified
 * fields as the provided message.
 */
public static void assertMessageExist(Message message, String... fields) {
    String assertMessage = String.format("Fail to find in ATSD message: %s", message);
    try {
        Check messageCheck = new Check(assertMessage, () -> MessageMethod.messageExistWithSameFields(message, "entity", "message"));
        Checker.check(messageCheck, 10, TimeUnit.SECONDS);
    } catch (NotCheckedException e) {
        fail(assertMessage);
    }
}
Also used : NotCheckedException(com.axibase.tsd.api.util.NotCheckedException) AbstractCheck(com.axibase.tsd.api.method.checks.AbstractCheck) Check(com.axibase.tsd.api.method.checks.Check) MessageCheck(com.axibase.tsd.api.method.checks.MessageCheck)

Aggregations

MessageCheck (com.axibase.tsd.api.method.checks.MessageCheck)2 AbstractCheck (com.axibase.tsd.api.method.checks.AbstractCheck)1 Check (com.axibase.tsd.api.method.checks.Check)1 MessageTest (com.axibase.tsd.api.method.message.MessageTest)1 Message (com.axibase.tsd.api.model.message.Message)1 NotCheckedException (com.axibase.tsd.api.util.NotCheckedException)1 Issue (io.qameta.allure.Issue)1 Test (org.testng.annotations.Test)1