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.ScopedTest; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AccountingDataHarvesterPluginTest extends ScopedTest { private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterPluginTest.class); @Test public void test() { try { DataHarvestPluginDeclaration dataHarvestPluginDeclaration = new DataHarvestPluginDeclaration(); AccountingDataHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDataHarvesterPlugin(dataHarvestPluginDeclaration); Map inputs = new HashMap<>(); MeasureType measureType = MeasureType.MONTHLY; inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, measureType); 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); 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); accountingDataHarvesterPlugin.launch(inputs); logger.info("End."); } catch (Exception e) { logger.error("", e); } } }