DefaultCollectionService extends DefaultJPAService implements CollectionService { @Override public void submitHistogram(PrincipalUser submitter, Histogram histogram) { submitHistograms(submitter, Arrays.asList(new Histogram[] { histogram })); } @Inject  DefaultCollectionService(MQService mqService, TSDBService tsdbService, AuditService auditService,
            AnnotationStorageService annotationStorageService, SystemConfiguration configuration, SchemaService schemaService, WardenService wardenService,
            MonitorService monitorService, NamespaceService namespaceService); @Override void submitMetric(PrincipalUser submitter, Metric metric); @Override void submitMetrics(PrincipalUser submitter, List<Metric> metrics); @Override void submitAnnotation(PrincipalUser submitter, Annotation annotation); @Override void submitAnnotations(PrincipalUser submitter, List<Annotation> annotations); @Override List<Metric> commitMetrics(int messageCount, int timeout); @Override int commitMetricSchema(int messageCount, int timeout); @Override int commitAnnotations(int annotationCount, int timeout); @Override int commitHistograms(int histogramCount, int timeout); @Override void submitHistogram(PrincipalUser submitter, Histogram histogram); @Override void submitHistograms(PrincipalUser submitter, List<Histogram> histograms); @Override void dispose();  }
@Test public void testSubmitHistogram() { Histogram histogram = TestUtils.createHistogram(3); collectionService.submitHistogram(user, histogram); verify(monitorService).modifyCounter(MonitorService.Counter.HISTOGRAM_WRITES, 1, null); }
@Test public void testSubmitHistogramBucketsExceeded() { Histogram histogram = TestUtils.createHistogram(101); collectionService.submitHistogram(user, histogram); verify(monitorService).modifyCounter(MonitorService.Counter.HISTOGRAM_DROPPED, 1, null); }
@Test public void testSubmitHistogramBucketsEmpty() { Histogram histogram = TestUtils.createHistogram(0); collectionService.submitHistogram(user, histogram); verify(monitorService).modifyCounter(MonitorService.Counter.HISTOGRAM_DROPPED, 1, null); }
@Test public void testSubmitHistogramBucketsWrongBounds() { Histogram histogram = TestUtils.createHistogramWrongBounds(2); collectionService.submitHistogram(user, histogram); verify(monitorService).modifyCounter(MonitorService.Counter.HISTOGRAM_DROPPED, 1, null); }