Search in sources :

Example 11 with AccessCertificationWorkItemType

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);
}
Also used : ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) AccessCertificationWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType)

Example 12 with AccessCertificationWorkItemType

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);
}
Also used : ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) AccessCertificationWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType)

Example 13 with AccessCertificationWorkItemType

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);
}
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 14 with AccessCertificationWorkItemType

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);
}
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) AccessCertificationWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType) Test(org.testng.annotations.Test)

Example 15 with AccessCertificationWorkItemType

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);
}
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) AccessCertificationWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType) Test(org.testng.annotations.Test)

Aggregations

AccessCertificationWorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType)15 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)10 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)9 AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)8 Test (org.testng.annotations.Test)7 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)6 AccessCertificationService (com.evolveum.midpoint.model.api.AccessCertificationService)3 Task (com.evolveum.midpoint.task.api.Task)3 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 RestartResponseException (org.apache.wicket.RestartResponseException)2 DummyResource (com.evolveum.icf.dummy.resource.DummyResource)1 OutcomeUtils (com.evolveum.midpoint.certification.api.OutcomeUtils)1 com.evolveum.midpoint.certification.impl (com.evolveum.midpoint.certification.impl)1 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)1 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)1