Search in sources :

Example 6 with Period

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

the class SeriesQueryAggregateGroupOrderRateTest method testDefaultOrderGroupAggregate.

@Issue("4729")
@Test(description = "test query result with default Group/Aggregate order")
public void testDefaultOrderGroupAggregate() {
    SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
    query.setAggregate(new Aggregate(AggregationType.COUNT, new Period(10, TimeUnit.SECOND)));
    query.setGroup(new Group(GroupType.MAX, new Period(5, TimeUnit.SECOND)));
    Set<CheckedFields> actualFields = createCheckFields(querySeriesAsList(query));
    CheckedFields series = new CheckedFields("*", Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("2.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("2.0"))));
    Set<CheckedFields> expectedFields = collectCheckFields(series);
    assertEquals(actualFields, expectedFields, "Incorrect query result with default Group/Aggregate order");
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Period(com.axibase.tsd.api.model.Period) 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 7 with Period

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

the class PropertyInsertTest method testISOTimezoneZ.

@Issue("2850")
@Test
public void testISOTimezoneZ() {
    Property property = new Property("test1", "property-insert-test-isoz");
    property.addTag("test", "test");
    property.setDate("2016-07-21T00:00:00Z");
    insertProperty(property);
    PropertyQuery propertyQuery = new PropertyQuery();
    propertyQuery.setEntity("property-insert-test-isoz");
    propertyQuery.setStartDate("2016-07-21T00:00:00.000Z");
    propertyQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
    propertyQuery.setType(property.getType());
    List<Property> storedPropertyList = queryProperty(propertyQuery).readEntity(ResponseAsList.ofProperties());
    Property storedProperty = storedPropertyList.get(0);
    assertEquals("Incorrect property entity", property.getEntity(), storedProperty.getEntity());
    assertEquals("Incorrect property tags", property.getTags(), storedProperty.getTags());
    assertEquals("Incorrect property date", propertyQuery.getStartDate(), storedProperty.getDate());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Period(com.axibase.tsd.api.model.Period) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with Period

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

the class TransformationPermutationsTest method setUpGrouping.

private void setUpGrouping() {
    Period period = new Period(5, TimeUnit.MINUTE, PeriodAlignment.START_TIME);
    List<GroupType> aggregationFunctions = Arrays.asList(GroupType.FIRST, GroupType.SUM);
    AggregationInterpolate interp = new AggregationInterpolate(AggregationInterpolateType.LINEAR, true);
    groupSettings = new Group().setPeriod(period).setTypes(aggregationFunctions).setInterpolate(interp);
    query.setGroup(groupSettings);
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) GroupType(com.axibase.tsd.api.model.series.query.transformation.group.GroupType) Period(com.axibase.tsd.api.model.Period) AggregationInterpolate(com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)

Example 9 with Period

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

the class TransformationPermutationsTest method setUpInterpolate.

private void setUpInterpolate() {
    Period period = new Period(10, TimeUnit.MINUTE, PeriodAlignment.START_TIME);
    interpolationSettings = new Interpolate(InterpolateFunction.LINEAR, period);
    query.setInterpolate(interpolationSettings);
}
Also used : Interpolate(com.axibase.tsd.api.model.series.query.transformation.interpolate.Interpolate) AggregationInterpolate(com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate) Period(com.axibase.tsd.api.model.Period)

Example 10 with Period

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

the class TransformationPermutationsTest method setUpAggregation.

private void setUpAggregation() {
    Period period = new Period(3, TimeUnit.MINUTE, PeriodAlignment.START_TIME);
    List<AggregationType> aggregationFunctions = Arrays.asList(AggregationType.AVG, AggregationType.SUM, AggregationType.FIRST);
    AggregationInterpolate interp = new AggregationInterpolate(AggregationInterpolateType.LINEAR, true);
    aggregationSettings = new Aggregate().setPeriod(period).setTypes(aggregationFunctions).setInterpolate(interp);
    query.setAggregate(aggregationSettings);
}
Also used : Period(com.axibase.tsd.api.model.Period) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) AggregationType(com.axibase.tsd.api.model.series.query.transformation.aggregate.AggregationType) AggregationInterpolate(com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)

Aggregations

Period (com.axibase.tsd.api.model.Period)63 Test (org.testng.annotations.Test)48 Issue (io.qameta.allure.Issue)44 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)39 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)30 BigDecimal (java.math.BigDecimal)24 Group (com.axibase.tsd.api.model.series.query.transformation.group.Group)16 Series (com.axibase.tsd.api.model.series.Series)14 Rate (com.axibase.tsd.api.model.series.query.transformation.rate.Rate)11 AggregationInterpolate (com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)10 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)7 Property (com.axibase.tsd.api.model.property.Property)6 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)5 MessageQuerySizeCheck (com.axibase.tsd.api.method.checks.MessageQuerySizeCheck)4 Message (com.axibase.tsd.api.model.message.Message)4 AggregationType (com.axibase.tsd.api.model.series.query.transformation.aggregate.AggregationType)3 ArrayList (java.util.ArrayList)3 Response (javax.ws.rs.core.Response)3 DataProvider (org.testng.annotations.DataProvider)3 Metric (com.axibase.tsd.api.model.metric.Metric)2