use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class SeriesQueryTest method testGroupInterpolateNoTypeRaiseError.
@Issue("3324")
@Test
public void testGroupInterpolateNoTypeRaiseError() throws Exception {
SeriesQuery query = new SeriesQuery("mock-entity", "mock-metric", MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
Group group = new Group(GroupType.SUM, new Period(99999, TimeUnit.QUARTER));
group.setInterpolate(new AggregationInterpolate());
query.setGroup(group);
Response response = querySeries(query);
assertEquals("Query with interpolation but without type should fail", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", INTERPOLATE_TYPE_REQUIRED, extractErrorMessage(response));
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class GroupingTest method testCases.
@DataProvider
public Object[][] testCases() {
Period period = new Period(1, MINUTE);
Group groupCount = new Group(GroupType.COUNT);
Group groupCountPerMinute = new Group(GroupType.COUNT, period);
Group groupSumPerMinute = new Group(GroupType.SUM, period);
Aggregate aggregateSum = new Aggregate(AggregationType.SUM, period);
Aggregate aggregateCount = new Aggregate(AggregationType.COUNT, period);
SeriesQuery[] testCases = { buildQuery(groupCountPerMinute, null, Arrays.asList(Transformation.GROUP)), // buildQuery(groupCount, aggregateSum, Arrays.asList(Transformation.GROUP, Transformation.AGGREGATE)),
buildQuery(groupCountPerMinute, aggregateSum, Arrays.asList(Transformation.GROUP, Transformation.AGGREGATE)), buildQuery(groupSumPerMinute, aggregateCount, Arrays.asList(Transformation.AGGREGATE, Transformation.GROUP)) };
return TestUtil.convertTo2DimArray(testCases);
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class TradeSideTest method testCases.
@DataProvider
public Object[][] testCases() {
Period aMinute = new Period(1, MINUTE);
List<TestCase> testCases = new ArrayList<>();
addTestCases("2020-12-01T00:00:00Z", "2020-12-02T00:00:00Z", false, null, new int[] { 1, 3, 4, 6 }, new int[] { 2, 5 }, testCases);
addTestCases("2020-12-01T10:57:00Z", "2020-12-01T10:59:00Z", false, null, null, new int[] { 2 }, testCases);
addTestCases("2020-12-01T10:59:00Z", "2020-12-01T11:02:00Z", false, null, new int[] { 3, 4 }, null, testCases);
addTestCases("2020-12-01T00:00:00Z", "2020-12-02T00:00:00Z", true, null, new int[] { 6 }, new int[] { 5 }, testCases);
addTestCases("2020-12-01T10:57:00Z", "2020-12-01T10:59:00Z", true, null, null, new int[] { 2 }, testCases);
addTestCases("2020-12-01T10:59:00Z", "2020-12-01T11:02:00Z", true, null, new int[] { 4 }, null, testCases);
addTestCases("2020-12-01T00:00:00Z", "2020-12-02T00:00:00Z", true, new Period(1, HOUR), new int[] { 3, 6 }, new int[] { 2, 5 }, testCases);
addTestCases("2020-12-01T00:00:00Z", "2020-12-02T00:00:00Z", true, new Period(5, MINUTE), new int[] { 3, 4, 6 }, new int[] { 2, 5 }, testCases);
addTestCases("2020-12-01T10:57:00Z", "2020-12-01T10:59:00Z", true, aMinute, null, new int[] { 2 }, testCases);
addTestCases("2020-12-01T10:59:00Z", "2020-12-01T11:02:00Z", true, aMinute, new int[] { 3, 4 }, null, testCases);
addTestCases("2020-12-01T11:03:00Z", "2020-12-01T11:06:00Z", false, null, null, null, testCases);
addTestCases("2020-12-01T11:03:00Z", "2020-12-01T11:06:00Z", true, null, null, null, testCases);
addTestCases("2020-12-01T11:03:00Z", "2020-12-01T11:06:00Z", false, aMinute, null, null, testCases);
return TestUtil.convertTo2DimArray(testCases);
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class MessageInsertTest method testISOTimezoneMinusHourMinute.
@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() {
String entityName = "message-insert-test-iso-hm";
Message message = new Message(entityName);
message.setMessage("hello");
message.setDate("2018-05-20T22:37:00-01:23");
String date = "2018-05-21T00:00:00.000Z";
final MessageQuery messageQuery = new MessageQuery();
messageQuery.setEntity(entityName);
messageQuery.setStartDate(date);
messageQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
List<Message> storedMessageList = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages());
Message storedMessage = storedMessageList.get(0);
assertEquals("Incorrect message entity", message.getEntity(), storedMessage.getEntity());
assertEquals("Incorrect message text", message.getMessage(), storedMessage.getMessage());
assertEquals("Incorrect message date", date, storedMessage.getDate());
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class MessageInsertTest method testRfc822TimezoneOffsetSupported.
@Issue("2850")
@Issue("5272")
@Test
public void testRfc822TimezoneOffsetSupported() {
String entityName = "message-insert-test-rfc+hm";
Message message = new Message(entityName).setMessage("hello").setDate("2018-07-20T22:50:00-0110");
String date = "2018-07-21T00:00:00.000Z";
final MessageQuery messageQuery = new MessageQuery().setEntity(entityName).setStartDate(date).setInterval(new Period(1, TimeUnit.MILLISECOND));
insertMessageCheck(message, new MessageQuerySizeCheck(messageQuery, 1));
Message storedMessage = queryMessageResponse(messageQuery).readEntity(ResponseAsList.ofMessages()).get(0);
assertEquals("Incorrect message entity", message.getEntity(), storedMessage.getEntity());
assertEquals("Incorrect message text", message.getMessage(), storedMessage.getMessage());
assertEquals("Incorrect message date", date, storedMessage.getDate());
}
Aggregations