use of com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException in project midpoint by Evolveum.
the class ActivitiInterface method notifyMidpointAboutProcessEvent.
private void notifyMidpointAboutProcessEvent(ProcessEvent event) {
OperationResult result = new OperationResult(DOT_CLASS + "notifyMidpointAboutProcessEvent");
String taskOid = ActivitiUtil.getTaskOid(event.getVariables());
Task task;
try {
task = taskManager.getTask(taskOid, result);
} catch (ObjectNotFoundException | SchemaException | RuntimeException e) {
throw new SystemException("Couldn't get task " + taskOid + " from repository: " + e.getMessage(), e);
}
if (task.getExecutionStatus() != TaskExecutionStatus.WAITING) {
LOGGER.trace("Asynchronous message received in a state different from WAITING (actual state: {}), ignoring it. Task = {}", task.getExecutionStatus(), task);
return;
}
try {
wfTaskController.onProcessEvent(event, task, result);
} catch (SchemaException | ObjectNotFoundException | ObjectAlreadyExistsException | RuntimeException e) {
throw new SystemException("Couldn't process a process-related event: " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException in project midpoint by Evolveum.
the class DummyItsmIntegrationConnectorInstance method createTicketModify.
@Override
protected String createTicketModify(ResourceObjectDefinition objectDefinition, PrismObject<ShadowType> shadow, Collection<? extends ResourceAttribute<?>> identifiers, String resourceOid, Collection<Operation> changes, Task task, OperationResult result) throws CommunicationException, GenericFrameworkException, SchemaException, ObjectAlreadyExistsException, ConfigurationException {
DummyItsm itsm = DummyItsm.getInstance();
String identifier;
try {
identifier = itsm.createTicket("MODIFY " + identifiers + ": " + changes);
} catch (CommunicationException | SchemaException | ObjectAlreadyExistsException | ConfigurationException e) {
LOGGER.info("MODIFY " + identifiers + ": " + changes + " => " + e);
throw e;
} catch (Exception e) {
LOGGER.info("MODIFY " + identifiers + ": " + changes + " => " + e);
throw new GenericFrameworkException(e);
}
LOGGER.info("MODIFY " + identifiers + ": " + changes + " => " + identifier);
return identifier;
}
use of com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException in project midpoint by Evolveum.
the class DummyItsmIntegrationConnectorInstance method createTicketAdd.
@Override
protected String createTicketAdd(PrismObject<? extends ShadowType> object, Task task, OperationResult result) throws CommunicationException, GenericFrameworkException, SchemaException, ObjectAlreadyExistsException, ConfigurationException {
DummyItsm itsm = DummyItsm.getInstance();
String identifier;
try {
identifier = itsm.createTicket("ADD " + object);
} catch (CommunicationException | SchemaException | ObjectAlreadyExistsException | ConfigurationException e) {
LOGGER.info("ADD " + object + " => " + e);
throw e;
} catch (Exception e) {
LOGGER.info("ADD " + object + " => " + e);
throw new GenericFrameworkException(e);
}
LOGGER.info("ADD " + object + " => " + identifier);
return identifier;
}
use of com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method replaceTriggers.
protected void replaceTriggers(String oid, Collection<XMLGregorianCalendar> timestamps, String uri) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
Task task = createPlainTask("replaceTriggers");
OperationResult result = task.getResult();
Collection<TriggerType> triggers = timestamps.stream().map(ts -> new TriggerType().timestamp(ts).handlerUri(uri)).collect(Collectors.toList());
ObjectDelta<ObjectType> delta = prismContext.deltaFor(ObjectType.class).item(ObjectType.F_TRIGGER).replaceRealValues(triggers).asObjectDeltaCast(oid);
executeChanges(delta, null, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
}
use of com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException in project midpoint by Evolveum.
the class TestDummy method test600AddAccountAlreadyExist.
/**
* Test for proper handling of "already exists" exception. We try to add a shadow.
* It fails, because there is unknown conflicting object on the resource. But a new
* shadow for the conflicting object should be created in the repository.
* MID-3603
*/
@Test
public void test600AddAccountAlreadyExist() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
syncServiceMock.reset();
dummyResourceCtl.addAccount(ACCOUNT_MURRAY_USERNAME, ACCOUNT_MURRAY_USERNAME);
PrismObject<ShadowType> account = createShadowNameOnly(resource, ACCOUNT_MURRAY_USERNAME);
account.checkConsistence();
display("Adding shadow", account);
when();
try {
provisioningService.addObject(account, null, null, task, result);
assertNotReached();
} catch (ObjectAlreadyExistsException e) {
then();
displayExpectedException(e);
}
assertFailure(result);
syncServiceMock.assertNotifyChange();
// Even though the operation failed a shadow should be created for the conflicting object
PrismObject<ShadowType> accountRepo = findAccountShadowByUsername(getMurrayRepoIcfName(), resource, result);
assertNotNull("Shadow for conflicting object was not created in the repository", accountRepo);
display("Repository shadow", accountRepo);
checkRepoAccountShadow(accountRepo);
assertEquals("Wrong ICF NAME in murray (repo) shadow", getMurrayRepoIcfName(), getIcfName(accountRepo));
assertSteadyResource();
}
Aggregations