use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class TestFilterExpression method test130EvaluateExpressionEmployeeTypeError.
@Test
public void test130EvaluateExpressionEmployeeTypeError() throws Exception {
final String TEST_NAME = "testEvaluateExpressionEmployeeTypeError";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
try {
evaluateExpressionAssertFilter("expression-employeeType-error.xml", null, NoneFilter.class, task, result);
AssertJUnit.fail("Unexpected success");
} catch (ExpressionEvaluationException e) {
// this is expected
assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("evaluated to no value"));
}
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ObjectDeltaOperationPanel method initLayout.
private void initLayout() {
// ObjectDeltaType od = getModel().getObjectDelta();
WebMarkupContainer objectDeltaOperationMarkup = new WebMarkupContainer(ID_OBJECT_DELTA_OPERATION_MARKUP);
objectDeltaOperationMarkup.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getBoxCssClass();
}
}));
add(objectDeltaOperationMarkup);
Label executionResult = new Label(ID_PARAMETERS_EXECUTION_RESULT, new PropertyModel(getModel(), "executionResult.status"));
executionResult.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(executionResult);
Label resourceName = new Label(ID_PARAMETERS_RESOURCE_NAME, new PropertyModel(getModel(), ObjectDeltaOperationType.F_RESOURCE_NAME.getLocalPart()));
resourceName.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(resourceName);
Label objectName = new Label(ID_PARAMETERS_OBJECT_NAME, new PropertyModel(getModel(), ObjectDeltaOperationType.F_OBJECT_NAME.getLocalPart()));
objectName.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(objectName);
final SceneDto sceneDto;
try {
sceneDto = loadSceneForDelta();
} catch (SchemaException | ExpressionEvaluationException e) {
OperationResult result = new OperationResult(ObjectDeltaOperationPanel.class.getName() + ".loadSceneForDelta");
result.recordFatalError("Couldn't fetch or visualize the delta: " + e.getMessage(), e);
parentPage.showResult(result);
throw parentPage.redirectBackViaRestartResponseException();
}
IModel<SceneDto> deltaModel = new AbstractReadOnlyModel<SceneDto>() {
private static final long serialVersionUID = 1L;
public SceneDto getObject() {
return sceneDto;
}
};
ScenePanel deltaPanel = new ScenePanel(ID_DELTA_PANEL, deltaModel) {
@Override
public void headerOnClickPerformed(AjaxRequestTarget target, IModel<SceneDto> model) {
super.headerOnClickPerformed(target, model);
// model.getObject().setMinimized(!model.getObject().isMinimized());
target.add(ObjectDeltaOperationPanel.this);
}
};
deltaPanel.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(deltaPanel);
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ObjectDeltaOperationPanel method loadSceneForDelta.
private SceneDto loadSceneForDelta() throws SchemaException, ExpressionEvaluationException {
Scene scene;
ObjectDelta<? extends ObjectType> delta;
ObjectDeltaType deltaType = getModel().getObject().getObjectDelta();
try {
delta = DeltaConvertor.createObjectDelta(deltaType, parentPage.getPrismContext());
} catch (SchemaException e) {
LoggingUtils.logException(LOGGER, "SchemaException while converting delta:\n{}", e, deltaType);
throw e;
}
try {
scene = parentPage.getModelInteractionService().visualizeDelta(delta, parentPage.createSimpleTask(ID_PARAMETERS_DELTA), new OperationResult(ID_PARAMETERS_DELTA));
} catch (SchemaException | ExpressionEvaluationException e) {
LoggingUtils.logException(LOGGER, "SchemaException while visualizing delta:\n{}", e, DebugUtil.debugDump(delta));
throw e;
}
SceneDto deltaSceneDto = new SceneDto(scene);
deltaSceneDto.setMinimized(true);
return deltaSceneDto;
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class OrgMemberPanel method deleteManagerConfirmPerformed.
private void deleteManagerConfirmPerformed(FocusType manager, AjaxRequestTarget target) {
getPageBase().hideMainPopup(target);
OperationResult parentResult = new OperationResult("Remove manager");
Task task = getPageBase().createSimpleTask("Remove manager");
try {
ObjectDelta delta = ObjectDelta.createDeleteDelta(manager.asPrismObject().getCompileTimeClass(), manager.getOid(), getPageBase().getPrismContext());
getPageBase().getModelService().executeChanges(WebComponentUtil.createDeltaCollection(delta), null, task, parentResult);
parentResult.computeStatus();
} catch (SchemaException | ObjectAlreadyExistsException | ObjectNotFoundException | ExpressionEvaluationException | CommunicationException | ConfigurationException | PolicyViolationException | SecurityViolationException e) {
parentResult.recordFatalError("Failed to remove manager " + e.getMessage(), e);
LoggingUtils.logUnexpectedException(LOGGER, "Failed to remove manager", e);
getPageBase().showResult(parentResult);
}
target.add(getPageBase().getFeedbackPanel());
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class TestMappingDynamicSimple method testGeneratePolicyBad.
@Test
public void testGeneratePolicyBad() throws Exception {
final String TEST_NAME = "testGeneratePolicy";
try {
generatePolicy(TEST_NAME, "mapping-generate-policy-bad.xml", "c0c010c0-d34d-b33f-f00d-999888111113.xml", null, false);
AssertJUnit.fail("Unexpected success");
} catch (ExpressionEvaluationException e) {
// This is expected, the policy is broken
}
}
Aggregations