Search in sources :

Example 61 with ItemDelta

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

the class LookupTableTest method test260ReplaceRowsExistingId.

@Test
public void test260ReplaceRowsExistingId() throws Exception {
    OperationResult result = new OperationResult("test260ReplaceRowsExistingId");
    LookupTableRowType row5 = new LookupTableRowType(prismContext);
    // dangerous
    row5.setId(5L);
    row5.setKey("key 5 plus");
    row5.setValue("value 5 plus");
    row5.setLastChangeTimestamp(XmlTypeConverter.createXMLGregorianCalendar(new Date(99, 3, 10)));
    List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(LookupTableType.class, prismContext).item(F_ROW).replace(row5).asItemDeltas();
    executeAndCheckModification(modifications, result, 0, null);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Example 62 with ItemDelta

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

the class CertificationTest method test300AddDeleteModifyCase.

@Test
public void test300AddDeleteModifyCase() throws Exception {
    OperationResult result = new OperationResult("test300AddDeleteModifyCase");
    AccessCertificationCaseType caseNoId = new AccessCertificationCaseType(prismContext);
    caseNoId.setObjectRef(createObjectRef("x123", ObjectTypes.USER));
    caseNoId.setTargetRef(createObjectRef("x456", ObjectTypes.ROLE));
    caseNoId.setStageNumber(1);
    // explicit ID is dangerous
    AccessCertificationCaseType case110 = new AccessCertificationCaseType(prismContext).id(SECOND_NEW_CASE_ID).objectRef(createObjectRef("x100123", ObjectTypes.USER)).targetRef(createObjectRef("x100456", ObjectTypes.ROLE)).stageNumber(1).beginWorkItem().assigneeRef(createObjectRef("x100789", ObjectTypes.USER)).end();
    AccessCertificationCaseType case100 = new AccessCertificationCaseType();
    case100.setId(NEW_CASE_ID);
    List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE).add(caseNoId, case110).delete(case100).item(F_CASE, 3, AccessCertificationCaseType.F_STAGE_NUMBER).replace(400).asItemDeltas();
    executeAndCheckModification(modifications, result, 0);
    checkCasesForCampaign(campaign1Oid, 9, result);
    checkCasesTotal(9, result);
    checkWorkItemsForCampaign(campaign1Oid, 9, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, SECOND_NEW_CASE_ID, 1, result);
    checkWorkItemsTotal(9, result);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) Test(org.testng.annotations.Test)

Example 63 with ItemDelta

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

the class CertificationTest method test250DeleteCase.

@Test
public void test250DeleteCase() throws Exception {
    OperationResult result = new OperationResult("test250DeleteCase");
    AccessCertificationCaseType case7 = new AccessCertificationCaseType();
    case7.setId(7L);
    List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE).delete(case7).asItemDeltas();
    executeAndCheckModification(modifications, result, 0);
    checkCasesForCampaign(campaign1Oid, 8, result);
    checkCasesTotal(8, result);
    checkWorkItemsForCampaign(campaign1Oid, 9, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, NEW_CASE_ID, 1, result);
    checkWorkItemsTotal(9, result);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) Test(org.testng.annotations.Test)

Example 64 with ItemDelta

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

the class CertificationTest method test320AddDeleteModifyResponse.

@Test
public void test320AddDeleteModifyResponse() throws Exception {
    OperationResult result = new OperationResult("test320AddDeleteModifyResponse");
    AccessCertificationWorkItemType wiNoId = new AccessCertificationWorkItemType(prismContext);
    wiNoId.assigneeRef(createObjectRef("888", ObjectTypes.USER));
    wiNoId.setStageNumber(1);
    AccessCertificationWorkItemType wi200 = new AccessCertificationWorkItemType(prismContext);
    // this is dangerous
    wi200.setId(200L);
    wi200.setStageNumber(1);
    wi200.assigneeRef(createObjectRef("200888", ObjectTypes.USER));
    AccessCertificationWorkItemType wi1 = new AccessCertificationWorkItemType();
    wi1.setId(1L);
    List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, 6, F_WORK_ITEM).add(wiNoId, wi200).item(F_CASE, 6, F_WORK_ITEM).delete(wi1).item(F_CASE, 6, F_WORK_ITEM, 2, F_OUTPUT, F_OUTCOME).replace(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_ACCEPT).asItemDeltas();
    executeAndCheckModification(modifications, result, 0);
    checkCasesForCampaign(campaign1Oid, 9, result);
    checkCasesTotal(9, result);
    checkWorkItemsForCampaign(campaign1Oid, 10, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
    checkWorkItemsForCampaignAndCase(campaign1Oid, SECOND_NEW_CASE_ID, 1, result);
    checkWorkItemsTotal(10, result);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) AccessCertificationWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType) Test(org.testng.annotations.Test)

Example 65 with ItemDelta

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

the class CertificationTest method test220ModifyWorkItemProperties.

@Test
public void test220ModifyWorkItemProperties() throws Exception {
    OperationResult result = new OperationResult("test220ModifyWorkItemProperties");
    List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, 1L, F_WORK_ITEM, 1L, F_OUTPUT).replace(new AbstractWorkItemOutputType().outcome(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED).comment("hi")).asItemDeltas();
    executeAndCheckModification(modifications, result, 0);
    checksCountsStandard(result);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) Test(org.testng.annotations.Test)

Aggregations

ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)185 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)87 Test (org.testng.annotations.Test)66 ArrayList (java.util.ArrayList)64 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)56 Task (com.evolveum.midpoint.task.api.Task)40 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)33 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)30 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)26 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)21 QName (javax.xml.namespace.QName)21 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)20 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)19 LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)15 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)15 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)14 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)14 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)14 PrismObject (com.evolveum.midpoint.prism.PrismObject)13 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)12