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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations