Search in sources :

Example 11 with MessageStatsQuery

use of com.axibase.tsd.api.model.message.MessageStatsQuery 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'");
}
Also used : MessageStatsQuery(com.axibase.tsd.api.model.message.MessageStatsQuery) Response(javax.ws.rs.core.Response) MessageStats(com.axibase.tsd.api.model.message.MessageStats) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 12 with MessageStatsQuery

use of com.axibase.tsd.api.model.message.MessageStatsQuery in project atsd-api-test by axibase.

the class MessageQueryStatsTest method testAggregateCount.

@Issue("2945")
@Test(enabled = false)
public void testAggregateCount() {
    MessageStatsQuery statsQuery = prepareSimpleMessageStatsQuery(MESSAGE_STATS_ENTITY);
    statsQuery.setAggregate(new Aggregate(AggregationType.COUNT));
    List<Series> messageStatsList = queryMessageStatsReturnSeries(statsQuery);
    assertEquals("Response should contain only 1 series", 1, messageStatsList.size());
    List<Sample> samples = messageStatsList.get(0).getData();
    assertEquals("Response should contain only 1 sample", 1, samples.size());
    assertEquals("Message count mismatch", new BigDecimal(DATES.size()), samples.get(0).getValue());
}
Also used : MessageStatsQuery(com.axibase.tsd.api.model.message.MessageStatsQuery) Series(com.axibase.tsd.api.model.series.Series) Sample(com.axibase.tsd.api.model.series.Sample) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 13 with MessageStatsQuery

use of com.axibase.tsd.api.model.message.MessageStatsQuery in project atsd-api-test by axibase.

the class MessageQueryStatsTest method testAggregateNoTypeRaiseError.

@Issue("2945")
@Test
public void testAggregateNoTypeRaiseError() {
    MessageStatsQuery statsQuery = prepareSimpleMessageStatsQuery(MESSAGE_STATS_ENTITY);
    statsQuery.setAggregate(new Aggregate());
    Response response = queryMessageStats(statsQuery);
    assertEquals("Query with unknown aggregate type should fail", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
}
Also used : MessageStatsQuery(com.axibase.tsd.api.model.message.MessageStatsQuery) Response(javax.ws.rs.core.Response) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

MessageStatsQuery (com.axibase.tsd.api.model.message.MessageStatsQuery)13 Issue (io.qameta.allure.Issue)12 Test (org.testng.annotations.Test)12 Response (javax.ws.rs.core.Response)9 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)5 BigDecimal (java.math.BigDecimal)4 MessageStats (com.axibase.tsd.api.model.message.MessageStats)3 Sample (com.axibase.tsd.api.model.series.Sample)3 Series (com.axibase.tsd.api.model.series.Series)3 MessageTest (com.axibase.tsd.api.method.message.MessageTest)1 Period (com.axibase.tsd.api.model.Period)1