PropertyConditionEvaluator implements ConditionEvaluator { protected Object getPropertyValue(Item item, String expression) throws Exception { if (usePropertyConditionOptimizations) { Object result = getHardcodedPropertyValue(item, expression); if (!NOT_OPTIMIZED_MARKER.equals(result)) { return result; } } if (useOGNLScripting) { return getOGNLPropertyValue(item, expression); } else { logger.warn("OGNL Off. Expression not evaluated : {}", expression); return null; } }  void setUsePropertyConditionOptimizations(boolean usePropertyConditionOptimizations); void setExpressionFilterFactory(ExpressionFilterFactory expressionFilterFactory); @Override boolean eval(Condition condition, Item item, Map<String, Object> context, ConditionEvaluatorDispatcher dispatcher); static final String NOT_OPTIMIZED_MARKER; }
@Test public void testPropertyEvaluator() throws Exception { Event mockEvent = generateMockEvent(); assertEquals("Target itemId value is not correct", MOCK_ITEM_ID, propertyConditionEvaluator.getPropertyValue(mockEvent, "target.itemId")); assertEquals("Target scope is not correct", DIGITALL_SCOPE, propertyConditionEvaluator.getPropertyValue(mockEvent, "target.scope")); assertEquals("Target page path value is not correct", PAGE_PATH_VALUE, propertyConditionEvaluator.getPropertyValue(mockEvent, "target.properties.pageInfo.pagePath")); assertNull("Unexisting property should be null", propertyConditionEvaluator.getPropertyValue(mockSession, "systemProperties.goals._csk6r4cgeStartReached")); assertNull("Unexisting property should be null", propertyConditionEvaluator.getPropertyValue(mockProfile, "properties.email")); assertEquals("Session size should be 10", 10, propertyConditionEvaluator.getPropertyValue(mockSession, "size")); assertEquals("Session last event date is not right", SESSION_LAST_EVENT_DATE, propertyConditionEvaluator.getPropertyValue(mockSession, "lastEventDate")); }