DualAnnotationService extends DefaultService implements AnnotationStorageService { protected List<AnnotationQuery> splitQuery(AnnotationQuery original) { List<AnnotationQuery> queries = new ArrayList<AnnotationQuery>(); queries.add(new AnnotationQuery(original.getScope(), original.getMetric(), original.getTags(), original.getType(), original.getStartTimestamp(), annotationTransitionEpochMs)); queries.add(new AnnotationQuery(original.getScope(), original.getMetric(), original.getTags(), original.getType(), annotationTransitionEpochMs, original.getEndTimestamp())); return queries; } @Inject protected  DualAnnotationService(SystemConfiguration config,
            @NamedBinding AnnotationStorageService elasticSearchAnnotationService,
            TSDBService tsdbService); @Override void dispose(); @Override void putAnnotations(List<Annotation> annotations); @Override List<Annotation> getAnnotations(List<AnnotationQuery> queries);  }
@Test public void testSplitQuery(){ AnnotationQuery annotationQuery = new AnnotationQuery("scope1", "metric1", null, "unittest", 1559153223000L, 1559153226000L); List<AnnotationQuery> queries = dualAnnotationService.splitQuery(annotationQuery); assertEquals(2, queries.size()); AnnotationQuery tsdbQuery = queries.get(0); AnnotationQuery esQuery = queries.get(1); assertEquals("scope1", tsdbQuery.getScope()); assertEquals("metric1", tsdbQuery.getMetric()); assertEquals("unittest", tsdbQuery.getType()); assertEquals(1559153223000L, tsdbQuery.getStartTimestamp().longValue()); assertEquals(1559153225000L, tsdbQuery.getEndTimestamp().longValue()); assertEquals("scope1", esQuery.getScope()); assertEquals("metric1", esQuery.getMetric()); assertEquals("unittest", esQuery.getType()); assertEquals(1559153225000L, esQuery.getStartTimestamp().longValue()); assertEquals(1559153226000L, esQuery.getEndTimestamp().longValue()); }