Fixed launch

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@167870 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-06-04 14:35:32 +00:00
parent 3a69d5e50c
commit f0f981d197
2 changed files with 15 additions and 3 deletions

View File

@ -39,6 +39,7 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
public static final String START_DATE_INPUT_PARAMETER = "startDate"; public static final String START_DATE_INPUT_PARAMETER = "startDate";
public static final String MEASURE_TYPE_INPUT_PARAMETER = "measureType"; public static final String MEASURE_TYPE_INPUT_PARAMETER = "measureType";
public static final String RERUN_INPUT_PARAMETER = "reRun"; public static final String RERUN_INPUT_PARAMETER = "reRun";
public static final String GET_VRE_USERS_INPUT_PARAMETER = "getVREUsers";
public static final String DRY_RUN_INPUT_PARAMETER = "dryRun"; public static final String DRY_RUN_INPUT_PARAMETER = "dryRun";
public static final String SO_BIG_DATA_CATALOGUE_CONTEXT = "/d4science.research-infrastructures.eu/SoBigData/ResourceCatalogue"; public static final String SO_BIG_DATA_CATALOGUE_CONTEXT = "/d4science.research-infrastructures.eu/SoBigData/ResourceCatalogue";
@ -103,6 +104,16 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
} }
} }
boolean getVREUsers = true;
if(inputs.containsKey(GET_VRE_USERS_INPUT_PARAMETER)) {
try {
reRun = (boolean) inputs.get(GET_VRE_USERS_INPUT_PARAMETER);
}catch (Exception e) {
throw new IllegalArgumentException("'" + GET_VRE_USERS_INPUT_PARAMETER + "' must be a boolean");
}
}
boolean dryRun = true; boolean dryRun = true;
if(inputs.containsKey(DRY_RUN_INPUT_PARAMETER)) { if(inputs.containsKey(DRY_RUN_INPUT_PARAMETER)) {
try { try {
@ -154,7 +165,7 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
try { try {
// Collecting info on VRE users // Collecting info on VRE users
if(!reRun) { if(getVREUsers) {
VREUsersHarvester vreUsersHarvester = new VREUsersHarvester(start, end); VREUsersHarvester vreUsersHarvester = new VREUsersHarvester(start, end);
List<HarvestedData> harvested = vreUsersHarvester.getData(); List<HarvestedData> harvested = vreUsersHarvester.getData();
data.addAll(harvested); data.addAll(harvested);

View File

@ -58,11 +58,12 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
MeasureType measureType = MeasureType.MONTHLY; MeasureType measureType = MeasureType.MONTHLY;
inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, measureType.name()); inputs.put(AccountingDataHarvesterPlugin.MEASURE_TYPE_INPUT_PARAMETER, measureType.name());
inputs.put(AccountingDataHarvesterPlugin.GET_VRE_USERS_INPUT_PARAMETER, false);
inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true); inputs.put(AccountingDataHarvesterPlugin.RERUN_INPUT_PARAMETER, true);
inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false); inputs.put(AccountingDataHarvesterPlugin.DRY_RUN_INPUT_PARAMETER, false);
/* /*
Calendar from = DateUtils.getStartCalendar(2018, Calendar.MARCH, 1); Calendar from = DateUtils.getStartCalendar(2018, Calendar.FEBRUARY, 1);
String fromDate = DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime()); String fromDate = DateUtils.LAUNCH_DATE_FORMAT.format(from.getTime());
logger.trace("{} is {}", AccountingDataHarvesterPlugin.START_DATE_INPUT_PARAMETER, fromDate); 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);