use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test120Log.
@Test
public void test120Log() throws Exception {
final String TEST_NAME = "test120Log";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> logAction = parseAnyData(LOG_FILE);
LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME);
tailer.tail();
tailer.setExpecteMessage("Custom message:");
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(logAction.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
assertNoOutputData(output);
result.computeStatus();
TestUtil.assertSuccess(result);
tailer.tail();
tailer.assertExpectedMessage();
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test320DeleteAndAddJack.
@Test
public void test320DeleteAndAddJack() throws Exception {
final String TEST_NAME = "test320DeleteAndAddJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<ScriptingExpressionType> expression = parseAnyData(DELETE_AND_ADD_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("Deleted user:c0c010c0-d34d-b33f-f00d-111111111111(jack)\nAdded user:c0c010c0-d34d-b33f-f00d-111111111111(jack)\n", output.getConsoleOutput());
assertAdministrativeStatusEnabled(searchObjectByName(UserType.class, "jack"));
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test206SearchForRoles.
@Test
public void test206SearchForRoles() throws Exception {
final String TEST_NAME = "test206SearchForRoles";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<SearchExpressionType> expression = parseAnyData(SEARCH_FOR_ROLES_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
result.computeStatus();
TestUtil.assertSuccess(result);
//assertEquals(9, output.getData().size());
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test545SearchUserResolveRoleMembershipRef.
@Test
public void test545SearchUserResolveRoleMembershipRef() throws Exception {
final String TEST_NAME = "test545SearchUserResolveRoleMembershipRef";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
PrismProperty<SearchExpressionType> expression = parseAnyData(SEARCH_FOR_USERS_RESOLVE_ROLE_MEMBERSHIP_REF_FILE);
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);
// THEN
dumpOutput(output, result);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals(2, output.getFinalOutput().getData().size());
for (PipelineItem item : output.getFinalOutput().getData()) {
PrismAsserts.assertHasObject((PrismContainerValue) item.getValue(), new ItemPath(UserType.F_ROLE_MEMBERSHIP_REF));
PrismAsserts.assertHasNoObject((PrismContainerValue) item.getValue(), new ItemPath(UserType.F_LINK_REF));
}
}
use of com.evolveum.midpoint.model.impl.scripting.ExecutionContext in project midpoint by Evolveum.
the class TestScriptingBasic method test100EmptySequence.
@Test
public void test100EmptySequence() throws Exception {
final String TEST_NAME = "test100EmptySequence";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(DOT_CLASS + TEST_NAME);
OperationResult result = task.getResult();
ExpressionSequenceType sequence = new ExpressionSequenceType();
// WHEN
ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(sequence, task, result);
// THEN
dumpOutput(output, result);
assertNoOutputData(output);
result.computeStatus();
TestUtil.assertSuccess(result);
}
Aggregations