diff --git a/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java b/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java index e9bed83..d322b2b 100644 --- a/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java @@ -54,29 +54,24 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped private Map getAggregateInputs() throws Exception { Map inputs = new HashMap(); - inputs.put(AccountingAggregatorPlugin.AGGREGATION_TYPE_INPUT_PARAMETER, AggregationType.DAILY.name()); + inputs.put(AccountingAggregatorPlugin.AGGREGATION_TYPE_INPUT_PARAMETER, AggregationType.MONTHLY.name()); + inputs.put(AccountingAggregatorPlugin.ELABORATION_TYPE_INPUT_PARAMETER, ElaborationType.AGGREGATE.name()); - + + 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()); - - Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.SEPTEMBER, 17); + + + inputs.put(AccountingAggregatorPlugin.RECORD_TYPE_INPUT_PARAMETER, StorageUsageRecord.class.newInstance().getRecordType()); + + Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2016, Calendar.FEBRUARY, 1); String aggregationStartDate = AccountingAggregatorPlugin.AGGREGATION_START_DATE_DATE_FORMAT.format(aggregationStartCalendar.getTime()); logger.trace("{} : {}", AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationStartDate); inputs.put(AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationStartDate); - /* - Calendar aggregationEndCalendar = Utility.getAggregationStartCalendar(2017, Calendar.SEPTEMBER, 23); - String aggregationEndDate = AccountingAggregatorPlugin.AGGREGATION_START_DATE_DATE_FORMAT.format(aggregationEndCalendar.getTime()); - logger.trace("{} : {}", AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationEndDate); - inputs.put(AccountingAggregatorPlugin.AGGREGATION_END_DATE_INPUT_PARAMETER, aggregationEndDate); - */ - - inputs.put(AccountingAggregatorPlugin.RESTART_FROM_LAST_AGGREGATION_DATE_INPUT_PARAMETER, false); + inputs.put(AccountingAggregatorPlugin.RESTART_FROM_LAST_AGGREGATION_DATE_INPUT_PARAMETER, true); return inputs; } diff --git a/src/test/java/org/gcube/resourceregistry/ContextCreator.java b/src/test/java/org/gcube/resourceregistry/ContextCreator.java deleted file mode 100644 index 9be14e4..0000000 --- a/src/test/java/org/gcube/resourceregistry/ContextCreator.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.gcube.resourceregistry; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.gcube.common.scope.impl.ScopeBean; -import org.gcube.context.ContextElaborator; -import org.gcube.informationsystem.impl.entity.ContextImpl; -import org.gcube.informationsystem.impl.utils.ISMapper; -import org.gcube.informationsystem.model.entity.Context; -import org.gcube.informationsystem.resourceregistry.context.ContextManagement; - -/** - * @author Luca Frosini (ISTI - CNR) - */ -public class ContextCreator extends ContextElaborator { - - protected Map contexts; - - protected ContextManagement contextManagement; - - public ContextCreator() { - super(); - contexts = new HashMap<>(); - contextManagement = new ContextManagement(); - } - - @Override - protected void elaborateContext(ScopeBean scopeBean) throws Exception { - UUID parentUUID = null; - switch(scopeBean.type()) { - case INFRASTRUCTURE: - parentUUID = null; - break; - - default: - parentUUID = getParentUUID(scopeBean); - break; - } - - Context context = new ContextImpl(scopeBean.name()); - context.setParent(parentUUID); - contextManagement.setJSON(ISMapper.marshal(context)); - String created = contextManagement.create(); - context = ISMapper.unmarshal(Context.class, created); - contexts.put(scopeBean.toString(), context.getHeader().getUUID()); - } - - private UUID getParentUUID(ScopeBean scopeBean) { - String parent = scopeBean.toString().replace("/" + scopeBean.name(), ""); - return contexts.get(parent); - } - -} diff --git a/src/test/java/org/gcube/resourceregistry/ContextCreatorTest.java b/src/test/java/org/gcube/resourceregistry/ContextCreatorTest.java deleted file mode 100644 index 7bd26ea..0000000 --- a/src/test/java/org/gcube/resourceregistry/ContextCreatorTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.gcube.resourceregistry; - -import java.io.File; - -import org.junit.Test; - -public class ContextCreatorTest extends org.gcube.ScopedTest { - - @Test - public void createAll() throws Exception { - File src = new File("src"); - File test = new File(src, "test"); - File resources = new File(test, "resources"); - - File voFile = new File(resources, "scopedata.xml"); - - ContextCreator contextCreator = new ContextCreator(); - contextCreator.all(voFile); - - } - -}