dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03606
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1201: Fixed test errors in ReportTableStatementTest
------------------------------------------------------------
revno: 1201
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-12-10 11:03:53 +0100
message:
Fixed test errors in ReportTableStatementTest
modified:
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 2009-12-10 07:54:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 2009-12-10 10:03:53 +0000
@@ -150,7 +150,7 @@
{
ResultSet resultSet = holder.getStatement().executeQuery( statement.getStatement() );
- log.info( "Get values statement: " + statement.getStatement() );
+ log.debug( "Get values statement: " + statement.getStatement() );
int columnCount = resultSet.getMetaData().getColumnCount(); //TODO improve performance?
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java 2009-12-10 09:13:44 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java 2009-12-10 10:03:53 +0000
@@ -80,7 +80,7 @@
buffer.append( "AND " + indexColumn + "='" + QUERY_PARAM_ID + indexColumn + "' " );
}
- buffer.append( "GROUP BY " );
+ buffer.append( "GROUP BY " ); // Required for getting sum of category option combos for data elements
selectColumns = reportTable.getIndexAndSelectColumns().iterator();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java 2009-11-24 11:01:39 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java 2009-12-10 10:03:53 +0000
@@ -194,8 +194,12 @@
statement.setInt( ReportTable.PERIOD_ID, 5 );
statement.setInt( ReportTable.ORGANISATIONUNIT_ID, 10 );
+ String expected =
+ "SELECT SUM(value), indicatorid, periodid FROM aggregatedindicatorvalue " +
+ "WHERE organisationunitid='10' GROUP BY organisationunitid, indicatorid, periodid ";
+
assertNotNull( statement.getStatement() );
- assertEquals( "SELECT value, indicatorid, periodid FROM aggregatedindicatorvalue WHERE organisationunitid='10' ", statement.getStatement() );
+ assertEquals( expected, statement.getStatement() );
}
@Test
@@ -212,8 +216,12 @@
statement.setInt( ReportTable.PERIOD_ID, 5 );
statement.setInt( ReportTable.ORGANISATIONUNIT_ID, 10 );
+ String expected =
+ "SELECT SUM(value), dataelementid, categoryoptioncomboid FROM aggregateddatavalue " +
+ "WHERE periodid='5' AND organisationunitid='10' GROUP BY periodid, organisationunitid, dataelementid, categoryoptioncomboid ";
+
assertNotNull( statement.getStatement() );
- assertEquals( "SELECT value, dataelementid, categoryoptioncomboid FROM aggregateddatavalue WHERE periodid='5' AND organisationunitid='10' ", statement.getStatement() );
+ assertEquals( expected, statement.getStatement() );
}
@Test
@@ -230,8 +238,12 @@
statement.setInt( ReportTable.PERIOD_ID, 5 );
statement.setInt( ReportTable.ORGANISATIONUNIT_ID, 10 );
+ String expected =
+ "SELECT SUM(value), dataelementid, periodid FROM aggregateddatavalue " +
+ "WHERE organisationunitid='10' GROUP BY organisationunitid, dataelementid, periodid ";
+
assertNotNull( statement.getStatement() );
- assertEquals( "SELECT value, dataelementid, periodid FROM aggregateddatavalue WHERE organisationunitid='10' ", statement.getStatement() );
+ assertEquals( expected, statement.getStatement() );
}
@Test
@@ -248,8 +260,12 @@
statement.setInt( ReportTable.PERIOD_ID, 5 );
statement.setInt( ReportTable.ORGANISATIONUNIT_ID, 10 );
+ String expected =
+ "SELECT SUM(value), datasetid, periodid FROM aggregateddatasetcompleteness " +
+ "WHERE organisationunitid='10' GROUP BY organisationunitid, datasetid, periodid ";
+
assertNotNull( statement.getStatement() );
- assertEquals( "SELECT value, datasetid, periodid FROM aggregateddatasetcompleteness WHERE organisationunitid='10' ", statement.getStatement() );
+ assertEquals( expected, statement.getStatement() );
}
@Test