From e7de6328970a69528be59f3cde3c26586bd733c0 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Fri, 18 May 2018 15:01:49 +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@167611 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../AccountingDataHarvesterPluginTest.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java index 7fc1b96..10b7bde 100644 --- a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java +++ b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java @@ -1,12 +1,11 @@ package org.gcube.dataharvest; -import java.util.Calendar; import java.util.HashMap; import java.util.Map; -import org.gcube.dataharvest.utils.DateUtils; -import org.gcube.dataharvest.utils.MeasureType; import org.gcube.dataharvest.utils.ContextTest; +import org.gcube.dataharvest.utils.MeasureType; +import org.gcube.dataharvest.utils.Utils; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,6 +18,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { public void test() { try { + // Utils.setContext(ROOT); + DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(dataHarvestPluginDeclaration); @@ -26,21 +27,18 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { MeasureType measureType = MeasureType.MONTHLY; - inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, measureType); + inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, measureType.name()); inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true); inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, true); - Calendar from - //= DateUtils.getStartCalendar(2018, Calendar.APRIL, 1); - = DateUtils.getPreviousPeriod(measureType); - + /* + Calendar from = DateUtils.getStartCalendar(2018, Calendar.APRIL, 1); 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); - - + inputs.put(AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); + */ accountingDataHarvesterPlugin.launch(inputs);