diff --git a/src/test/java/org/gcube/dataharvest/jupyter/AccountingDataHarvesterJupyterTest.java b/src/test/java/org/gcube/dataharvest/jupyter/AccountingDataHarvesterJupyterTest.java index 4f2055b..ff22057 100644 --- a/src/test/java/org/gcube/dataharvest/jupyter/AccountingDataHarvesterJupyterTest.java +++ b/src/test/java/org/gcube/dataharvest/jupyter/AccountingDataHarvesterJupyterTest.java @@ -4,10 +4,12 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.SortedSet; import org.gcube.accounting.accounting.summary.access.model.update.AccountingRecord; import org.gcube.dataharvest.harvester.JupyterAccessesHarvester; import org.gcube.dataharvest.utils.AggregationType; +import org.gcube.dataharvest.utils.ContextAuthorization; import org.gcube.dataharvest.utils.ContextTest; import org.gcube.dataharvest.utils.DateUtils; import org.junit.Ignore; @@ -24,7 +26,7 @@ public class AccountingDataHarvesterJupyterTest extends ContextTest { private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterJupyterTest.class); public static final String ROOT = "/d4science.research-infrastructures.eu"; - private static final String SCOPE = "/d4science.research-infrastructures.eu/D4OS/Blue-CloudLab"; + // private static final String SCOPE = "/d4science.research-infrastructures.eu/D4OS/Blue-CloudLab"; @Ignore @Test @@ -47,12 +49,18 @@ public class AccountingDataHarvesterJupyterTest extends ContextTest { ContextTest.setContextByName(ROOT); JupyterAccessesHarvester jupyterAccessesHarvester = new JupyterAccessesHarvester(start, end); - ContextTest.setContextByName(SCOPE); - - List harvested = jupyterAccessesHarvester.getAccountingRecords(); - accountingRecords.addAll(harvested); - - logger.debug("{} - {}", SCOPE, accountingRecords); + + ContextAuthorization contextAuthorization = new ContextAuthorization(); + SortedSet contexts = contextAuthorization.getContexts(); + + for(String context : contexts) { + ContextTest.setContext(contextAuthorization.getTokenForContext(context)); + + List harvested = jupyterAccessesHarvester.getAccountingRecords(); + accountingRecords.addAll(harvested); + + logger.debug("{} - {}", context, accountingRecords); + } }