Added test
This commit is contained in:
parent
d95585c823
commit
0c2345f27d
|
@ -24,6 +24,7 @@ import org.gcube.accounting.analytics.exception.KeyException;
|
||||||
import org.gcube.accounting.analytics.exception.ValueException;
|
import org.gcube.accounting.analytics.exception.ValueException;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration;
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||||
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||||
import org.gcube.accounting.datamodel.UsageRecord;
|
import org.gcube.accounting.datamodel.UsageRecord;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||||
|
@ -281,4 +282,35 @@ public class AccountingPersistenceQueryPostgreSQLTest extends ContextTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStorageTimeSeries() throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
|
||||||
|
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||||
|
|
||||||
|
Calendar startTimeCalendar = Calendar.getInstance();
|
||||||
|
startTimeCalendar.set(Calendar.YEAR, 2017);
|
||||||
|
startTimeCalendar.set(Calendar.MONTH, Calendar.JANUARY);
|
||||||
|
startTimeCalendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
startTimeCalendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
startTimeCalendar.set(Calendar.MINUTE, 0);
|
||||||
|
|
||||||
|
Calendar entTimeCalendar = Calendar.getInstance();
|
||||||
|
entTimeCalendar.set(Calendar.YEAR, 2021);
|
||||||
|
entTimeCalendar.set(Calendar.MONTH, Calendar.MARCH);
|
||||||
|
entTimeCalendar.set(Calendar.DAY_OF_MONTH, 22);
|
||||||
|
entTimeCalendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
entTimeCalendar.set(Calendar.MINUTE, 0);
|
||||||
|
|
||||||
|
TemporalConstraint temporalConstraint = new TemporalConstraint(startTimeCalendar.getTimeInMillis(), entTimeCalendar.getTimeInMillis(), AggregationMode.DAILY);
|
||||||
|
|
||||||
|
apq.setRequestedRecords(AggregatedStorageStatusRecord.class);
|
||||||
|
apq.setTemporalConstraint(temporalConstraint);
|
||||||
|
|
||||||
|
SortedMap<Calendar, Info> timeseries = apq.getTimeSeries();
|
||||||
|
for(Calendar c : timeseries.keySet()) {
|
||||||
|
Info info = timeseries.get(c);
|
||||||
|
logger.debug("{}", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
<logger name="org.gcube" level="INFO" />
|
<logger name="org.gcube" level="INFO" />
|
||||||
<logger name="org.gcube.accounting.analytics.persistence.postgresql" level="TRACE" />
|
<logger name="org.gcube.accounting.analytics" level="TRACE" />
|
||||||
|
|
||||||
<root level="WARN">
|
<root level="WARN">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|
Loading…
Reference in New Issue