← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 319: Added test for datamart

 

------------------------------------------------------------
revno: 319
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sat 2009-05-23 16:43:16 +0200
message:
  Added test for datamart
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java	2009-05-23 11:56:04 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java	2009-05-23 14:43:16 +0000
@@ -214,5 +214,30 @@
         assertEquals( 55.0, dataMartStore.getAggregatedValue( dataElement, period, unitK ) );
         assertEquals( 75.0, dataMartStore.getAggregatedValue( dataElement, period, unitL ) );
         assertEquals( 60.0, dataMartStore.getAggregatedValue( dataElement, period, unitM ) );
+    }
+
+    public void testAverageIntDataElementDataMart()
+    {
+        dataElement.setAggregationOperator( DataElement.AGGREGATION_OPERATOR_AVERAGE );
+        dataElement.setType( DataElement.TYPE_INT );
+        dataElement.setAggregationLevels( Arrays.asList( 3, 5 ) );        
+        
+        dataElementService.updateDataElement( dataElement );
+        
+        dataMartInternalProcess.export( dataElementIds, new ArrayList<Integer>(), periodIds, organisationUnitIds );
+        
+        assertEquals( 280.0, dataMartStore.getAggregatedValue( dataElement, period, unitA ) );
+        assertEquals( 240.0, dataMartStore.getAggregatedValue( dataElement, period, unitB ) );
+        assertEquals( 40.0, dataMartStore.getAggregatedValue( dataElement, period, unitC ) );
+        assertEquals( 60.0, dataMartStore.getAggregatedValue( dataElement, period, unitD ) );
+        assertEquals( 70.0, dataMartStore.getAggregatedValue( dataElement, period, unitE ) );
+        assertEquals( 90.0, dataMartStore.getAggregatedValue( dataElement, period, unitF ) );
+        assertEquals( 315.0, dataMartStore.getAggregatedValue( dataElement, period, unitG ) );
+        assertEquals( 75.0, dataMartStore.getAggregatedValue( dataElement, period, unitH ) );
+        assertEquals( 100.0, dataMartStore.getAggregatedValue( dataElement, period, unitI ) );
+        assertEquals( 200.0, dataMartStore.getAggregatedValue( dataElement, period, unitJ ) );
+        assertEquals( 55.0, dataMartStore.getAggregatedValue( dataElement, period, unitK ) );
+        assertEquals( 75.0, dataMartStore.getAggregatedValue( dataElement, period, unitL ) );
+        assertEquals( 60.0, dataMartStore.getAggregatedValue( dataElement, period, unitM ) );
     }    
 }



--
Trunk
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.