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
This commit is contained in:
Luca Frosini 2018-05-18 15:01:49 +00:00
parent 18534677ff
commit e7de632897
1 changed files with 9 additions and 11 deletions

View File

@ -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);