← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20774: Testing

 

------------------------------------------------------------
revno: 20774
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-19 21:37:11 +0200
message:
  Testing
modified:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.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-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-10-13 13:10:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-10-19 19:37:11 +0000
@@ -542,6 +542,18 @@
         assertEquals( ProgramIndicator.VALID, programIndicatorService.expressionIsValid( indicatorA.getExpression() ) );
         assertEquals( ProgramIndicator.EXPRESSION_NOT_WELL_FORMED, programIndicatorService.expressionIsValid( indicatorD.getExpression() ) );
     }
+    
+    @Test
+    public void testExpressionWithFunctionIsValid()
+    {
+        String exprA = "#{" + psA.getUid() + "." + deA.getUid() + "}";
+        String exprB = "d2:zing(#{" + psA.getUid() + "." + deA.getUid() + "})";
+        String exprC = "d2:condition('#{" + psA.getUid() + "." + deA.getUid() + "} > 10',2,1)";
+        
+        assertEquals( ProgramIndicator.VALID, programIndicatorService.expressionIsValid( exprA ) );
+        assertEquals( ProgramIndicator.VALID, programIndicatorService.expressionIsValid( exprB ) );
+        assertEquals( ProgramIndicator.VALID, programIndicatorService.expressionIsValid( exprC ) );
+    }
 
     @Test
     public void testFilterIsValid()

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-10-04 20:21:21 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-10-19 19:37:11 +0000
@@ -191,6 +191,8 @@
         }
         catch ( JexlException ex )
         {
+            System.out.println( ex.getMessage() );
+            System.out.println( DebugUtils.getStackTrace( ex ) );
             if ( ex.getMessage().contains( "divide error" ) )
             {
                 return true; //TODO Masking bug in Jexl, fix