use of com.evolveum.midpoint.repo.common.expression.ExpressionVariables in project midpoint by Evolveum.
the class TestModelExpressions method testGetLinkedShadowName.
@Test
public void testGetLinkedShadowName() throws Exception {
final String TEST_NAME = "testGetLinkedShadowName";
TestUtil.displayTestTile(this, TEST_NAME);
rememberShadowFetchOperationCount();
ExpressionVariables variables = ExpressionVariables.create(ExpressionConstants.VAR_USER, getUser(USER_GUYBRUSH_OID));
assertExecuteScriptExpressionString(TEST_NAME, variables, ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
assertShadowFetchOperationCountIncrement(1);
}
use of com.evolveum.midpoint.repo.common.expression.ExpressionVariables in project midpoint by Evolveum.
the class TestModelExpressions method testGetLinkedShadowNameRepo.
@Test
public void testGetLinkedShadowNameRepo() throws Exception {
final String TEST_NAME = "testGetLinkedShadowNameRepo";
TestUtil.displayTestTile(this, TEST_NAME);
rememberShadowFetchOperationCount();
ExpressionVariables variables = ExpressionVariables.create(ExpressionConstants.VAR_USER, getUser(USER_GUYBRUSH_OID));
assertExecuteScriptExpressionString(TEST_NAME, variables, ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
assertShadowFetchOperationCountIncrement(0);
}
use of com.evolveum.midpoint.repo.common.expression.ExpressionVariables in project midpoint by Evolveum.
the class TestModelExpressions method testGetLinkedShadowKindIntentFullname.
@Test
public void testGetLinkedShadowKindIntentFullname() throws Exception {
final String TEST_NAME = "testGetLinkedShadowKindIntentFullname";
TestUtil.displayTestTile(this, TEST_NAME);
rememberShadowFetchOperationCount();
ExpressionVariables variables = ExpressionVariables.create(ExpressionConstants.VAR_USER, getUser(USER_GUYBRUSH_OID));
assertExecuteScriptExpressionString(TEST_NAME, variables, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME);
assertShadowFetchOperationCountIncrement(1);
}
use of com.evolveum.midpoint.repo.common.expression.ExpressionVariables in project midpoint by Evolveum.
the class TestModelExpressions method testGetManagersOids.
@Test
public void testGetManagersOids() throws Exception {
final String TEST_NAME = "testGetManagersOids";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestModelExpressions.class.getName() + "." + TEST_NAME);
PrismObject<UserType> chef = repositoryService.getObject(UserType.class, CHEF_OID, null, result);
ScriptExpressionEvaluatorType scriptType = parseScriptType("expression-" + TEST_NAME + ".xml");
PrismPropertyDefinition<String> outputDefinition = new PrismPropertyDefinitionImpl<>(PROPERTY_NAME, DOMUtil.XSD_STRING, PrismTestUtil.getPrismContext());
ScriptExpression scriptExpression = scriptExpressionFactory.createScriptExpression(scriptType, outputDefinition, TEST_NAME);
ExpressionVariables variables = new ExpressionVariables();
variables.addVariableDefinition(new QName(SchemaConstants.NS_C, "user"), chef);
// WHEN
List<PrismPropertyValue<String>> scriptOutputs = evaluate(scriptExpression, variables, false, TEST_NAME, null, result);
// THEN
display("Script output", scriptOutputs);
assertEquals("Unexpected number of script outputs", 3, scriptOutputs.size());
Set<String> oids = new HashSet<String>();
oids.add(scriptOutputs.get(0).getValue());
oids.add(scriptOutputs.get(1).getValue());
oids.add(scriptOutputs.get(2).getValue());
Set<String> expectedOids = new HashSet<String>(Arrays.asList(new String[] { CHEESE_OID, CHEESE_JR_OID, LECHUCK_OID }));
assertEquals("Unexpected script output", expectedOids, oids);
}
use of com.evolveum.midpoint.repo.common.expression.ExpressionVariables in project midpoint by Evolveum.
the class TestModelExpressions method testGetUserByOid.
@Test
public void testGetUserByOid() throws Exception {
final String TEST_NAME = "testGetUserByOid";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestModelExpressions.class.getName() + "." + TEST_NAME);
PrismObject<UserType> chef = repositoryService.getObject(UserType.class, CHEF_OID, null, result);
ExpressionVariables variables = ExpressionVariables.create(ExpressionConstants.VAR_USER, chef);
// WHEN, THEN
assertExecuteScriptExpressionString(TEST_NAME, variables, chef.asObjectable().getName().getOrig());
}
Aggregations