diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQL.java b/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQL.java index 4a1395f..74b9c5d 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQL.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQL.java @@ -84,9 +84,10 @@ public class AccountingPersistenceQueryPostgreSQL implements AccountingPersisten this.contexts = contexts; } + @SuppressWarnings("unchecked") @Override - public void setFilters(Collection filters) { - this.filters = filters; + public void setFilters(Collection filters) { + this.filters = (Collection) filters; } static { diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/Query.java b/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/Query.java index 8955213..7d04eb7 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/Query.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/postgresql/Query.java @@ -56,7 +56,7 @@ public class Query extends PostgreSQLQuery { this.temporalConstraint = temporalConstraint; } - public void setFilters(Collection filters) { + public void setFilters(Collection filters) { this.filters = new HashMap<>(); if(filters!=null && filters.size()>0) { for(Filter filter : filters) { diff --git a/src/test/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQLTest.java b/src/test/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQLTest.java index 3841c0b..a29c40f 100644 --- a/src/test/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQLTest.java +++ b/src/test/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryPostgreSQLTest.java @@ -5,6 +5,7 @@ package org.gcube.accounting.analytics.persistence.postgresql; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -26,6 +27,7 @@ import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery; import org.gcube.accounting.datamodel.UsageRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord; +import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord; import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord; import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DataType; import org.gcube.accounting.utility.postgresql.RecordToDBMapping; @@ -218,6 +220,14 @@ public class AccountingPersistenceQueryPostgreSQLTest extends ContextTest { } } + @Test + public void gcTest() throws Exception { + accountingPersistenceQueryPostgreSQL.setRequestedRecords(AggregatedStorageStatusRecord.class); + Collection myFilters = accountingPersistenceQueryPostgreSQL.getFilterValues(AggregatedStorageStatusRecord.DATA_TYPE); + accountingPersistenceQueryPostgreSQL.setFilters(myFilters); + accountingPersistenceQueryPostgreSQL.getTimeSeries(); + } + @Test public void testTopValues() throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { String orderingProperty = AccountingPersistenceQuery.getDefaultOrderingProperties(AggregatedServiceUsageRecord.class);