alfa version ready for the CoreServices accounting

This commit is contained in:
Massimiliano Assante 2020-05-13 18:26:55 +02:00
parent 0a6d49b22b
commit f953c16195
2 changed files with 42 additions and 0 deletions

View File

@ -11,6 +11,11 @@ package org.gcube.dataharvest.datamodel;
*/
public enum HarvestedDataKey {
WORKSPACE_ACCESSES("Workspace Accesses"),
MESSAGES_ACCESSES("Messages Accesses"),
NOTIFICATIONS_ACCESSES("Notifications Accesses"),
PROFILE_ACCESSES("Profile Accesses"),
CATALOGUE_ACCESSES("Catalogue Accesses"),
CATALOGUE_DATASET_LIST_ACCESSES("Item List"),
CATALOGUE_DATASET_ACCESSES("Item Metadata"),

View File

@ -21,8 +21,10 @@ import org.gcube.accounting.accounting.summary.access.model.update.AccountingRec
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.dataharvest.datamodel.CoreServiceAccessesReportRow;
import org.gcube.dataharvest.datamodel.HarvestedDataKey;
import org.gcube.dataharvest.harvester.CatalogueAccessesHarvester;
import org.gcube.dataharvest.harvester.CoreServicesAccessesHarvester;
import org.gcube.dataharvest.harvester.MethodInvocationHarvester;
import org.gcube.dataharvest.harvester.SocialInteractionsHarvester;
import org.gcube.dataharvest.harvester.VREAccessesHarvester;
@ -730,6 +732,41 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Test
public void testCoreServicesHarvester() {
try {
String context = ROOT; //"/gcube";
ContextTest.setContextByName(context);
//AccountingDao dao = getAccountingDao();
Date start = DateUtils.getStartCalendar(2020, Calendar.JANUARY, 1).getTime();
Date end = DateUtils.getStartCalendar(2020, Calendar.FEBRUARY, 1).getTime();
/*
* Date start = DateUtils.getPreviousPeriod(measureType, false).getTime();
* Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false);
*/
ScopeBean scopeBean = new ScopeBean(context);
logger.debug("FullName {} - Name {}", scopeBean.toString(), scopeBean.name());
CoreServicesAccessesHarvester coreServicesHarvester = new CoreServicesAccessesHarvester(start, end);
List<AccountingRecord> accountingRecords = coreServicesHarvester.getAccountingRecords();
for (AccountingRecord accountingRecord : accountingRecords) {
logger.debug("{}", accountingRecord);
}
logger.debug("{}", accountingRecords);
//dao.insertRecords(accountingRecords.toArray(new AccountingRecord[1]));
} catch(Exception e) {
logger.error("", e);
}
}
@Test
public void testCatalogueHarvester() {
try {