changed test

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@154406 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-09-22 08:47:37 +00:00
parent 612e338645
commit e45546b9b3
1 changed files with 13 additions and 15 deletions

View File

@ -8,9 +8,7 @@ import java.util.HashMap;
import java.util.Map;
import org.gcube.accounting.aggregator.aggregation.AggregationType;
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPlugin;
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPlugin.ElaborationType;
import org.gcube.accounting.aggregator.plugin.AccountingAggregatorPluginDeclaration;
import org.gcube.accounting.aggregator.utility.Utility;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.testutility.ScopedTest;
@ -42,8 +40,8 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put(AccountingAggregatorPlugin.ELABORATION_TYPE_INPUT_PARAMETER, ElaborationType.RECOVERY.name());
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(8, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(18, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(4, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(20, 0));
return inputs;
}
@ -54,15 +52,15 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
inputs.put(AccountingAggregatorPlugin.ELABORATION_TYPE_INPUT_PARAMETER, ElaborationType.AGGREGATE.name());
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(8, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(18, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_START_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(3, 0));
inputs.put(AccountingAggregatorPlugin.PERSIST_END_TIME_INPUT_PARAMETER, Utility.getPersistTimeParameter(19, 00));
inputs.put(AccountingAggregatorPlugin.RECORD_TYPE_INPUT_PARAMETER,
ServiceUsageRecord.class.newInstance().getRecordType());
// Start Aggregation Date
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2014, Calendar.JANUARY,
1);
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.APRIL,
17);
String aggregationStartDate = AccountingAggregatorPlugin.AGGREGATION_START_DATE_DATE_FORMAT
.format(aggregationStartCalendar.getTime());
logger.trace("{} : {}", AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER,
@ -90,13 +88,13 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
@Test
public void aggregate() throws Exception {
// Every 15 minutes
CronExpression cronExpression = new CronExpression("0 0/15 * 1/1 * ? *");
// Every 5 minutes
CronExpression cronExpression = new CronExpression("0 0/5 * 1/1 * ? *");
Scheduling scheduling = new Scheduling(cronExpression, true);
scheduling.setGlobal(false);
Map<String, Object> inputs = getAggregateInputs();
launch(null, inputs);
}
@ -104,24 +102,24 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped
@Test
public void recovery() throws Exception {
// Every Day at 8:00
CronExpression cronExpression = new CronExpression("0 0 8,12,16 1/1 * ? *");
CronExpression cronExpression = new CronExpression("0 0/15 4-19 1/1 * ? *");
Scheduling scheduling = new Scheduling(cronExpression, true);
scheduling.setGlobal(false);
Map<String, Object> inputs = getRecoveryInputs();
launch(scheduling, inputs);
launch(null, inputs);
}
@Test
public void unSchedule() throws Exception {
// proxy.unSchedule("", true);
proxy.unSchedule("d06fc539-af83-4dae-a274-c721b4710fcd", true);
}
@Test
public void stop() throws Exception {
proxy.stop(AccountingAggregatorPluginDeclaration.NAME);
proxy.stop("91178b6e-811f-410d-9cff-ef7b4a7a2475");
}
}