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