dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40024
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20266: Analytics, testing
------------------------------------------------------------
revno: 20266
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 15:54:27 +0200
message:
Analytics, testing
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-09-21 13:21:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-09-21 13:54:27 +0000
@@ -32,6 +32,7 @@
import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -73,6 +74,8 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import static org.hisp.dhis.common.DimensionalObject.*;
+
/**
* @author Lars Helge Overland
*/
@@ -246,6 +249,32 @@
setDependency( analyticsService, "currentUserService", currentUserService );
}
+
+ @Test
+ public void testGetDimensionalObjects()
+ {
+ Set<String> dimensionParams = new LinkedHashSet<>();
+ dimensionParams.add( DimensionalObject.DATA_X_DIM_ID + DIMENSION_NAME_SEP + deA.getUid() + OPTION_SEP + deB.getUid() + OPTION_SEP + dsA.getUid() );
+ dimensionParams.add( DimensionalObject.ORGUNIT_DIM_ID + DIMENSION_NAME_SEP + ouA.getUid() + OPTION_SEP + ouB.getUid() );
+
+ List<DimensionalObject> dimensionalObject = analyticsService.getDimensionalObjects( dimensionParams, null, null, null );
+
+ DimensionalObject dxObject = dimensionalObject.get( 0 );
+ DimensionalObject ouObject = dimensionalObject.get( 1 );
+
+ List<NameableObject> dxItems = Lists.newArrayList( deA, deB, dsA );
+ List<NameableObject> ouItems = Lists.newArrayList( ouA, ouB );
+
+ assertEquals( DimensionalObject.DATA_X_DIM_ID, dxObject.getDimension() );
+ assertEquals( DimensionType.DATA_X, dxObject.getDimensionType() );
+ assertEquals( DataQueryParams.DISPLAY_NAME_DATA_X, dxObject.getDisplayName() );
+ assertEquals( dxItems, dxObject.getItems() );
+
+ assertEquals( DimensionalObject.ORGUNIT_DIM_ID, ouObject.getDimension() );
+ assertEquals( DimensionType.ORGANISATIONUNIT, ouObject.getDimensionType() );
+ assertEquals( DataQueryParams.DISPLAY_NAME_ORGUNIT, ouObject.getDisplayName() );
+ assertEquals( ouItems, ouObject.getItems() );
+ }
@Test
public void testGetDimensionData()
@@ -293,7 +322,7 @@
assertEquals( DimensionalObject.ORGUNIT_DIM_ID, actual.getDimension() );
assertEquals( DimensionType.ORGANISATIONUNIT, actual.getDimensionType() );
assertEquals( DataQueryParams.DISPLAY_NAME_ORGUNIT, actual.getDisplayName() );
- assertEquals( items, actual.getItems() );
+ assertEquals( items, actual.getItems() );
}
@Test