Moved aggregation status connector to dst instance

This commit is contained in:
Luca Frosini 2024-02-29 16:11:31 +01:00
parent 58529a17ca
commit 5e8f31f384
3 changed files with 8 additions and 8 deletions

View File

@ -286,7 +286,7 @@ public class PostgreSQLConnector extends PersistencePostgreSQL implements Aggreg
* aggregation_start_date >= '2017-05-01 00:00:00.000 +0000' AND
* aggregation_start_date <= '2017-05-31 00:00:00.000 +0000'
*
* ORDER BY last_update_time DESC LIMIT 1
* ORDER BY aggregation_start_date DESC LIMIT 1
*
*/

View File

@ -6,7 +6,7 @@ package org.gcube.accounting.aggregator.persistence;
public class PostgreSQLConnectorStatus extends PostgreSQLConnector implements AggregatorPersistenceStatus {
protected PostgreSQLConnectorStatus() throws Exception {
super(AggregatorPersistenceSrc.class);
super(AggregatorPersistenceDst.class);
}
protected PostgreSQLConnectorStatus(Class<?> clazz) throws Exception {

View File

@ -26,7 +26,7 @@ public class PostgreSQLConnectorTest extends ContextTest {
public PostgreSQLConnectorTest() throws Exception {
aggregatorPersistenceStatus = AggregatorPersistenceFactory.getAggregatorPersistenceStatus();
logger.debug("{}", aggregatorPersistenceStatus);
logger.info("{}", aggregatorPersistenceStatus);
}
// @Ignore
@ -46,7 +46,7 @@ public class PostgreSQLConnectorTest extends ContextTest {
@Test
public void getLastTest() throws Exception {
AggregationStatus aggregationStatus = aggregatorPersistenceStatus.getLast(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, null, null);
logger.debug("Last : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
logger.info("Last : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
}
@Test
@ -59,8 +59,8 @@ public class PostgreSQLConnectorTest extends ContextTest {
@Test
public void getLastTestWithConstraint() throws Exception {
Calendar aggregationStart = Utility.getAggregationStartCalendar(2017, Calendar.JANUARY, 1);
Calendar aggregationEnd = Utility.getAggregationStartCalendar(2017, Calendar.JANUARY, 31);
Calendar aggregationStart = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 02);
Calendar aggregationEnd = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 03);
AggregationStatus aggregationStatus = aggregatorPersistenceStatus.getLast(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, aggregationStart.getTime(), aggregationEnd.getTime());
logger.info("Last : {}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
@ -79,9 +79,9 @@ public class PostgreSQLConnectorTest extends ContextTest {
@Test
public void getAggregationStatusTest() throws Exception{
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2017, Calendar.JUNE, 15);
Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 02);
AggregationStatus aggregationStatus = aggregatorPersistenceStatus.getAggregationStatus(ServiceUsageRecord.class.getSimpleName(), AggregationType.DAILY, aggregationStartCalendar.getTime());
logger.debug("{}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
logger.info("{}", DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
}
//@Test