← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18161: Test

 

------------------------------------------------------------
revno: 18161
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-03 14:19:38 +0100
message:
  Test
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.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-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-02-03 13:19:38 +0000
@@ -131,6 +131,10 @@
         ouGroupB.setGroupSet( ouGroupSetA );
         ouGroupC.setGroupSet( ouGroupSetA );
         
+        ouGroupA.addOrganisationUnit( ouA );
+        ouGroupA.addOrganisationUnit( ouB );
+        ouGroupA.addOrganisationUnit( ouC );
+        
         organisationUnitGroupService.addOrganisationUnitGroup( ouGroupA );
         organisationUnitGroupService.addOrganisationUnitGroup( ouGroupB );
         organisationUnitGroupService.addOrganisationUnitGroup( ouGroupC );
@@ -218,12 +222,27 @@
         assertEquals( 2, params.getDataElements().size() );
         assertEquals( 2, params.getPeriods().size() );      
     }
-    
+
+    @Test
+    public void testGetFromUrlOrgUnitGroup()
+    {
+        Set<String> dimensionParams = new HashSet<>();
+        dimensionParams.add( "ou:OU_GROUP-" + ouGroupA.getUid() );
+        dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
+        dimensionParams.add( "pe:2011;2012" );
+        
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
+        
+        assertEquals( 3, params.getOrganisationUnits().size() );  
+        assertEquals( 2, params.getDataElements().size() );
+        assertEquals( 2, params.getPeriods().size() ); 
+    }
+
     @Test
     public void testGetFromUrlOrgUnitLevel()
     {
         Set<String> dimensionParams = new HashSet<>();
-        dimensionParams.add( "ou:LEVEL-2-" + ouA.getUid() );
+        dimensionParams.add( "ou:LEVEL-2" );
         dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
         dimensionParams.add( "pe:2011;2012" );