use of com.evolveum.midpoint.schema.expression.VariablesMap in project midpoint by Evolveum.
the class TestExpression method test110Path.
@Test
public void test110Path() throws Exception {
// GIVEN
OperationResult result = createOperationResult();
rememberScriptExecutionCount();
ExpressionType expressionType = parseExpression(EXPRESSION_PATH_FILE);
Collection<Source<?, ?>> sources = prepareStringSources();
VariablesMap variables = prepareBasicVariables();
ExpressionEvaluationContext expressionContext = new ExpressionEvaluationContext(sources, variables, getTestNameShort(), null);
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluatePropertyExpression(expressionType, PrimitiveType.STRING, expressionContext, result);
// THEN
assertOutputTriple(outputTriple).assertEmptyMinus().assertEmptyPlus().zeroSet().assertSinglePropertyValue(USER_JACK_NAME);
assertScriptExecutionIncrement(0);
}
use of com.evolveum.midpoint.schema.expression.VariablesMap in project midpoint by Evolveum.
the class TestExpression method test100AsIs.
@Test
public void test100AsIs() throws Exception {
// GIVEN
OperationResult result = createOperationResult();
rememberScriptExecutionCount();
ExpressionType expressionType = parseExpression(EXPRESSION_ASIS_FILE);
Collection<Source<?, ?>> sources = prepareStringSources();
VariablesMap variables = prepareBasicVariables();
ExpressionEvaluationContext expressionContext = new ExpressionEvaluationContext(sources, variables, getTestNameShort(), null);
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluatePropertyExpression(expressionType, PrimitiveType.STRING, expressionContext, result);
// THEN
assertOutputTriple(outputTriple).assertEmptyMinus().assertEmptyPlus().zeroSet().assertSinglePropertyValue(INPUT_VALUE);
assertScriptExecutionIncrement(0);
}
use of com.evolveum.midpoint.schema.expression.VariablesMap in project midpoint by Evolveum.
the class TestExpression method test130Const.
@Test
public void test130Const() throws Exception {
// GIVEN
OperationResult result = createOperationResult();
rememberScriptExecutionCount();
ExpressionType expressionType = parseExpression(EXPRESSION_CONST_FILE);
Collection<Source<?, ?>> sources = prepareStringSources();
VariablesMap variables = prepareBasicVariables();
ExpressionEvaluationContext expressionContext = new ExpressionEvaluationContext(sources, variables, getTestNameShort(), null);
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluatePropertyExpression(expressionType, PrimitiveType.STRING, expressionContext, result);
// THEN
assertOutputTriple(outputTriple).assertEmptyMinus().assertEmptyPlus().zeroSet().assertSinglePropertyValue(ExpressionTestUtil.CONST_FOO_VALUE);
assertScriptExecutionIncrement(0);
}
use of com.evolveum.midpoint.schema.expression.VariablesMap in project midpoint by Evolveum.
the class TestExpressionUtil method createVariables.
private VariablesMap createVariables() throws SchemaException, IOException {
VariablesMap variables = new VariablesMap();
PrismObject<UserType> user = createUser();
variables.addVariableDefinition(ExpressionConstants.VAR_USER, user, user.getDefinition());
variables.addVariableDefinition(ExpressionConstants.VAR_FOCUS, user, user.getDefinition());
return variables;
}
use of com.evolveum.midpoint.schema.expression.VariablesMap in project midpoint by Evolveum.
the class TestExpressionUtil method createVariablesOdo.
private VariablesMap createVariablesOdo() throws SchemaException, IOException {
VariablesMap variables = new VariablesMap();
PrismObject<UserType> userOld = createUser();
ObjectDelta<UserType> delta = PrismTestUtil.getPrismContext().deltaFactory().object().createModificationReplaceProperty(UserType.class, userOld.getOid(), UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Captain Jack Sparrow"));
ObjectDeltaObject<UserType> odo = new ObjectDeltaObject<>(userOld, delta, null, userOld.getDefinition());
odo.recompute();
variables.addVariableDefinition(ExpressionConstants.VAR_USER, odo, odo.getDefinition());
variables.addVariableDefinition(ExpressionConstants.VAR_FOCUS, odo, odo.getDefinition());
return variables;
}
Aggregations