use of org.apache.beam.sdk.extensions.euphoria.core.client.accumulators.Counter in project beam by apache.
the class SingleValueCollectorTest method testBasicAccumulatorsAccess.
@Test
public void testBasicAccumulatorsAccess() {
final AccumulatorProvider accumulators = accumulatorFactory.create();
SingleValueCollector collector = new SingleValueCollector(accumulators, "test-no_op_name");
Counter counter = collector.getCounter(TEST_COUNTER_NAME);
Assert.assertNotNull(counter);
Histogram histogram = collector.getHistogram(TEST_HISTOGRAM_NAME);
Assert.assertNotNull(histogram);
// collector.getTimer() <- not yet supported
}
use of org.apache.beam.sdk.extensions.euphoria.core.client.accumulators.Counter in project beam by apache.
the class SingleJvmAccumulatorProviderTest method testBasicAccumulatorsFunction.
@Test
public void testBasicAccumulatorsFunction() {
final AccumulatorProvider accumulators = accFactory.create();
Counter counter = accumulators.getCounter(TEST_COUNTER_NAME);
Assert.assertNotNull(counter);
counter.increment();
counter.increment(2);
Map<String, Long> counterSnapshots = accFactory.getCounterSnapshots();
long counterValue = counterSnapshots.get(TEST_COUNTER_NAME);
Assert.assertEquals(3L, counterValue);
Histogram histogram = accumulators.getHistogram(TEST_HISTOGRAM_NAME);
Assert.assertNotNull(histogram);
histogram.add(1);
histogram.add(2, 2);
Map<String, Map<Long, Long>> histogramSnapshots = accFactory.getHistogramSnapshots();
Map<Long, Long> histogramValue = histogramSnapshots.get(TEST_HISTOGRAM_NAME);
long numOfValuesOfOne = histogramValue.get(1L);
Assert.assertEquals(1L, numOfValuesOfOne);
long numOfValuesOfTwo = histogramValue.get(2L);
Assert.assertEquals(2L, numOfValuesOfTwo);
// collector.getTimer() <- not yet supported
}
use of org.apache.beam.sdk.extensions.euphoria.core.client.accumulators.Counter in project beam by apache.
the class SingleValueCollectorTest method testBasicAccumulatorsFunction.
@Test
public void testBasicAccumulatorsFunction() {
final AccumulatorProvider accumulators = accumulatorFactory.create();
SingleValueCollector collector = new SingleValueCollector(accumulators, "test-no_op_name");
Counter counter = collector.getCounter(TEST_COUNTER_NAME);
Assert.assertNotNull(counter);
counter.increment();
counter.increment(2);
Map<String, Long> counterSnapshots = accumulatorFactory.getCounterSnapshots();
long counteValue = counterSnapshots.get(TEST_COUNTER_NAME);
Assert.assertEquals(3L, counteValue);
Histogram histogram = collector.getHistogram(TEST_HISTOGRAM_NAME);
Assert.assertNotNull(histogram);
histogram.add(1);
histogram.add(2, 2);
Map<String, Map<Long, Long>> histogramSnapshots = accumulatorFactory.getHistogramSnapshots();
Map<Long, Long> histogramValue = histogramSnapshots.get(TEST_HISTOGRAM_NAME);
long numOfValuesOfOne = histogramValue.get(1L);
Assert.assertEquals(1L, numOfValuesOfOne);
long numOfValuesOfTwo = histogramValue.get(2L);
Assert.assertEquals(2L, numOfValuesOfTwo);
// collector.getTimer() <- not yet supported
}
Aggregations