use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRoleInducementCertification method test110Statistics.
@Test
public void test110Statistics() throws Exception {
final String TEST_NAME = "test110Statistics";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleInducementCertification.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
AccessCertificationCasesStatisticsType stat = certificationManager.getCampaignStatistics(campaignOid, true, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("statistics", stat.asPrismContainerValue());
assertEquals(3, stat.getMarkedAsAccept());
assertEquals(2, stat.getMarkedAsRevoke());
assertEquals(0, stat.getMarkedAsRevokeAndRemedied());
assertEquals(0, stat.getMarkedAsReduce());
assertEquals(0, stat.getMarkedAsReduceAndRemedied());
assertEquals(0, stat.getMarkedAsNotDecide());
assertEquals(0, stat.getWithoutResponse());
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRoleInducementCertification method test160Statistics.
@Test
public void test160Statistics() throws Exception {
final String TEST_NAME = "test160Statistics";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleInducementCertification.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
AccessCertificationCasesStatisticsType stat = certificationManager.getCampaignStatistics(campaignOid, true, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("statistics", stat.asPrismContainerValue());
assertEquals(3, stat.getMarkedAsAccept());
assertEquals(2, stat.getMarkedAsRevoke());
assertEquals(0, stat.getMarkedAsRevokeAndRemedied());
assertEquals(0, stat.getMarkedAsReduce());
assertEquals(0, stat.getMarkedAsReduceAndRemedied());
assertEquals(0, stat.getMarkedAsNotDecide());
assertEquals(0, stat.getWithoutResponse());
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRoleInducementCertification method test150CloseFirstStage.
@Test
public void test150CloseFirstStage() throws Exception {
final String TEST_NAME = "test150CloseFirstStage";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleInducementCertification.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);
checkAllCases(campaign.getCase(), campaignOid);
List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
AccessCertificationCaseType ceoDummyCase = findCase(caseList, ROLE_CEO_OID, RESOURCE_DUMMY_OID);
AccessCertificationCaseType cooDummyCase = findCase(caseList, ROLE_COO_OID, RESOURCE_DUMMY_OID);
AccessCertificationCaseType cooDummyBlackCase = findCase(caseList, ROLE_COO_OID, RESOURCE_DUMMY_BLACK_OID);
AccessCertificationCaseType cooSuperuserCase = findCase(caseList, ROLE_COO_OID, ROLE_SUPERUSER_OID);
AccessCertificationCaseType superuserDummyCase = findCase(caseList, ROLE_SUPERUSER_OID, RESOURCE_DUMMY_OID);
assertSingleDecision(ceoDummyCase, REVOKE, "no way", 1, USER_ELAINE_OID, REVOKE, true);
assertSingleDecision(cooDummyCase, REVOKE, null, 1, USER_ADMINISTRATOR_OID, REVOKE, true);
assertSingleDecision(cooDummyBlackCase, ACCEPT, "OK", 1, USER_ADMINISTRATOR_OID, ACCEPT, true);
assertSingleDecision(cooSuperuserCase, NOT_DECIDED, "I'm so procrastinative...", 1, USER_ADMINISTRATOR_OID, ACCEPT, true);
assertNoDecision(superuserDummyCase, 1, ACCEPT, true);
assertCaseOutcome(caseList, ROLE_CEO_OID, RESOURCE_DUMMY_OID, REVOKE, REVOKE, 1);
assertCaseOutcome(caseList, ROLE_COO_OID, RESOURCE_DUMMY_OID, REVOKE, REVOKE, 1);
assertCaseOutcome(caseList, ROLE_COO_OID, RESOURCE_DUMMY_BLACK_OID, ACCEPT, ACCEPT, 1);
assertCaseOutcome(caseList, ROLE_COO_OID, ROLE_SUPERUSER_OID, ACCEPT, ACCEPT, 1);
assertCaseOutcome(caseList, ROLE_SUPERUSER_OID, RESOURCE_DUMMY_OID, ACCEPT, ACCEPT, 1);
assertPercentComplete(campaign, 100, 100, 100);
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRoleInducementCertification method test030SearchAllCases.
@Test
public void test030SearchAllCases() throws Exception {
final String TEST_NAME = "test030SearchCases";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleInducementCertification.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("caseList", caseList);
checkAllCases(caseList, campaignOid);
AccessCertificationCaseType _case = checkCase(caseList, ROLE_SUPERUSER_OID, RESOURCE_DUMMY_OID, roleSuperuser, campaignOid);
assertEquals("Unexpected number of reviewers in superuser case", 0, CertCampaignTypeUtil.getCurrentReviewers(_case).size());
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRoleInducementCertification method test051SearchDecisionsElaine.
@Test
public void test051SearchDecisionsElaine() throws Exception {
final String TEST_NAME = "test051SearchDecisionsElaine";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
login(userElaine.asPrismObject());
Task task = taskManager.createTaskInstance(TestRoleInducementCertification.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
List<AccessCertificationWorkItemType> workItems = queryHelper.searchOpenWorkItems(null, SecurityUtil.getPrincipal(), false, null, result);
/* Expected cases - phase 1:
CEO-Dummy: elaine
*/
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
display("caseList", workItems);
assertEquals("Wrong number of work items", 1, workItems.size());
checkWorkItem(workItems, ROLE_CEO_OID, RESOURCE_DUMMY_OID, roleCeo, campaignOid);
}
Aggregations