use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test350RecomputeJack.
@Test
public void test350RecomputeJack() throws Exception {
final String TEST_NAME = "test350RecomputeJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> expression = parseAnyData(RECOMPUTE_JACK_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
assertOutputData(output, 1, OperationResultStatus.SUCCESS);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Recomputed user:c0c010c0-d34d-b33f-f00d-111111111111(jack)\n", output.getConsoleOutput());
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test420NotificationAboutJack.
@Test
public void test420NotificationAboutJack() throws Exception {
final String TEST_NAME = "test420NotificationAboutJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> expression = parseAnyData(NOTIFICATION_ABOUT_JACK_FILE);
prepareNotifications();
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
result.computeStatus();
TestUtil.assertSuccess(result);
assertOutputData(output, 1, OperationResultStatus.SUCCESS);
assertEquals("Produced 1 event(s)\n", output.getConsoleOutput());
display("Dummy transport", dummyTransport);
checkDummyTransportMessages("Custom", 1);
Message m = dummyTransport.getMessages("dummy:Custom").get(0);
assertEquals("Wrong message body", "jack/" + USER_JACK_OID, m.getBody());
assertEquals("Wrong message subject", "Ad hoc notification", m.getSubject());
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test210SearchForShadows.
@Test
public void test210SearchForShadows() throws Exception {
final String TEST_NAME = "test210SearchForShadows";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<SearchExpressionType> expression = parseAnyData(SEARCH_FOR_SHADOWS_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals(5, output.getFinalOutput().getData().size());
assertAttributesFetched(output.getFinalOutput().getData());
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test330ModifyJack.
@Test
public void test330ModifyJack() throws Exception {
final String TEST_NAME = "test330ModifyJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> expression = parseAnyData(MODIFY_JACK_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
assertOutputData(output, 1, OperationResultStatus.SUCCESS);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Modified user:c0c010c0-d34d-b33f-f00d-111111111111(jack)\n", output.getConsoleOutput());
assertEquals("Nowhere", searchObjectByName(UserType.class, "jack").asObjectable().getLocality().getOrig());
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test360AssignToJack.
@Test
public void test360AssignToJack() throws Exception {
final String TEST_NAME = "test360AssignToJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> expression = parseAnyData(ASSIGN_TO_JACK_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
assertOutputData(output, 1, OperationResultStatus.SUCCESS);
result.computeStatus();
TestUtil.assertSuccess(result);
//assertEquals("Recomputed user:c0c010c0-d34d-b33f-f00d-111111111111(jack)\n", output.getConsoleOutput());
PrismObject<UserType> jack = getUser(USER_JACK_OID);
display("jack after assignments creation", jack);
assertAssignedAccount(jack, "10000000-0000-0000-0000-000000000104");
assertAssignedRole(jack, "12345678-d34d-b33f-f00d-55555555cccc");
}
Aggregations