use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class TestAdHocCertification method test020ModifyIndigo.
@Test
public void test020ModifyIndigo() throws Exception {
final String TEST_NAME = "test020ModifyIndigo";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestAdHocCertification.class.getName() + "." + TEST_NAME);
task.setOwner(userAdministrator.asPrismObject());
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
@SuppressWarnings({ "unchecked", "raw" }) ObjectDelta<UserType> delta = (ObjectDelta<UserType>) DeltaBuilder.deltaFor(UserType.class, prismContext).item(UserType.F_DESCRIPTION).replace("new description").item(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS).replace(ActivationStatusType.DISABLED).asObjectDelta(USER_INDIGO_OID);
executeChanges(delta, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
SearchResultList<PrismObject<AccessCertificationCampaignType>> campaigns = repositoryService.searchObjects(AccessCertificationCampaignType.class, null, null, result);
assertEquals("Wrong # of campaigns", 2, campaigns.size());
AccessCertificationCampaignType campaign = campaigns.stream().filter(c -> MODIFICATION_CERT_DEF_OID.equals(c.asObjectable().getDefinitionRef().getOid())).findFirst().orElseThrow(() -> new AssertionError("No modification-triggered campaign")).asObjectable();
campaign = getCampaignWithCases(campaign.getOid());
display("campaign", campaign);
// beware, maybe not all details would match (in the future) - then adapt this test
assertAfterCampaignStart(campaign, modificationCertificationDefinition, 1);
// no cases, no problems
assertPercentComplete(campaign, 0, 0, 0);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class TestCriticalRolesCertification method test200OpenSecondStage.
@Test
public void test200OpenSecondStage() throws Exception {
final String TEST_NAME = "test200OpenSecondStage";
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.openNextStage(campaignOid, 2, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
display("campaign in stage 2", campaign);
assertAfterStageOpen(campaign, certificationDefinition, 2);
List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
assertEquals("Wrong number of certification cases", 6, caseList.size());
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);
AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
/*
Stage2: allMustAccept, default: accept, advance on: accept (target owner)
Case Stage1 Stage2
=============================================================
elaine->CEO none (A) -> A elaine
guybrush->COO cheese: A -> A admin
administrator->COO none (A) -> A admin
administrator->CEO none (A) -> A elaine
jack->CEO none (A) -> A elaine
jack->CTO none (A) -> A none (A) -> A
*/
assertCaseReviewers(elaineCeoCase, NO_RESPONSE, 2, Collections.singletonList(USER_ELAINE_OID));
assertCaseReviewers(guybrushCooCase, NO_RESPONSE, 2, Collections.singletonList(USER_ADMINISTRATOR_OID));
assertCaseReviewers(administratorCooCase, NO_RESPONSE, 2, Collections.singletonList(USER_ADMINISTRATOR_OID));
assertCaseReviewers(administratorCeoCase, NO_RESPONSE, 2, Collections.singletonList(USER_ELAINE_OID));
assertCaseReviewers(jackCeoCase, NO_RESPONSE, 2, Collections.singletonList(USER_ELAINE_OID));
assertCaseReviewers(jackCtoCase, ACCEPT, 2, Collections.emptyList());
assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, NO_RESPONSE, NO_RESPONSE, null);
assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, NO_RESPONSE, NO_RESPONSE, 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, ACCEPT, ACCEPT, null);
assertPercentComplete(campaignOid, 17, 17, 0);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class TestCriticalRolesCertification method test390CloseThirdStage.
@Test
public void test390CloseThirdStage() throws Exception {
final String TEST_NAME = "test390CloseThirdStage";
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, 3, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
display("campaign after closing stage 3", campaign);
assertAfterStageClose(campaign, certificationDefinition, 3);
List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
assertEquals("wrong # of cases", 6, caseList.size());
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);
AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
/*
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
*/
assertCaseHistoricOutcomes(elaineCeoCase, ACCEPT, ACCEPT, NOT_DECIDED);
assertCaseHistoricOutcomes(guybrushCooCase, ACCEPT, REVOKE);
assertCaseHistoricOutcomes(administratorCooCase, ACCEPT, ACCEPT, ACCEPT);
assertCaseHistoricOutcomes(administratorCeoCase, ACCEPT, ACCEPT, NO_RESPONSE);
assertCaseHistoricOutcomes(jackCeoCase, ACCEPT, NO_RESPONSE);
assertCaseHistoricOutcomes(jackCtoCase, ACCEPT, ACCEPT, NO_RESPONSE);
assertPercentComplete(campaignOid, 33, 33, 25);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class TestCriticalRolesCertification method test430RecordDecisionsFourthStage.
@Test
public void test430RecordDecisionsFourthStage() throws Exception {
final String TEST_NAME = "test430RecordDecisionsFourthStage";
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);
/*
Stage4: allMustAccept
Overall: allMustAccept
Case Stage1 Stage2 Stage3 Stage4
===============================================================================================================================================
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 cheese:A -> A | A
administrator->CEO none (A) -> A elaine: A -> A | A elaine:NR,administrator:NR -> NR | NR cheese:A -> A | 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 cheese:NR -> NR | NR
*/
AccessCertificationCaseType elaineCeoCase;
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, administratorCooCase, ACCEPT, null, USER_CHEESE_OID, task, result);
recordDecision(campaignOid, administratorCeoCase, ACCEPT, null, USER_CHEESE_OID, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
display("campaign in stage 4", 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);
/*
Stage4: allMustAccept
Overall: allMustAccept
Case Stage1 Stage2 Stage3 Stage4
===============================================================================================================================================
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 cheese:A -> A | A
administrator->CEO none (A) -> A elaine: A -> A | A elaine:NR,administrator:NR -> NR | NR cheese:A -> A | 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 cheese:NR -> NR | NR
*/
assertWorkItems(elaineCeoCase, 3);
assertWorkItems(guybrushCooCase, 2);
assertWorkItems(administratorCooCase, 4);
assertWorkItems(administratorCeoCase, 4);
assertWorkItems(jackCeoCase, 1);
assertWorkItems(jackCtoCase, 3);
assertNoDecision(elaineCeoCase, 4, NOT_DECIDED, false);
assertNoDecision(guybrushCooCase, 4, REVOKE, false);
assertReviewerDecision(administratorCooCase, ACCEPT, null, 4, USER_CHEESE_OID, ACCEPT, false);
assertReviewerDecision(administratorCeoCase, ACCEPT, null, 4, USER_CHEESE_OID, ACCEPT, false);
assertNoDecision(jackCeoCase, 4, NO_RESPONSE, false);
assertNoDecision(jackCtoCase, 4, NO_RESPONSE, false);
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, ACCEPT, 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, 83, 33, 67);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class TestCriticalRolesCertification method test300OpenThirdStage.
@Test
public void test300OpenThirdStage() throws Exception {
final String TEST_NAME = "test300OpenThirdStage";
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.openNextStage(campaignOid, 3, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
display("campaign in stage 3", campaign);
assertAfterStageOpen(campaign, certificationDefinition, 3);
List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
assertEquals("Wrong number of certification cases", 6, caseList.size());
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);
AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
/*
Stage3: oneDenyDenies, stop on: not decided
Overall: allMustAccept
owners: CEO: elaine, COO: administrator, CTO: none
Case Stage1 Stage2 Stage3
=====================================================================================================
elaine->CEO none (A) -> A elaine A -> A | A elaine,administrator
guybrush->COO cheese: A -> A admin: RV -> RV [STOP] | RV
administrator->COO none (A) -> A admin: A -> A | A elaine,administrator
administrator->CEO none (A) -> A elaine: A -> A | A elaine,administrator
jack->CEO none (A) -> A elaine: null -> NR [STOP] | NR
jack->CTO none (A) -> A none (A) -> A | A elaine,administrator
*/
assertCaseReviewers(elaineCeoCase, NO_RESPONSE, 3, Arrays.asList(USER_ELAINE_OID, USER_ADMINISTRATOR_OID));
assertCaseReviewers(guybrushCooCase, REVOKE, 2, Collections.singletonList(USER_ADMINISTRATOR_OID));
assertCaseReviewers(administratorCooCase, NO_RESPONSE, 3, Arrays.asList(USER_ELAINE_OID, USER_ADMINISTRATOR_OID));
assertCaseReviewers(administratorCeoCase, NO_RESPONSE, 3, Arrays.asList(USER_ELAINE_OID, USER_ADMINISTRATOR_OID));
assertCaseReviewers(jackCeoCase, NO_RESPONSE, 2, Collections.singletonList(USER_ELAINE_OID));
assertCaseReviewers(jackCtoCase, NO_RESPONSE, 3, Arrays.asList(USER_ELAINE_OID, USER_ADMINISTRATOR_OID));
assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, REVOKE, REVOKE, null);
assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, NO_RESPONSE, NO_RESPONSE, 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, 17, 0);
}
Aggregations