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));
}
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);
}
}
Aggregations