use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationTest method addUnansweredActiveCases.
private void addUnansweredActiveCases(List<AccessCertificationCaseType> expectedCases, List<AccessCertificationCaseType> caseList, AccessCertificationCampaignType campaign) {
for (AccessCertificationCaseType aCase : caseList) {
if (aCase.getStageNumber() != campaign.getStageNumber()) {
continue;
}
if (campaign.getState() != IN_REVIEW_STAGE) {
continue;
}
boolean emptyDecisionFound = false;
for (AccessCertificationWorkItemType workItem : aCase.getWorkItem()) {
if (WorkItemTypeUtil.getOutcome(workItem) == null) {
emptyDecisionFound = true;
break;
}
}
if (emptyDecisionFound) {
LOGGER.info("Expecting case of {}:{}", campaign.getOid(), aCase.getId());
expectedCases.add(aCase);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationTest method checkCasesForCampaign.
private void checkCasesForCampaign(String oid, Integer expected, OperationResult result) throws SchemaException, ObjectNotFoundException {
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext).ownerId(oid).build();
List<AccessCertificationCaseType> cases = repositoryService.searchContainers(AccessCertificationCaseType.class, query, null, result);
assertCasesFound(expected, cases, " for " + oid);
for (AccessCertificationCaseType aCase : cases) {
PrismObject<AccessCertificationCampaignType> campaign = getOwningCampaignChecked(aCase);
AssertJUnit.assertEquals("wrong parent OID", oid, campaign.getOid());
}
AccessCertificationCampaignType campaign = getFullCampaign(oid, result).asObjectable();
PrismAsserts.assertEqualsCollectionUnordered("list of cases is different", cases, campaign.getCase().toArray(new AccessCertificationCaseType[0]));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType 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.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationTest method test720AllCases.
@Test
public void test720AllCases() throws Exception {
OperationResult result = new OperationResult("test720AllCases");
List<AccessCertificationCaseType> cases = repositoryService.searchContainers(AccessCertificationCaseType.class, null, null, result);
AccessCertificationCampaignType campaign1 = getFullCampaign(campaign1Oid, result).asObjectable();
AccessCertificationCampaignType campaign2 = getFullCampaign(campaign2Oid, result).asObjectable();
List<AccessCertificationCaseType> expectedCases = new ArrayList<>();
expectedCases.addAll(campaign1.getCase());
expectedCases.addAll(campaign2.getCase());
PrismAsserts.assertEqualsCollectionUnordered("list of cases is different", cases, expectedCases.toArray(new AccessCertificationCaseType[0]));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class RAccessCertificationCampaign method toJAXB.
@Override
public AccessCertificationCampaignType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
AccessCertificationCampaignType object = new AccessCertificationCampaignType();
RUtil.revive(object, prismContext);
RAccessCertificationCampaign.copyToJAXB(this, object, prismContext, options);
return object;
}
Aggregations