use of com.axibase.tsd.api.model.message.MessageStats in project atsd-api-test by axibase.
the class MessageQueryStatsTest method testTagsExpressionNoData.
@Issue("6460")
@Test(description = "Tests that messages are not found for expression that does not match any field.")
public void testTagsExpressionNoData() {
MessageStatsQuery statsQuery = prepareSimpleMessageStatsQuery(MESSAGE_STATS_ENTITY).setTagExpression("false");
Response response = queryMessageStats(statsQuery);
List<MessageStats> messageStatsList = response.readEntity(ResponseAsList.ofMessageStats());
assertEquals(1, messageStatsList.size());
MessageStats stats = messageStatsList.get(0);
assertEquals(stats.getData().size(), 0);
}
use of com.axibase.tsd.api.model.message.MessageStats in project atsd-api-test by axibase.
the class MessageQueryStatsTest method testTagsExpressionSelection.
@Issue("6460")
@Test(description = "Tests that messages are found for matching tagExpression field.")
public void testTagsExpressionSelection() {
MessageStatsQuery statsQuery = prepareSimpleMessageStatsQuery(MESSAGE_STATS_ENTITY).setTagExpression("tags.key='value'");
Response response = queryMessageStats(statsQuery);
List<MessageStats> messageStatsList = response.readEntity(ResponseAsList.ofMessageStats());
assertEquals(1, messageStatsList.size());
MessageStats stats = messageStatsList.get(0);
BigDecimal value = stats.getData().get(0).getValue();
// dates count and messages count are equal
assertEquals(value, BigDecimal.valueOf(DATES.size()));
}
use of com.axibase.tsd.api.model.message.MessageStats in project atsd-api-test by axibase.
the class MessageQueryStatsTest method testTagsExpressionError.
@Issue("6460")
@Test(description = "Tests that warning is returned if executing query with invalid expression. Error in \"lke\"")
public void testTagsExpressionError() {
MessageStatsQuery statsQuery = prepareSimpleMessageStatsQuery(MESSAGE_STATS_ENTITY).setTagExpression("type lke 'something'");
Response response = queryMessageStats(statsQuery);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
List<MessageStats> messageStatsList = response.readEntity(ResponseAsList.ofMessageStats());
assertEquals(1, messageStatsList.size());
String warning = messageStatsList.get(0).getWarning();
assertEquals(warning, "IllegalStateException: Syntax error at line 1 position 5: no viable alternative at input 'type lke'");
}
Aggregations