From 08605f5d1a91ad0faec59d0acb68697b9b6db371 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 26 Sep 2017 13:59:55 +0000 Subject: [PATCH] changes in test due to changes in api git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@154584 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../plugin/CouchBaseConnectorTest.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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);