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());
}
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);
}
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);
}
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);
}
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);
}
Aggregations