Search in sources :

Example 1 with AccessCertificationCasesStatisticsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType 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 2 with AccessCertificationCasesStatisticsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test220StatisticsAllStages.

@Test
public void test220StatisticsAllStages() throws Exception {
    final String TEST_NAME = "test220StatisticsAllStages";
    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(0, stat.getMarkedAsRevoke());
    assertEquals(0, stat.getMarkedAsRevokeAndRemedied());
    assertEquals(0, stat.getMarkedAsReduce());
    assertEquals(0, stat.getMarkedAsReduceAndRemedied());
    assertEquals(0, stat.getMarkedAsNotDecide());
    assertEquals(5, 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 3 with AccessCertificationCasesStatisticsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType in project midpoint by Evolveum.

the class PageCertCampaign method loadStatistics.

private AccessCertificationCasesStatisticsType loadStatistics() {
    // todo
    OperationResult result = new OperationResult("dummy");
    AccessCertificationCasesStatisticsType stat = null;
    try {
        // todo
        Task task = createSimpleTask("dummy");
        stat = getCertificationService().getCampaignStatistics(campaignOid, false, task, result);
        result.recordSuccessIfUnknown();
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get campaign statistics", ex);
        result.recordFatalError("Couldn't get campaign statistics.", ex);
    }
    result.recomputeStatus();
    if (!WebComponentUtil.isSuccessOrHandledError(result)) {
        showResult(result);
    }
    return stat;
}
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)

Example 4 with AccessCertificationCasesStatisticsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType in project midpoint by Evolveum.

the class CertHelper method appendStatistics.

public void appendStatistics(StringBuilder sb, AccessCertificationCampaignType campaign, Task task, OperationResult result) {
    AccessCertificationCasesStatisticsType stat;
    try {
        stat = certificationManager.getCampaignStatistics(campaign.getOid(), false, task, result);
    } catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ObjectAlreadyExistsException | RuntimeException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get campaign statistics", e);
        sb.append("Couldn't get campaign statistics because of ").append(e);
        return;
    }
    int all = stat.getMarkedAsAccept() + stat.getMarkedAsRevoke() + stat.getMarkedAsReduce() + stat.getMarkedAsNotDecide() + stat.getWithoutResponse();
    sb.append("Number of cases:\t").append(all);
    sb.append("\nMarked as ACCEPT:\t").append(stat.getMarkedAsAccept());
    sb.append("\nMarked as REVOKE:\t").append(stat.getMarkedAsRevoke()).append(" (remedied: ").append(stat.getMarkedAsRevokeAndRemedied()).append(")");
    sb.append("\nMarked as REDUCE:\t").append(stat.getMarkedAsReduce()).append(" (remedied: ").append(stat.getMarkedAsReduceAndRemedied()).append(")");
    sb.append("\nMarked as NOT DECIDED:\t").append(stat.getMarkedAsNotDecide());
    sb.append("\nNo response:\t\t").append(stat.getWithoutResponse());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) AccessCertificationCasesStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)

Example 5 with AccessCertificationCasesStatisticsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType in project midpoint by Evolveum.

the class TestCriticalRolesCertification method test260Statistics.

@Test
public void test260Statistics() throws Exception {
    final String TEST_NAME = "test260Statistics";
    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, true, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    display("statistics", stat.asPrismContainerValue());
    assertEquals(4, stat.getMarkedAsAccept());
    assertEquals(1, stat.getMarkedAsRevoke());
    assertEquals(0, stat.getMarkedAsRevokeAndRemedied());
    assertEquals(0, stat.getMarkedAsReduce());
    assertEquals(0, stat.getMarkedAsReduceAndRemedied());
    assertEquals(0, stat.getMarkedAsNotDecide());
    assertEquals(1, 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)

Aggregations

AccessCertificationCasesStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCasesStatisticsType)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 Test (org.testng.annotations.Test)3 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)1