diff --git a/src/test/java/org/gcube/accounting/aggregator/plugin/CouchBaseConnectorTest.java b/src/test/java/org/gcube/accounting/aggregator/plugin/CouchBaseConnectorTest.java index 8da34c5..949fd34 100644 --- a/src/test/java/org/gcube/accounting/aggregator/plugin/CouchBaseConnectorTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/plugin/CouchBaseConnectorTest.java @@ -22,18 +22,38 @@ public class CouchBaseConnectorTest extends ScopedTest { @Test public void getLastTest() throws Exception { - AggregationStatus aggregationStatus = CouchBaseConnector.getLast(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY); + AggregationStatus aggregationStatus = CouchBaseConnector.getLast(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, null, null); logger.debug("Last : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus)); } @Test public void getUnterminatedTest() throws Exception{ - List aggregationStatuses = CouchBaseConnector.getUnterminated(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY); + List aggregationStatuses = CouchBaseConnector.getUnterminated(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, null, null); for(AggregationStatus aggregationStatus : aggregationStatuses){ logger.debug("Unterminated : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus)); } } + @Test + public void getLastTestWithConstraint() throws Exception { + Calendar aggregationStart = Utility.getAggregationStartCalendar(2017, Calendar.JANUARY, 1); + Calendar aggregationEnd = Utility.getAggregationStartCalendar(2017, Calendar.JANUARY, 31); + + AggregationStatus aggregationStatus = CouchBaseConnector.getLast(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, aggregationStart.getTime(), aggregationEnd.getTime()); + logger.info("Last : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus)); + } + + @Test + public void getUnterminatedTestWithConstraint() throws Exception{ + Calendar aggregationStart = Utility.getAggregationStartCalendar(2017, Calendar.APRIL, 1); + Calendar aggregationEnd = Utility.getAggregationStartCalendar(2017, Calendar.APRIL, 30); + + List aggregationStatuses = CouchBaseConnector.getUnterminated(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, aggregationStart.getTime(), aggregationEnd.getTime()); + for(AggregationStatus aggregationStatus : aggregationStatuses){ + logger.info("Unterminated : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus)); + } + } + @Test public void getAggregationStatusTest() throws Exception{ Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.JUNE, 15);