use of com.evolveum.midpoint.prism.delta.ItemDelta in project midpoint by Evolveum.
the class CertificationTest method test270ModifyWorkItem.
@Test
public void test270ModifyWorkItem() throws Exception {
OperationResult result = new OperationResult("test270ModifyWorkItem");
PrismObject<AccessCertificationCampaignType> campaign = getFullCampaign(campaign1Oid, result);
AccessCertificationCaseType case100 = campaign.asObjectable().getCase().stream().filter(c -> c.getId() == NEW_CASE_ID).findFirst().orElseThrow(() -> new AssertionError("No case 100"));
assertEquals("Wrong # of work items in case 100", 2, case100.getWorkItem().size());
AccessCertificationWorkItemType workItem = case100.getWorkItem().stream().filter(wi -> wi.getOriginalAssigneeRef() != null).findFirst().orElse(null);
assertNotNull("No new work item", workItem);
XMLGregorianCalendar closedTimestamp = XmlTypeConverter.createXMLGregorianCalendar(new Date());
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, NEW_CASE_ID, F_WORK_ITEM, workItem.getId(), AccessCertificationWorkItemType.F_CLOSE_TIMESTAMP).replace(closedTimestamp).asItemDeltas();
// WHEN
executeAndCheckModification(modifications, result, 0);
// THEN
checkCasesForCampaign(campaign1Oid, 8, result);
checkCasesTotal(8, result);
checkWorkItemsForCampaign(campaign1Oid, 10, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, NEW_CASE_ID, 2, result);
checkWorkItemsTotal(10, result);
}
use of com.evolveum.midpoint.prism.delta.ItemDelta in project midpoint by Evolveum.
the class CertificationTest method test240AddCases.
@Test
public void test240AddCases() throws Exception {
OperationResult result = new OperationResult("test240AddDeleteCases");
AccessCertificationCaseType caseNoId = new AccessCertificationCaseType(prismContext);
caseNoId.setObjectRef(createObjectRef("123", ObjectTypes.USER));
caseNoId.setTargetRef(createObjectRef("456", ObjectTypes.ROLE));
caseNoId.setStageNumber(1);
// explicit ID is dangerous (possibility of conflict!)
AccessCertificationCaseType case100 = new AccessCertificationCaseType(prismContext);
case100.setId(NEW_CASE_ID);
case100.setObjectRef(createObjectRef("100123", ObjectTypes.USER));
case100.setTargetRef(createObjectRef("100456", ObjectTypes.ROLE));
case100.beginWorkItem().assigneeRef(createObjectRef("ref1", ObjectTypes.USER)).end();
case100.setStageNumber(1);
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE).add(caseNoId, case100).asItemDeltas();
executeAndCheckModification(modifications, result, 0);
checkCasesForCampaign(campaign1Oid, 9, result);
checkCasesTotal(9, result);
checkWorkItemsForCampaign(campaign1Oid, 11, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, NEW_CASE_ID, 1, result);
checkWorkItemsTotal(11, result);
}
use of com.evolveum.midpoint.prism.delta.ItemDelta in project midpoint by Evolveum.
the class CertificationTest method test230ModifyAllLevels.
@Test
public void test230ModifyAllLevels() throws Exception {
OperationResult result = new OperationResult("test230ModifyAllLevels");
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_NAME).replace(new PolyString("Campaign 2", "campaign 2")).item(F_STATE).replace(IN_REMEDIATION).item(F_CASE, 2, F_CURRENT_STAGE_OUTCOME).replace(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NO_RESPONSE).item(F_CASE, 2, AccessCertificationCaseType.F_STAGE_NUMBER).replace(400).item(F_CASE, 1, F_WORK_ITEM, 1, F_OUTPUT).replace(new AbstractWorkItemOutputType().outcome(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED).comment("low")).asItemDeltas();
executeAndCheckModification(modifications, result, 1);
checksCountsStandard(result);
}
use of com.evolveum.midpoint.prism.delta.ItemDelta in project midpoint by Evolveum.
the class CertificationTest method test330ReplaceWorkItemsExistingId.
@Test
public void test330ReplaceWorkItemsExistingId() throws Exception {
OperationResult result = new OperationResult("test330ReplaceWorkItemsExistingId");
AccessCertificationWorkItemType wi200 = new AccessCertificationWorkItemType(prismContext);
//dangerous
wi200.setId(200L);
wi200.setStageNumber(44);
wi200.assigneeRef(createObjectRef("999999", ObjectTypes.USER));
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, 6, F_WORK_ITEM).replace(wi200).asItemDeltas();
executeAndCheckModification(modifications, result, 0);
checkCasesForCampaign(campaign1Oid, 9, result);
checkCasesTotal(9, result);
checkWorkItemsForCampaign(campaign1Oid, 8, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, SECOND_NEW_CASE_ID, 1, result);
checkWorkItemsTotal(8, result);
}
use of com.evolveum.midpoint.prism.delta.ItemDelta in project midpoint by Evolveum.
the class LookupTableTest method test210ModifyRowProperties.
@Test
public void test210ModifyRowProperties() throws Exception {
OperationResult result = new OperationResult("test210ModifyRowProperties");
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(LookupTableType.class, prismContext).item(F_ROW, 1, F_KEY).replace("key 1").item(F_ROW, 2, F_VALUE).replace().item(F_ROW, 3, F_LABEL).replace(new PolyString("label 3")).item(F_ROW, 3, F_LAST_CHANGE_TIMESTAMP).replace(XmlTypeConverter.createXMLGregorianCalendar(new Date(99, 10, 10))).asItemDeltas();
executeAndCheckModification(modifications, result, 0, Arrays.asList("key 1", "2 key"));
}
Aggregations