use of com.google.api.services.dataflow.model.CounterMetadata in project beam by apache.
the class MeanCounterUpdateAggregatorTest method setUp.
@Before
public void setUp() {
counterUpdates = new ArrayList<>();
aggregator = new MeanCounterUpdateAggregator();
for (int i = 0; i < 10; i++) {
counterUpdates.add(new CounterUpdate().setStructuredNameAndMetadata(new CounterStructuredNameAndMetadata().setMetadata(new CounterMetadata().setKind(Kind.MEAN.toString()))).setIntegerMean(new IntegerMean().setSum(longToSplitInt((long) i)).setCount(longToSplitInt(1L))));
}
}
use of com.google.api.services.dataflow.model.CounterMetadata in project beam by apache.
the class CounterUpdateAggregatorsTest method testAggregateSum.
@Test
public void testAggregateSum() {
List<CounterUpdate> sumUpdates = new ArrayList<>();
for (int i = 0; i < 10; i++) {
sumUpdates.add(new CounterUpdate().setStructuredNameAndMetadata(new CounterStructuredNameAndMetadata().setMetadata(new CounterMetadata().setKind(Kind.SUM.toString()))).setInteger(longToSplitInt((long) i)));
}
List<CounterUpdate> aggregated = CounterUpdateAggregators.aggregate(sumUpdates);
assertEquals(1, aggregated.size());
CounterUpdate combined = aggregated.get(0);
assertEquals(45L, splitIntToLong(combined.getInteger()));
}
use of com.google.api.services.dataflow.model.CounterMetadata in project beam by apache.
the class SumCounterUpdateAggregatorTest method setUp.
@Before
public void setUp() {
counterUpdates = new ArrayList<>();
aggregator = new SumCounterUpdateAggregator();
for (int i = 0; i < 10; i++) {
counterUpdates.add(new CounterUpdate().setStructuredNameAndMetadata(new CounterStructuredNameAndMetadata().setMetadata(new CounterMetadata().setKind(Kind.SUM.toString()))).setInteger(longToSplitInt((long) i)));
}
}
Aggregations