@Test public void testIterationCondition() throws Exception { final String TEST_NAME = "testIterationCondition"; TestUtil.displayTestTile(TEST_NAME); // GIVEN OperationResult result = new OperationResult(TestExpression.class.getName() + "." + TEST_NAME); rememberScriptExecutionCount(); ExpressionType expressionType = PrismTestUtil.parseAtomicValue( EXPRESSION_ITERATION_CONDITION_FILE, ExpressionType.COMPLEX_TYPE); PrismPropertyDefinition<Boolean> outputDefinition = new PrismPropertyDefinitionImpl<Boolean>( ExpressionConstants.OUTPUT_ELMENT_NAME, DOMUtil.XSD_BOOLEAN, prismContext); Expression<PrismPropertyValue<Boolean>, PrismPropertyDefinition<Boolean>> expression = expressionFactory.makeExpression(expressionType, outputDefinition, TEST_NAME, null, result); ExpressionVariables variables = new ExpressionVariables(); PrismObject<UserType> user = PrismTestUtil.parseObject(USER_JACK_FILE); variables.addVariableDefinition(ExpressionConstants.VAR_FOCUS, user); variables.addVariableDefinition(ExpressionConstants.VAR_USER, user); PrismObject<ShadowType> account = PrismTestUtil.parseObject(ACCOUNT_JACK_DUMMYFILE); variables.addVariableDefinition(ExpressionConstants.VAR_SHADOW, account); variables.addVariableDefinition(ExpressionConstants.VAR_ITERATION, 1); variables.addVariableDefinition(ExpressionConstants.VAR_ITERATION_TOKEN, "001"); ExpressionEvaluationContext expressionContext = new ExpressionEvaluationContext(null, variables, TEST_NAME, null, result); // WHEN PrismValueDeltaSetTriple<PrismPropertyValue<Boolean>> outputTriple = expression.evaluate(expressionContext); // THEN assertNotNull(outputTriple); outputTriple.checkConsistence(); // Make sure that the script is executed only once. There is no delta in the variables, no need // to do it twice. assertScriptExecutionIncrement(1); }