From 0d5da0bc1965fbf73d6763dd6db2652c70c7cd16 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 4 Sep 2017 13:43:32 +0000 Subject: [PATCH] Fixing tests git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@152640 82a268e6-3cf1-43bd-a215-b396298e98cf --- ...regatorAccountingPluginSmartExecutorSchedulerTest.java | 8 ++++---- .../analytics/persistence/couchbase/RemoveOldRecords.java | 5 +++-- .../datamodel/usagerecords/TestUsageRecord.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) 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 85c3773..91c938e 100644 --- a/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/plugin/AggregatorAccountingPluginSmartExecutorSchedulerTest.java @@ -61,7 +61,7 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped ServiceUsageRecord.class.newInstance().getRecordType()); // Start Aggregation Date - Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.JUNE, + Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.APRIL, 1); String aggregationStartDate = AccountingAggregatorPlugin.AGGREGATION_START_DATE_DATE_FORMAT .format(aggregationStartCalendar.getTime()); @@ -69,7 +69,7 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped aggregationStartDate); inputs.put(AccountingAggregatorPlugin.AGGREGATION_START_DATE_INPUT_PARAMETER, aggregationStartDate); - inputs.put(AccountingAggregatorPlugin.RESTART_FROM_LAST_AGGREGATION_DATE_INPUT_PARAMETER, true); + inputs.put(AccountingAggregatorPlugin.RESTART_FROM_LAST_AGGREGATION_DATE_INPUT_PARAMETER, false); return inputs; } @@ -92,12 +92,12 @@ public class AggregatorAccountingPluginSmartExecutorSchedulerTest extends Scoped public void aggregate() throws Exception { // Every 15 minutes CronExpression cronExpression = new CronExpression("0 0/15 * 1/1 * ? *"); - Scheduling scheduling = new Scheduling(cronExpression, false); + Scheduling scheduling = new Scheduling(cronExpression, true); scheduling.setGlobal(false); Map inputs = getAggregateInputs(); - launch(scheduling, inputs); + launch(null, inputs); } diff --git a/src/test/java/org/gcube/accounting/analytics/persistence/couchbase/RemoveOldRecords.java b/src/test/java/org/gcube/accounting/analytics/persistence/couchbase/RemoveOldRecords.java index 078568f..62eea86 100644 --- a/src/test/java/org/gcube/accounting/analytics/persistence/couchbase/RemoveOldRecords.java +++ b/src/test/java/org/gcube/accounting/analytics/persistence/couchbase/RemoveOldRecords.java @@ -1,10 +1,11 @@ package org.gcube.accounting.analytics.persistence.couchbase; -import java.text.SimpleDateFormat; +import java.text.DateFormat; import java.util.Calendar; import java.util.concurrent.TimeUnit; import org.gcube.accounting.aggregator.aggregation.AggregationType; +import org.gcube.accounting.aggregator.utility.Utility; import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration; import org.gcube.testutility.ScopedTest; import org.junit.Test; @@ -43,7 +44,7 @@ public class RemoveOldRecords extends ScopedTest { AccountingPersistenceQueryCouchBase accountingPersistenceQueryCouchBase = new AccountingPersistenceQueryCouchBase(); accountingPersistenceQueryCouchBase.prepareConnection(configuration); - SimpleDateFormat format = new SimpleDateFormat(AggregationType.DAILY.getDateFormatPattern()); + DateFormat format = Utility.getUTCDateFormat(AggregationType.DAILY.getDateFormatPattern()); Calendar start = Calendar.getInstance(); start.set(Calendar.YEAR, 1970); diff --git a/src/test/java/org/gcube/accounting/datamodel/usagerecords/TestUsageRecord.java b/src/test/java/org/gcube/accounting/datamodel/usagerecords/TestUsageRecord.java index a623546..7ed6afa 100644 --- a/src/test/java/org/gcube/accounting/datamodel/usagerecords/TestUsageRecord.java +++ b/src/test/java/org/gcube/accounting/datamodel/usagerecords/TestUsageRecord.java @@ -203,7 +203,7 @@ public class TestUsageRecord { inputParameters.put(TEST_NESTED_MAP, parameter); - usageRecord.setInputParameters(inputParameters); + //usageRecord.setInputParameters(inputParameters); } catch (InvalidValueException e) { logger.error(" ------ You SHOULD NOT SEE THIS MESSAGE. Error Creating a test Usage Record", e);