diff --git a/pom.xml b/pom.xml index 215a57d..e581ba6 100644 --- a/pom.xml +++ b/pom.xml @@ -12,9 +12,9 @@ 4.0.0 org.gcube.accounting accounting-dashboard-harvester-se-plugin - 1.3.0 - Accounting Dashboard Harvester SmartExecutor Plugin - Accounting Dashboard Harvester SmartExecutor Plugin + 1.4.0 + Accounting Dashboard Harvester Smart Executor Plugin + Accounting Dashboard Harvester Smart Executor Plugin scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git @@ -31,16 +31,9 @@ - org.gcube.distribution - gcube-bom - LATEST - pom - import - - - org.gcube.distribution - gcube-smartgears-bom - LATEST + org.gcube.vremanagement + smart-executor-bom + 1.0.0 pom import @@ -48,39 +41,11 @@ - - org.gcube.vremanagement - smart-executor-api - [1.5.0, 2.0.0-SNAPSHOT) - provided - - - com.fasterxml.jackson.core - jackson-databind - - - - - org.slf4j - slf4j-api - provided - - - org.gcube.vremanagement - smart-executor-client - [1.3.0,2.0.0-SNAPSHOT) - provided - commons-lang commons-lang 2.6 - - org.gcube.core - common-encryption - provided - org.gcube.portlets.admin rmp-common-library @@ -96,73 +61,28 @@ google-http-client-gson 1.21.0 - org.gcube.common storagehub-client-library [1.0.0, 2.0.0-SNAPSHOT) - org.gcube.data-publishing gcat-client [1.0.0, 2.0.0-SNAPSHOT) - - - com.fasterxml.jackson.core - jackson-core - provided - - - com.fasterxml.jackson.core - jackson-databind - provided - - - com.fasterxml.jackson.core - jackson-annotations - provided - - - org.gcube.resources - common-gcore-resources - provided - - - org.gcube.common - authorization-client - provided - - - org.gcube.common - common-authorization - provided + org.gcube.accounting + accounting-lib org.gcube.core - common-gcore-stubs - provided + common-encryption - org.gcube.core - common-scope-maps - provided + org.gcube.vremanagement + smart-executor-api - - - - org.gcube.resources.discovery - ic-client - provided - - - org.gcube.resources - registry-publisher - provided - - org.gcube.accounting accounting-analytics @@ -173,19 +93,11 @@ accounting-analytics-persistence-couchbase [1.0.0,2.0.0-SNAPSHOT) - - - org.gcube.accounting - accounting-lib - provided - - org.gcube.accounting accounting-summary-access [1.0.0,2.0.0-SNAPSHOT) - org.json json @@ -194,6 +106,11 @@ + + org.gcube.vremanagement + smart-executor-client + test + junit junit @@ -203,7 +120,6 @@ ch.qos.logback logback-classic - 1.0.13 test diff --git a/src/main/java/org/gcube/dataharvest/AccountingDataHarvesterPlugin.java b/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java similarity index 97% rename from src/main/java/org/gcube/dataharvest/AccountingDataHarvesterPlugin.java rename to src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java index de9bc3d..5ec3ea6 100644 --- a/src/main/java/org/gcube/dataharvest/AccountingDataHarvesterPlugin.java +++ b/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java @@ -38,9 +38,9 @@ import org.slf4j.LoggerFactory; * @author Eric Perrone (ISTI - CNR) * @author Luca Frosini (ISTI - CNR) */ -public class AccountingDataHarvesterPlugin extends Plugin { +public class AccountingDashboardHarvesterPlugin extends Plugin { - private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPlugin.class); + private static Logger logger = LoggerFactory.getLogger(AccountingDashboardHarvesterPlugin.class); private static final String PROPERTY_FILENAME = "config.properties"; @@ -70,7 +70,7 @@ public class AccountingDataHarvesterPlugin extends Plugin getSupportedCapabilities() { Map discoveredCapabilities = new HashMap(); - discoveredCapabilities.put("FakeKey", "FakeValue"); return discoveredCapabilities; } /**{@inheritDoc}*/ @Override public Class> getPluginImplementation() { - return AccountingDataHarvesterPlugin.class; + return AccountingDashboardHarvesterPlugin.class; } @Override diff --git a/src/main/java/org/gcube/dataharvest/harvester/BasicHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/BasicHarvester.java index 4ae14b2..09af8ec 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/BasicHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/BasicHarvester.java @@ -12,7 +12,7 @@ import org.gcube.common.authorization.client.Constants; import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.utils.DateUtils; import org.slf4j.Logger; @@ -57,7 +57,7 @@ public abstract class BasicHarvester { public abstract List getAccountingRecords() throws Exception; public Dimension getDimension(HarvestedDataKey harvestedDataKey) { - return AccountingDataHarvesterPlugin.getDimension(harvestedDataKey.getKey()); + return AccountingDashboardHarvesterPlugin.getDimension(harvestedDataKey.getKey()); } diff --git a/src/main/java/org/gcube/dataharvest/harvester/MethodInvocationHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/MethodInvocationHarvester.java index 5ac0e52..b399309 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/MethodInvocationHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/MethodInvocationHarvester.java @@ -19,7 +19,7 @@ import org.gcube.accounting.datamodel.AggregatedUsageRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord; import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.utils.DateUtils; import org.gcube.dataharvest.utils.Utils; @@ -72,7 +72,7 @@ public class MethodInvocationHarvester extends BasicHarvester { AggregatedServiceUsageRecord.class, temporalConstraint, filters, contexts, true); } - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); Dimension dimension = getDimension(HarvestedDataKey.METHOD_INVOCATIONS); if(result != null) { diff --git a/src/main/java/org/gcube/dataharvest/harvester/SocialInteractionsHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/SocialInteractionsHarvester.java index c94a06e..e1ab180 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/SocialInteractionsHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/SocialInteractionsHarvester.java @@ -7,7 +7,7 @@ import java.util.List; import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor; import org.gcube.accounting.accounting.summary.access.model.update.AccountingRecord; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.utils.Utils; import org.json.JSONArray; @@ -44,7 +44,7 @@ public class SocialInteractionsHarvester extends SocialNetworkingHarvester { getJson(); - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); AccountingRecord likesAR = new AccountingRecord(scopeDescriptor, instant, getDimension(HarvestedDataKey.SOCIAL_LIKES), (long) likes); logger.debug("{} : {}", likesAR.getDimension().getId(), likesAR.getMeasure()); diff --git a/src/main/java/org/gcube/dataharvest/harvester/VREAccessesHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/VREAccessesHarvester.java index b69d245..3086ba0 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/VREAccessesHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/VREAccessesHarvester.java @@ -33,7 +33,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.Property; import org.gcube.common.resources.gcore.utils.Group; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.AnalyticsReportCredentials; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.datamodel.VREAccessesReportRow; @@ -109,7 +109,7 @@ public class VREAccessesHarvester extends BasicHarvester { } } - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); AccountingRecord ar = new AccountingRecord(scopeDescriptor, instant, getDimension(HarvestedDataKey.ACCESSES), (long) measure); logger.debug("{} : {}", ar.getDimension().getId(), ar.getMeasure()); diff --git a/src/main/java/org/gcube/dataharvest/harvester/VREUsersHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/VREUsersHarvester.java index 83df308..ef9a062 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/VREUsersHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/VREUsersHarvester.java @@ -7,7 +7,7 @@ import java.util.List; import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor; import org.gcube.accounting.accounting.summary.access.model.update.AccountingRecord; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.json.JSONObject; import org.slf4j.Logger; @@ -36,7 +36,7 @@ public class VREUsersHarvester extends SocialNetworkingHarvester { ArrayList accountingRecords = new ArrayList(); - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); AccountingRecord ar = new AccountingRecord(scopeDescriptor, instant, getDimension(HarvestedDataKey.USERS), (long) measure); logger.debug("{} : {}", ar.getDimension().getId(), ar.getMeasure()); diff --git a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/DataMethodDownloadHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/DataMethodDownloadHarvester.java index a65cf31..210f983 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/DataMethodDownloadHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/DataMethodDownloadHarvester.java @@ -18,7 +18,7 @@ import org.gcube.common.storagehub.model.items.FolderItem; import org.gcube.common.storagehub.model.items.Item; import org.gcube.common.storagehub.model.items.nodes.Accounting; import org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.utils.DateUtils; import org.gcube.dataharvest.utils.Utils; @@ -87,7 +87,7 @@ public class DataMethodDownloadHarvester extends SoBigDataHarvester { DateUtils.format(start), DateUtils.format(end), vreFolderItem.getName()); - ScopeDescriptor defaultScopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor defaultScopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); AccountingRecord defaultHarvesteData = new AccountingRecord(defaultScopeDescriptor, instant, getDimension(HarvestedDataKey.DATA_METHOD_DOWNLOAD), (long) count); @@ -116,7 +116,7 @@ public class DataMethodDownloadHarvester extends SoBigDataHarvester { if(context != null && !context.isEmpty()) { logger.debug("Found context '{}' matching with normalized VRE name {} ", context, normalizedName); - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(context); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(context); AccountingRecord ar = new AccountingRecord(scopeDescriptor, instant, getDimension(HarvestedDataKey.DATA_METHOD_DOWNLOAD), (long) count); logger.debug("{} : {}", ar.getDimension().getId(), ar.getMeasure()); accountingRecords.add(ar); diff --git a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/ResourceCatalogueHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/ResourceCatalogueHarvester.java index 1911dd5..9779d52 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/ResourceCatalogueHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/ResourceCatalogueHarvester.java @@ -12,7 +12,7 @@ import java.util.SortedSet; import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor; import org.gcube.accounting.accounting.summary.access.model.internal.Dimension; import org.gcube.accounting.accounting.summary.access.model.update.AccountingRecord; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.utils.DateUtils; import org.gcube.dataharvest.utils.Utils; @@ -153,7 +153,7 @@ public class ResourceCatalogueHarvester extends SoBigDataHarvester { logger.trace("The context {} has count ", catalogueContext, catalogueContextCount); - ScopeDescriptor catalogueScopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(catalogueContext); + ScopeDescriptor catalogueScopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(catalogueContext); Dimension dimension = getDimension(harvestKey); AccountingRecord ar = new AccountingRecord(catalogueScopeDescriptor, instant, dimension, (long) catalogueContextCount); @@ -161,7 +161,7 @@ public class ResourceCatalogueHarvester extends SoBigDataHarvester { for(String key : counter.keySet()) { logger.trace("The group {} has count {}", key, counter.get(key)); - ScopeDescriptor sd = AccountingDataHarvesterPlugin.getScopeDescriptor(mapCatalogueGroupToVRE.get(key)); + ScopeDescriptor sd = AccountingDashboardHarvesterPlugin.getScopeDescriptor(mapCatalogueGroupToVRE.get(key)); AccountingRecord accountingRecord = new AccountingRecord(sd, instant, dimension, (long) counter.get(key)); accountingRecords.add(accountingRecord); } diff --git a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/SoBigDataHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/SoBigDataHarvester.java index abe010c..00f73a8 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/SoBigDataHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/SoBigDataHarvester.java @@ -12,7 +12,7 @@ import java.util.SortedSet; import java.util.TreeSet; import org.gcube.common.authorization.client.exceptions.ObjectNotFound; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.harvester.BasicHarvester; import org.gcube.dataharvest.utils.Utils; @@ -78,7 +78,7 @@ public abstract class SoBigDataHarvester extends BasicHarvester { * @throws ObjectNotFound */ protected void initMappingMaps() throws ObjectNotFound, Exception { - Properties properties = AccountingDataHarvesterPlugin.getProperties().get(); + Properties properties = AccountingDashboardHarvesterPlugin.getProperties().get(); Set keys = properties.stringPropertyNames(); mapSystemTypeToDBEntry = new HashMap(); diff --git a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/TagMeMethodInvocationHarvester.java b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/TagMeMethodInvocationHarvester.java index c0acd12..dcca39c 100644 --- a/src/main/java/org/gcube/dataharvest/harvester/sobigdata/TagMeMethodInvocationHarvester.java +++ b/src/main/java/org/gcube/dataharvest/harvester/sobigdata/TagMeMethodInvocationHarvester.java @@ -18,7 +18,7 @@ import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFact import org.gcube.accounting.datamodel.AggregatedUsageRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord; import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.dataharvest.datamodel.HarvestedDataKey; import org.gcube.dataharvest.harvester.BasicHarvester; import org.gcube.dataharvest.utils.DateUtils; @@ -109,7 +109,7 @@ public class TagMeMethodInvocationHarvester extends BasicHarvester { } - ScopeDescriptor scopeDescriptor = AccountingDataHarvesterPlugin.getScopeDescriptor(); + ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor(); Dimension dimension = getDimension(HarvestedDataKey.METHOD_INVOCATIONS); AccountingRecord ar = new AccountingRecord(scopeDescriptor, instant, dimension, numberOfInvocation); diff --git a/src/main/java/org/gcube/dataharvest/utils/ContextAuthorization.java b/src/main/java/org/gcube/dataharvest/utils/ContextAuthorization.java index 4f0aec5..ff25c00 100644 --- a/src/main/java/org/gcube/dataharvest/utils/ContextAuthorization.java +++ b/src/main/java/org/gcube/dataharvest/utils/ContextAuthorization.java @@ -13,7 +13,7 @@ import java.util.TreeSet; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.UserInfo; import org.gcube.common.scope.impl.ScopeBean; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.gcube.resourcemanagement.support.server.managers.context.ContextManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +52,7 @@ public class ContextAuthorization { public String generateTokenForContext(String context, Properties properties) throws Exception { if(properties==null) { - properties = AccountingDataHarvesterPlugin.getProperties().get(); + properties = AccountingDashboardHarvesterPlugin.getProperties().get(); } logger.info("Going to generate Token for Context {}", context); UserInfo userInfo = new UserInfo(properties.getProperty(USERNAME, DEFAULT_USERNAME), @@ -74,7 +74,7 @@ public class ContextAuthorization { try { - Properties properties = AccountingDataHarvesterPlugin.getProperties().get(); + Properties properties = AccountingDashboardHarvesterPlugin.getProperties().get(); LinkedHashMap map = ContextManager.readContexts(); for(String scope : map.keySet()) { diff --git a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration index 591520e..c61670a 100644 --- a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration +++ b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration @@ -1 +1 @@ -org.gcube.dataharvest.DataHarvestPluginDeclaration \ No newline at end of file +org.gcube.dataharvest.AccountingDashboardHarvesterPluginDeclaration \ No newline at end of file diff --git a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java index c5f51bc..b55485b 100644 --- a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java +++ b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java @@ -34,9 +34,9 @@ import org.gcube.dataharvest.utils.ContextAuthorization; import org.gcube.dataharvest.utils.ContextTest; import org.gcube.dataharvest.utils.DateUtils; import org.gcube.resourcemanagement.support.server.managers.context.ContextManager; -import org.gcube.vremanagement.executor.api.rest.SmartExecutor; import org.gcube.vremanagement.executor.api.types.LaunchParameter; import org.gcube.vremanagement.executor.api.types.Scheduling; +import org.gcube.vremanagement.executor.client.SmartExecutorClient; import org.gcube.vremanagement.executor.client.SmartExecutorClientFactory; import org.junit.Assert; import org.quartz.CronExpression; @@ -93,20 +93,20 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin( + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( dataHarvestPluginDeclaration); Map inputs = new HashMap<>(); AggregationType aggregationType = AggregationType.MONTHLY; - inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); - inputs.put(AccountingDataHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); - inputs.put(AccountingDataHarvesterPlugin.PARTIAL_HARVESTING, true); + inputs.put(AccountingDashboardHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); + inputs.put(AccountingDashboardHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.RERUN_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); + inputs.put(AccountingDashboardHarvesterPlugin.PARTIAL_HARVESTING, true); /* Calendar from = DateUtils.getStartCalendar(2016, Calendar.SEPTEMBER, 1); @@ -130,17 +130,17 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - SmartExecutor smartExecutor = SmartExecutorClientFactory.create(DataHarvestPluginDeclaration.NAME); + SmartExecutorClient smartExecutor = SmartExecutorClientFactory.getClient(AccountingDashboardHarvesterPluginDeclaration.NAME); Assert.assertNotNull(smartExecutor); Map inputs = new HashMap<>(); AggregationType aggregationType = AggregationType.MONTHLY; - inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); - inputs.put(AccountingDataHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); + inputs.put(AccountingDashboardHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); + inputs.put(AccountingDashboardHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.RERUN_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); /* Calendar from = DateUtils.getStartCalendar(2016, Calendar.SEPTEMBER, 1); @@ -153,7 +153,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { CronExpression cronExpression = new CronExpression("0 0 10 3 1/1 ? *"); Scheduling scheduling = new Scheduling(cronExpression); scheduling.setGlobal(false); - LaunchParameter launchParameter = new LaunchParameter(DataHarvestPluginDeclaration.NAME, inputs, + LaunchParameter launchParameter = new LaunchParameter(AccountingDashboardHarvesterPluginDeclaration.NAME, inputs, scheduling); smartExecutor.launch(launchParameter); @@ -170,19 +170,19 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin( + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( dataHarvestPluginDeclaration); Map inputs = new HashMap<>(); AggregationType aggregationType = AggregationType.MONTHLY; - inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); - inputs.put(AccountingDataHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true); - inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); + inputs.put(AccountingDashboardHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, aggregationType.name()); + inputs.put(AccountingDashboardHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.RERUN_INPUT_PARAMETER, true); + inputs.put(AccountingDashboardHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); Calendar from = DateUtils.getStartCalendar(2016, Calendar.SEPTEMBER, 1); @@ -190,8 +190,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { while(from.before(runbeforeDate)) { String fromDate = DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime()); - logger.trace("{} is {}", AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); - inputs.put(AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); + logger.trace("{} is {}", AccountingDashboardHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); + inputs.put(AccountingDashboardHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); accountingDataHarvesterPlugin.launch(inputs); from.add(aggregationType.getCalendarField(), 1); } @@ -210,12 +210,12 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); // AccountingDao dao = AccountingDao.get(); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin( + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( dataHarvestPluginDeclaration); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); - AccountingDataHarvesterPlugin.getProperties().set(properties); + AccountingDashboardHarvesterPlugin.getProperties().set(properties); ContextAuthorization contextAuthorization = new ContextAuthorization(); SortedSet contexts = contextAuthorization.getContexts(); @@ -266,7 +266,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { } try { - if(context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_VO) + if(context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_VO) && start.before(DateUtils.getStartCalendar(2018, Calendar.APRIL, 1).getTime())) { logger.info("Not Harvesting VREs Accesses for {} from {} to {}", context, DateUtils.format(start), DateUtils.format(end)); @@ -330,9 +330,9 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { DateUtils.format(end)); } - if((context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_VO) - || context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_EU_VRE) - || context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_IT_VRE)) + if((context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_VO) + || context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_EU_VRE) + || context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_IT_VRE)) && start.before(DateUtils.getStartCalendar(2018, Calendar.APRIL, 1).getTime())) { logger.info("--- Not Harvesting (SoBigData Check) for {} from {} to {}", context, DateUtils.format(start), DateUtils.format(end)); @@ -413,7 +413,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); accountingDataHarvesterPlugin.getConfigParameters(); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -453,7 +453,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { } try { - if(context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_VO) + if(context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_VO) && start.before(DateUtils.getStartCalendar(2018, Calendar.APRIL, 1).getTime())) { logger.info("Not Harvesting VREs Accesses for {} from {} to {}", context, DateUtils.format(start), DateUtils.format(end)); @@ -481,12 +481,12 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); // AccountingDao dao = AccountingDao.get(); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin( + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( dataHarvestPluginDeclaration); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); - AccountingDataHarvesterPlugin.getProperties().set(properties); + AccountingDashboardHarvesterPlugin.getProperties().set(properties); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -569,7 +569,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { for(ScopeDescriptor scopeDescriptor : scopeDescriptorSet) { scopeDescriptorMap.put(scopeDescriptor.getId(), scopeDescriptor); } - AccountingDataHarvesterPlugin.scopeDescriptors.set(scopeDescriptorMap); + AccountingDashboardHarvesterPlugin.scopeDescriptors.set(scopeDescriptorMap); Set dimensionSet = dao.getDimensions(); Map dimensionMap = new HashMap<>(); @@ -577,7 +577,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { dimensionMap.put(dimension.getId(), dimension); } - AccountingDataHarvesterPlugin.dimensions.set(dimensionMap); + AccountingDashboardHarvesterPlugin.dimensions.set(dimensionMap); return dao; } @@ -589,13 +589,13 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContext(tagMeToken); ScopeBean scopeBean = new ScopeBean(contextFullName); - ScopeDescriptor actualScopeDescriptor = AccountingDataHarvesterPlugin.scopeDescriptors.get() + ScopeDescriptor actualScopeDescriptor = AccountingDashboardHarvesterPlugin.scopeDescriptors.get() .get(contextFullName); if(actualScopeDescriptor == null) { actualScopeDescriptor = new ScopeDescriptor(scopeBean.name(), contextFullName); } - AccountingDataHarvesterPlugin.scopeDescriptor.set(actualScopeDescriptor); + AccountingDashboardHarvesterPlugin.scopeDescriptor.set(actualScopeDescriptor); } // @Test @@ -640,11 +640,11 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { try { ContextTest.setContextByName(ROOT); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin( + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( dataHarvestPluginDeclaration); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); - AccountingDataHarvesterPlugin.getProperties().set(properties); + AccountingDashboardHarvesterPlugin.getProperties().set(properties); // AccountingDao dao = AccountingDao.get(); @@ -684,7 +684,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { SortedSet contexts = getContexts(); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); accountingDataHarvesterPlugin.getConfigParameters(); ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end, @@ -713,7 +713,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); accountingDataHarvesterPlugin.getConfigParameters(); SortedSet contexts = getContexts(); @@ -744,7 +744,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); accountingDataHarvesterPlugin.getConfigParameters(); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -754,7 +754,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ScopeBean scopeBean = new ScopeBean(context); logger.debug("FullName {} - Name {}", scopeBean.toString(), scopeBean.name()); - if(context.startsWith(AccountingDataHarvesterPlugin.SO_BIG_DATA_VO)) { + if(context.startsWith(AccountingDashboardHarvesterPlugin.SO_BIG_DATA_VO)) { if(scopeBean.is(Type.VRE)) { if(context.startsWith(TAGME_VRE)) { continue; @@ -782,10 +782,10 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); - AccountingDataHarvesterPlugin adhp = new AccountingDataHarvesterPlugin(dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); + AccountingDashboardHarvesterPlugin adhp = new AccountingDashboardHarvesterPlugin(dataHarvestPluginDeclaration); Properties properties = adhp.getConfigParameters(); - AccountingDataHarvesterPlugin.getProperties().set(properties); + AccountingDashboardHarvesterPlugin.getProperties().set(properties); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -797,7 +797,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { for(ScopeDescriptor scopeDescriptor : scopeDescriptorSet) { scopeDescriptorMap.put(scopeDescriptor.getId(), scopeDescriptor); } - AccountingDataHarvesterPlugin.scopeDescriptors.set(scopeDescriptorMap); + AccountingDashboardHarvesterPlugin.scopeDescriptors.set(scopeDescriptorMap); Set dimensionSet = dao.getDimensions(); Map dimensionMap = new HashMap<>(); @@ -805,7 +805,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { dimensionMap.put(dimension.getId(), dimension); } - AccountingDataHarvesterPlugin.dimensions.set(dimensionMap); + AccountingDashboardHarvesterPlugin.dimensions.set(dimensionMap); // ArrayList data = new ArrayList(); ArrayList accountingRecords = new ArrayList(); @@ -818,7 +818,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ScopeBean scopeBean = new ScopeBean(context); ScopeDescriptor scopeDescriptor = new ScopeDescriptor(scopeBean.name(), context); - Dimension dimension = AccountingDataHarvesterPlugin.getDimension(HarvestedDataKey.ACCESSES.getKey()); + Dimension dimension = AccountingDashboardHarvesterPlugin.getDimension(HarvestedDataKey.ACCESSES.getKey()); Calendar calendar = DateUtils.getStartCalendar(2018, Calendar.JULY, 1); calendar.set(Calendar.DAY_OF_MONTH, 15); diff --git a/src/test/java/org/gcube/dataharvest/utils/ContextAuthorizationTest.java b/src/test/java/org/gcube/dataharvest/utils/ContextAuthorizationTest.java index 5126fc2..106bc3b 100644 --- a/src/test/java/org/gcube/dataharvest/utils/ContextAuthorizationTest.java +++ b/src/test/java/org/gcube/dataharvest/utils/ContextAuthorizationTest.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import org.gcube.dataharvest.AccountingDataHarvesterPlugin; +import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,9 +21,9 @@ public class ContextAuthorizationTest extends ContextTest { private void getConfigParameters() throws IOException { properties = new Properties(); - InputStream input = AccountingDataHarvesterPlugin.class.getClassLoader().getResourceAsStream(PROPERTY_FILENAME); + InputStream input = AccountingDashboardHarvesterPlugin.class.getClassLoader().getResourceAsStream(PROPERTY_FILENAME); properties.load(input); - AccountingDataHarvesterPlugin.getProperties().set(properties); + AccountingDashboardHarvesterPlugin.getProperties().set(properties); } // @Test