Refactoring Infrastructure Tests

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@152481 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-08-04 09:09:55 +00:00
parent 8ceb555643
commit 66e0df8d1b
1 changed files with 12 additions and 12 deletions

View File

@ -38,11 +38,11 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
}
private String getPersistEndTimeParameter() {
private String getPersistTimeParameter(int hour, int minute) {
Calendar persistEndTime = Calendar.getInstance();
persistEndTime.set(Calendar.HOUR_OF_DAY, 18);
persistEndTime.set(Calendar.MINUTE, 00);
String persistEndTimeParameter = AccountingAggregatorPlugin.RECOVERY_END_TIME_DATE_FORMAT
persistEndTime.set(Calendar.HOUR_OF_DAY, hour);
persistEndTime.set(Calendar.MINUTE, minute);
String persistEndTimeParameter = AccountingAggregatorPlugin.PERSIST_TIME_DATE_FORMAT
.format(persistEndTime.getTime());
return persistEndTimeParameter;
}
@ -51,8 +51,8 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put(AccountingAggregatorPlugin.ELABORATION_TYPE_INPUT_PARAMETER, ElaborationType.RECOVERY.name());
String persistEndTimeParameter = getPersistEndTimeParameter();
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, persistEndTimeParameter);
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, getPersistTimeParameter(8, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, getPersistTimeParameter(18, 0));
return inputs;
}
@ -63,8 +63,8 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
inputs.put(AccountingAggregatorPlugin.ELABORATION_TYPE_INPUT_PARAMETER, ElaborationType.AGGREGATE.name());
String persistEndTimeParameter = getPersistEndTimeParameter();
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, persistEndTimeParameter);
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, getPersistTimeParameter(8, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, getPersistTimeParameter(18, 0));
inputs.put(AccountingAggregatorPlugin.RECORD_TYPE_INPUT_PARAMETER,
ServiceUsageRecord.class.newInstance().getRecordType());
@ -102,7 +102,7 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
// Every 15 minutes
CronExpression cronExpression = new CronExpression("0 0/15 * 1/1 * ? *");
Scheduling scheduling = new Scheduling(cronExpression, false);
scheduling.setGlobal(true);
scheduling.setGlobal(false);
Map<String, Object> inputs = getAggregateInputs();
@ -113,9 +113,9 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
@Test
public void recovery() throws Exception {
// Every Day at 8:00
CronExpression cronExpression = new CronExpression("0 0 8 1/1 * ? *");
Scheduling scheduling = new Scheduling(cronExpression, false);
scheduling.setGlobal(true);
CronExpression cronExpression = new CronExpression("0 0 8,12,16 1/1 * ? *");
Scheduling scheduling = new Scheduling(cronExpression, true);
scheduling.setGlobal(false);
Map<String, Object> inputs = getRecoveryInputs();