|
|
|
@ -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<AccountingRecord> harvested = jupyterAccessesHarvester.getAccountingRecords();
|
|
|
|
|
accountingRecords.addAll(harvested);
|
|
|
|
|
|
|
|
|
|
logger.debug("{} - {}", SCOPE, accountingRecords);
|
|
|
|
|
|
|
|
|
|
ContextAuthorization contextAuthorization = new ContextAuthorization();
|
|
|
|
|
SortedSet<String> contexts = contextAuthorization.getContexts();
|
|
|
|
|
|
|
|
|
|
for(String context : contexts) {
|
|
|
|
|
ContextTest.setContext(contextAuthorization.getTokenForContext(context));
|
|
|
|
|
|
|
|
|
|
List<AccountingRecord> harvested = jupyterAccessesHarvester.getAccountingRecords();
|
|
|
|
|
accountingRecords.addAll(harvested);
|
|
|
|
|
|
|
|
|
|
logger.debug("{} - {}", context, accountingRecords);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|