Search in sources :

Example 91 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test910Statistics.

@Test
public void test910Statistics() throws Exception {
    final String TEST_NAME = "test910Statistics";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    AccessCertificationCasesStatisticsType stat = certificationManager.getCampaignStatistics(campaignOid, false, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    display("statistics", stat.asPrismContainerValue());
    assertEquals(1, stat.getMarkedAsAccept());
    assertEquals(1, stat.getMarkedAsRevoke());
    assertEquals(1, stat.getMarkedAsRevokeAndRemedied());
    assertEquals(0, stat.getMarkedAsReduce());
    assertEquals(0, stat.getMarkedAsReduceAndRemedied());
    assertEquals(1, stat.getMarkedAsNotDecide());
    assertEquals(3, stat.getWithoutResponse());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCasesStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType) Test(org.testng.annotations.Test)

Example 92 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test100RecordDecisions1.

@Test
public void test100RecordDecisions1() throws Exception {
    final String TEST_NAME = "test100RecordDecisions1";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    assertEquals("unexpected # of cases", 6, caseList.size());
    AccessCertificationCaseType guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    recordDecision(campaignOid, guybrushCooCase, ACCEPT, null, USER_CHEESE_OID, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    caseList = queryHelper.searchCases(campaignOid, null, null, result);
    display("caseList", caseList);
    assertEquals("unexpected # of cases", 6, caseList.size());
    guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    assertSingleDecision(guybrushCooCase, ACCEPT, null, 1, USER_CHEESE_OID, ACCEPT, false);
    assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, ACCEPT, ACCEPT, null);
    assertPercentComplete(campaignOid, 100, 100, 100);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 93 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test150CloseFirstStage.

@Test
public void test150CloseFirstStage() throws Exception {
    final String TEST_NAME = "test150CloseFirstStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    task.setOwner(userAdministrator.asPrismObject());
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    certificationManager.closeCurrentStage(campaignOid, 1, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign in stage 1", campaign);
    assertAfterStageClose(campaign, certificationDefinition, 1);
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    assertEquals("unexpected # of cases", 6, caseList.size());
    assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, ACCEPT, ACCEPT, 1);
    assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, ACCEPT, ACCEPT, 1);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, ACCEPT, ACCEPT, 1);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID, ACCEPT, ACCEPT, 1);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CEO_OID, ACCEPT, ACCEPT, 1);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CTO_OID, ACCEPT, ACCEPT, 1);
    assertPercentComplete(campaignOid, 100, 100, 100);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Example 94 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test330RecordDecisionsThirdStage.

@Test
public void test330RecordDecisionsThirdStage() throws Exception {
    final String TEST_NAME = "test330RecordDecisionsThirdStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    /*
Case                        Stage1              Stage2                           Stage3
==================================================================================================================================
elaine->CEO                 none (A) -> A       elaine A -> A             | A    elaine:null,administrator:ND -> ND  [STOP] | ND
guybrush->COO               cheese: A -> A      admin: RV -> RV   [STOP]  | RV
administrator->COO          none (A) -> A       admin: A -> A             | A    elaine:A,administrator:null -> A           | A
administrator->CEO          none (A) -> A       elaine: A -> A            | A    elaine:NR,administrator:NR -> NR           | NR
jack->CEO                   none (A) -> A       elaine: null -> NR [STOP] | NR
jack->CTO                   none (A) -> A       none (A) -> A             | A    elaine:null,administrator:null -> NR       | NR

*/
    AccessCertificationCaseType elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    AccessCertificationCaseType guybrushCooCase;
    AccessCertificationCaseType administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCeoCase;
    AccessCertificationCaseType jackCtoCase;
    recordDecision(campaignOid, elaineCeoCase, NOT_DECIDED, null, USER_ADMINISTRATOR_OID, task, result);
    recordDecision(campaignOid, administratorCooCase, ACCEPT, null, USER_ELAINE_OID, task, result);
    recordDecision(campaignOid, administratorCeoCase, NO_RESPONSE, null, USER_ELAINE_OID, task, result);
    recordDecision(campaignOid, administratorCeoCase, NO_RESPONSE, null, USER_ADMINISTRATOR_OID, task, result);
    // no response for jackCto
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign in stage 3", campaign);
    caseList = queryHelper.searchCases(campaignOid, null, null, result);
    display("caseList", caseList);
    elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
    jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
    assertWorkItems(elaineCeoCase, 3);
    assertWorkItems(guybrushCooCase, 2);
    assertWorkItems(administratorCooCase, 3);
    assertWorkItems(administratorCeoCase, 3);
    assertWorkItems(jackCeoCase, 1);
    assertWorkItems(jackCtoCase, 2);
    assertReviewerDecision(elaineCeoCase, NOT_DECIDED, null, 3, USER_ADMINISTRATOR_OID, NOT_DECIDED, false);
    assertNoDecision(guybrushCooCase, 3, REVOKE, false);
    assertReviewerDecision(administratorCooCase, ACCEPT, null, 3, USER_ELAINE_OID, ACCEPT, false);
    assertReviewerDecision(administratorCooCase, null, null, 3, USER_ADMINISTRATOR_OID, ACCEPT, false);
    assertReviewerDecision(administratorCeoCase, null, null, 3, USER_ELAINE_OID, NO_RESPONSE, false);
    assertReviewerDecision(administratorCeoCase, null, null, 3, USER_ADMINISTRATOR_OID, NO_RESPONSE, false);
    assertNoDecision(jackCeoCase, 3, NO_RESPONSE, false);
    assertReviewerDecision(jackCtoCase, null, null, 3, USER_ELAINE_OID, NO_RESPONSE, false);
    assertReviewerDecision(jackCtoCase, null, null, 3, USER_ADMINISTRATOR_OID, NO_RESPONSE, false);
    /*
Case                        Stage1              Stage2                           Stage3
==================================================================================================================================
elaine->CEO                 none (A) -> A       elaine A -> A             | A    elaine:null,administrator:ND -> ND  [STOP] | ND
guybrush->COO               cheese: A -> A      admin: RV -> RV   [STOP]  | RV
administrator->COO          none (A) -> A       admin: A -> A             | A    elaine:A,administrator:null -> A           | A
administrator->CEO          none (A) -> A       elaine: A -> A            | A    elaine:NR,administrator:NR -> NR           | NR
jack->CEO                   none (A) -> A       elaine: null -> NR [STOP] | NR
jack->CTO                   none (A) -> A       none (A) -> A             | A    elaine:null,administrator:null -> NR       | NR

*/
    assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, NOT_DECIDED, NOT_DECIDED, null);
    assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, REVOKE, REVOKE, null);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, ACCEPT, ACCEPT, null);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CTO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertPercentComplete(campaignOid, 33, 33, 25);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Example 95 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test250RecordDecisionsSecondStage.

@Test
public void test250RecordDecisionsSecondStage() throws Exception {
    final String TEST_NAME = "test250RecordDecisionsSecondStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    /*
Stage2: allMustAccept, default: accept, advance on: accept          (target owner)

Overall: allMustAccept

owners: CEO: elaine, COO: administrator, CTO: none

Case                        Stage1              Stage2
=================================================================================
elaine->CEO                 none (A) -> A       elaine A -> A             | A
guybrush->COO               cheese: A -> A      admin: RV -> RV   [STOP]  | RV
administrator->COO          none (A) -> A       admin: A -> A             | A
administrator->CEO          none (A) -> A       elaine: A -> A            | A
jack->CEO                   none (A) -> A       elaine: null -> NR [STOP] | NR
jack->CTO                   none (A) -> A       none (A) -> A

*/
    AccessCertificationCaseType elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    AccessCertificationCaseType guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    recordDecision(campaignOid, elaineCeoCase, ACCEPT, null, USER_ELAINE_OID, task, result);
    recordDecision(campaignOid, guybrushCooCase, REVOKE, "no", USER_ADMINISTRATOR_OID, task, result);
    recordDecision(campaignOid, administratorCooCase, ACCEPT, "ok", USER_ADMINISTRATOR_OID, task, result);
    recordDecision(campaignOid, administratorCeoCase, ACCEPT, null, USER_ELAINE_OID, task, result);
    // jackCeo: no response
    // jackCto: no reviewers
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign in stage 2", campaign);
    caseList = queryHelper.searchCases(campaignOid, null, null, result);
    display("caseList", caseList);
    elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
    assertWorkItems(elaineCeoCase, 1);
    assertWorkItems(guybrushCooCase, 2);
    assertWorkItems(administratorCooCase, 1);
    assertWorkItems(administratorCeoCase, 1);
    assertWorkItems(jackCeoCase, 1);
    assertWorkItems(jackCtoCase, 0);
    assertSingleDecision(elaineCeoCase, ACCEPT, null, 2, USER_ELAINE_OID, ACCEPT, false);
    assertSingleDecision(guybrushCooCase, REVOKE, "no", 2, USER_ADMINISTRATOR_OID, REVOKE, false);
    assertSingleDecision(administratorCooCase, ACCEPT, "ok", 2, USER_ADMINISTRATOR_OID, ACCEPT, false);
    assertSingleDecision(administratorCeoCase, ACCEPT, null, 2, USER_ELAINE_OID, ACCEPT, false);
    assertNoDecision(jackCeoCase, 2, NO_RESPONSE, false);
    assertNoDecision(jackCtoCase, 2, ACCEPT, false);
    assertPercentComplete(campaignOid, 83, 83, 80);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3475 Test (org.testng.annotations.Test)2435 Task (com.evolveum.midpoint.task.api.Task)2390 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1059 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)725 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)637 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)414 PrismObject (com.evolveum.midpoint.prism.PrismObject)388 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)376 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)320 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)288 ArrayList (java.util.ArrayList)262 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)252 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)250 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)231 QName (javax.xml.namespace.QName)198 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)197 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)182 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)171 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)149