accounting-analytics-persis.../src/test/java/org/gcube/accounting/analytics/persistence/postgresql/AccountingPersistenceQueryP...

48 lines
1.9 KiB
Java

/**
*
*/
package org.gcube.accounting.analytics.persistence.postgresql;
import java.util.Calendar;
import org.gcube.accounting.analytics.TemporalConstraint;
import org.gcube.accounting.analytics.TemporalConstraint.AggregationMode;
import org.gcube.accounting.analytics.exception.DuplicatedKeyFilterException;
import org.gcube.accounting.analytics.exception.KeyException;
import org.gcube.accounting.analytics.exception.ValueException;
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class AccountingPersistenceQueryPostgreSQLTest extends ContextTest {
private static final Logger logger = LoggerFactory.getLogger(AccountingPersistenceQueryPostgreSQLTest.class);
@Test
public void testGetNoContextTimeSeriesQuery() throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
logger.debug("test");
Calendar startTimeCalendar = Calendar.getInstance();
startTimeCalendar.set(Calendar.MONTH, Calendar.MARCH);
startTimeCalendar.set(Calendar.DAY_OF_MONTH, 15);
startTimeCalendar.set(Calendar.HOUR_OF_DAY, 16);
startTimeCalendar.set(Calendar.MINUTE, 15);
Calendar entTimeCalendar = Calendar.getInstance();
entTimeCalendar.set(Calendar.MONTH, Calendar.MARCH);
entTimeCalendar.set(Calendar.DAY_OF_MONTH, 15);
entTimeCalendar.set(Calendar.HOUR_OF_DAY, 16);
entTimeCalendar.set(Calendar.MINUTE, 17);
TemporalConstraint temporalConstraint = new TemporalConstraint(startTimeCalendar.getTimeInMillis(), entTimeCalendar.getTimeInMillis(), AggregationMode.MINUTELY);
AccountingPersistenceQueryPostgreSQL accountingPersistenceQueryPostgreSQL = new AccountingPersistenceQueryPostgreSQL();
String ret = accountingPersistenceQueryPostgreSQL.getNoContextTimeSeriesQuery(AggregatedServiceUsageRecord.class, temporalConstraint, null);
logger.debug(ret);
}
}