Search in sources :

Example 71 with ReferenceDelta

use of com.evolveum.midpoint.prism.delta.ReferenceDelta in project midpoint by Evolveum.

the class TestPreviewChanges method modifyUserAddAccountImplicitExplicitNotEqualReverse.

private void modifyUserAddAccountImplicitExplicitNotEqualReverse(String bundleName, ObjectSource<PrismObject<ShadowType>> accountSource, ObjectChecker<ModelContext<UserType>> checker) throws Exception {
    final String TEST_NAME = bundleName + "ImplicitExplicitNotEqualReverse";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestPreviewChanges.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<ShadowType> account = accountSource.get();
    ObjectDelta<UserType> userDelta = ObjectDelta.createEmptyModifyDelta(UserType.class, USER_JACK_OID, prismContext);
    PrismReferenceValue accountRefVal = new PrismReferenceValue();
    accountRefVal.setObject(account.clone());
    ReferenceDelta accountRefDelta = ReferenceDelta.createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
    userDelta.addModification(accountRefDelta);
    // Let's make the account different. This should cause the preview to fail
    account.asObjectable().setDescription("aye!");
    ObjectDelta<ShadowType> accountDelta = account.createAddDelta();
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(accountDelta, userDelta);
    doPreviewFail(deltas, task, result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Aggregations

ReferenceDelta (com.evolveum.midpoint.prism.delta.ReferenceDelta)71 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)49 Task (com.evolveum.midpoint.task.api.Task)44 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)42 Test (org.testng.annotations.Test)41 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)33 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)29 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)29 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)27 Collection (java.util.Collection)21 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)14 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)12 ArrayList (java.util.ArrayList)12 ShadowDiscriminatorObjectDelta (com.evolveum.midpoint.common.refinery.ShadowDiscriminatorObjectDelta)11 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)11 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)10 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)9 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)8 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)7 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6