dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39996
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20245: Analytics, test
------------------------------------------------------------
revno: 20245
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 09:44:34 +0200
message:
Analytics, 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-09-21 07:38:54 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-09-21 07:44:34 +0000
@@ -47,7 +47,10 @@
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementDomain;
+import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
@@ -80,6 +83,8 @@
private DataElement deE;
private DataElement deF;
+ private DataElementCategoryOptionCombo cocA;
+
private DataSet dsA;
private DataSet dsB;
@@ -107,6 +112,9 @@
private DataElementService dataElementService;
@Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
private DataSetService dataSetService;
@Autowired
@@ -137,6 +145,8 @@
dataElementService.addDataElement( deD );
dataElementService.addDataElement( deE );
dataElementService.addDataElement( deF );
+
+ cocA = categoryService.getDefaultDataElementCategoryOptionCombo();
dsA = createDataSet( 'A', monthly );
dsB = createDataSet( 'B', monthly );
@@ -219,6 +229,25 @@
assertEquals( DataQueryParams.DISPLAY_NAME_DATA_X, actual.getDisplayName() );
assertEquals( items, actual.getItems() );
}
+
+ @Test
+ public void testGetDimensionOperand()
+ {
+ DataElementOperand opA = new DataElementOperand( deA, cocA );
+ DataElementOperand opB = new DataElementOperand( deB, cocA );
+ DataElementOperand opC = new DataElementOperand( deC, cocA );
+
+ List<NameableObject> items = Lists.newArrayList( opA, opB, opC );
+
+ List<String> itemUids = IdentifiableObjectUtils.getUids( items );
+
+ DimensionalObject actual = analyticsService.getDimension( DimensionalObject.DATA_X_DIM_ID, itemUids, null, null, null, false );
+
+ assertEquals( DimensionalObject.DATA_X_DIM_ID, actual.getDimension() );
+ assertEquals( DimensionType.DATA_X, actual.getDimensionType() );
+ assertEquals( DataQueryParams.DISPLAY_NAME_DATA_X, actual.getDisplayName() );
+ assertEquals( items, actual.getItems() );
+ }
@Test
public void testGetDimensionOrgUnit()