use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType in project midpoint by Evolveum.
the class CertificationTest method checkWorkItemsForCampaign.
private void checkWorkItemsForCampaign(String oid, Integer expected, OperationResult result) throws SchemaException, ObjectNotFoundException {
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationWorkItemType.class, prismContext).exists(T_PARENT).block().ownerId(oid).endBlock().build();
List<AccessCertificationWorkItemType> workItems = repositoryService.searchContainers(AccessCertificationWorkItemType.class, query, null, result);
assertWorkItemsCount(expected, workItems, " for " + oid);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType in project midpoint by Evolveum.
the class CertificationTest method checkWorkItemsForCampaignAndCase.
private void checkWorkItemsForCampaignAndCase(String oid, long caseId, Integer expected, OperationResult result) throws SchemaException, ObjectNotFoundException {
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationWorkItemType.class, prismContext).exists(T_PARENT).block().ownerId(oid).and().id(caseId).endBlock().build();
List<AccessCertificationWorkItemType> workItems = repositoryService.searchContainers(AccessCertificationWorkItemType.class, query, null, result);
assertWorkItemsCount(expected, workItems, " for " + oid + ":" + caseId);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType in project midpoint by Evolveum.
the class CertificationTest method test260AddWorkItem.
@Test
public void test260AddWorkItem() throws Exception {
OperationResult result = new OperationResult("test260AddWorkItem");
AccessCertificationWorkItemType workItem = new AccessCertificationWorkItemType(prismContext).beginOriginalAssigneeRef().oid("orig1").type(UserType.COMPLEX_TYPE).<AccessCertificationWorkItemType>end().beginAssigneeRef().oid("rev1").type(UserType.COMPLEX_TYPE).<AccessCertificationWorkItemType>end().beginAssigneeRef().oid("rev2").type(UserType.COMPLEX_TYPE).end();
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, NEW_CASE_ID, F_WORK_ITEM).add(workItem).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.xml.ns._public.common.common_3.AccessCertificationWorkItemType in project midpoint by Evolveum.
the class CertificationTest method test280DeleteWorkItem.
@Test
public void test280DeleteWorkItem() throws Exception {
OperationResult result = new OperationResult("test280DeleteWorkItem");
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);
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, NEW_CASE_ID, F_WORK_ITEM).delete(workItem.clone()).asItemDeltas();
// WHEN
executeAndCheckModification(modifications, result, 0);
// THEN
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.xml.ns._public.common.common_3.AccessCertificationWorkItemType in project midpoint by Evolveum.
the class CertificationTest method test350ReplaceCase.
@Test
public void test350ReplaceCase() throws Exception {
OperationResult result = new OperationResult("test350ReplaceCase");
// explicit ID is dangerous
AccessCertificationWorkItemType wi777 = new AccessCertificationWorkItemType(prismContext);
wi777.setId(777L);
wi777.setStageNumber(888);
wi777.assigneeRef(createObjectRef("999", ObjectTypes.USER));
AccessCertificationWorkItemType wiNoId = new AccessCertificationWorkItemType(prismContext);
wiNoId.setStageNumber(889);
wiNoId.assigneeRef(createObjectRef("9999", ObjectTypes.USER));
AccessCertificationCaseType caseNoId = new AccessCertificationCaseType(prismContext).objectRef(createObjectRef("aaa", ObjectTypes.USER)).targetRef(createObjectRef("bbb", ObjectTypes.ROLE)).beginWorkItem().assigneeRef(createObjectRef("ccc", ObjectTypes.USER)).<AccessCertificationCaseType>end().workItem(wi777).workItem(wiNoId).stageNumber(1);
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE).replace(caseNoId).asItemDeltas();
executeAndCheckModification(modifications, result, 0);
checkCasesForCampaign(campaign1Oid, 1, result);
checkCasesTotal(1, result);
checkWorkItemsForCampaign(campaign1Oid, 3, result);
checkWorkItemsTotal(3, result);
}
Aggregations