From deb7890ea184be60c658c6ef19e3529c68d35f6e Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 22 May 2018 10:05:30 +0000 Subject: [PATCH] Code redesign Refs #11756: Refactor DataHArvesterPlugin to support scheduled execution from smart-executor Task-Url: https://support.d4science.org/issues/11756 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@167660 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../AccountingDataHarvesterPluginTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java index e2d2d15..41b94b5 100644 --- a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java +++ b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java @@ -2,18 +2,21 @@ package org.gcube.dataharvest; import java.util.Date; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.SortedSet; +import java.util.TreeSet; +import org.gcube.common.scope.impl.ScopeBean; import org.gcube.dataharvest.datamodel.HarvestedData; import org.gcube.dataharvest.harvester.MethodInvocationHarvester; import org.gcube.dataharvest.harvester.sobigdata.ResourceCatalogueHarvester; import org.gcube.dataharvest.harvester.sobigdata.TagMeMethodInvocationHarvester; -import org.gcube.dataharvest.utils.ContextAuthorization; import org.gcube.dataharvest.utils.ContextTest; import org.gcube.dataharvest.utils.DateUtils; import org.gcube.dataharvest.utils.MeasureType; +import org.gcube.resourcemanagement.support.server.managers.context.ContextManager; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,8 +112,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1); - ContextAuthorization contextAuthorization = new ContextAuthorization(); - SortedSet contexts = contextAuthorization.getContexts(); + LinkedHashMap map = ContextManager.readContexts(); + SortedSet contexts = new TreeSet<>(map.keySet()); ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end, contexts); List harvestedData = resourceCatalogueHarvester.getData(); @@ -133,8 +136,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1); - ContextAuthorization contextAuthorization = new ContextAuthorization(); - SortedSet contexts = contextAuthorization.getContexts(); + LinkedHashMap map = ContextManager.readContexts(); + SortedSet contexts = new TreeSet<>(map.keySet()); ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end, contexts); SortedSet excludedContexts = resourceCatalogueHarvester.getExcludedContexts();