Search in sources :

Example 96 with OperationResult

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());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 97 with OperationResult

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());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 98 with OperationResult

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 99 with OperationResult

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());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 100 with OperationResult

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) 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