Skip to content

Commit

Permalink
Fix certification reports
Browse files Browse the repository at this point in the history
Related to MID-8665.
  • Loading branch information
mederly committed Mar 28, 2023
1 parent 9f902ce commit 0d552a7
Show file tree
Hide file tree
Showing 13 changed files with 907 additions and 386 deletions.
5 changes: 5 additions & 0 deletions model/certification-impl/pom.xml
Expand Up @@ -245,6 +245,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
Expand Down
Expand Up @@ -6,6 +6,8 @@
*/
package com.evolveum.midpoint.certification.test;

import static com.evolveum.midpoint.model.test.CommonInitialObjects.*;

import static java.util.Collections.singletonList;
import static org.testng.AssertJUnit.*;

Expand All @@ -15,6 +17,7 @@

import java.io.File;
import java.io.FileNotFoundException;
import java.time.Year;
import java.util.*;
import java.util.stream.Collectors;
import javax.xml.datatype.XMLGregorianCalendar;
Expand Down Expand Up @@ -103,6 +106,54 @@ public class AbstractCertificationTest extends AbstractUninitializedCertificatio
protected static final File TASK_TRIGGER_SCANNER_FILE = new File(COMMON_DIR, "task-trigger-scanner-manual.xml");
protected static final String TASK_TRIGGER_SCANNER_OID = "00000000-0000-0000-0000-000000000007";

// report columns: certification definitions
static final int C_DEF_NAME = 0;
static final int C_DEF_OWNER = 1;
static final int C_DEF_CAMPAIGNS = 2;
static final int C_DEF_OPEN_CAMPAIGNS = 3;
static final int C_DEF_LAST_STARTED = 4;
static final int C_DEF_LAST_CLOSED = 5;

// report columns: certification campaigns
static final int C_CMP_NAME = 0;
static final int C_CMP_OWNER = 1;
static final int C_CMP_START = 2;
static final int C_CMP_FINISH = 3;
static final int C_CMP_CASES = 4;
static final int C_CMP_STATE = 5;
static final int C_CMP_ACTUAL_STAGE = 6;
static final int C_CMP_STAGE_CASES = 7;
static final int C_CMP_PERCENT_COMPLETE = 8;

// report columns: certification cases
static final int C_CASES_OBJECT = 0;
static final int C_CASES_TARGET = 1;
static final int C_CASES_CAMPAIGN = 2;
static final int C_CASES_REVIEWERS = 3;
static final int C_CASES_LAST_REVIEWED_ON = 4;
static final int C_CASES_REVIEWED_BY = 5;
static final int C_CASES_ITERATION = 6;
static final int C_CASES_IN_STAGE = 7;
static final int C_CASES_OUTCOME = 8;
static final int C_CASES_COMMENTS = 9;
static final int C_CASES_REMEDIED_ON = 10;

// report columns: certification decisions (work items)
static final int C_WI_OBJECT = 0;
static final int C_WI_TARGET = 1;
static final int C_WI_CAMPAIGN = 2;
static final int C_WI_ITERATION = 3;
static final int C_WI_STAGE_NUMBER = 4;
static final int C_WI_ORIGINAL_ASSIGNEE = 5;
static final int C_WI_DEADLINE = 6;
static final int C_WI_CURRENT_ASSIGNEES = 7;
static final int C_WI_ESCALATION = 8;
static final int C_WI_PERFORMER = 9;
static final int C_WI_OUTCOME = 10;
static final int C_WI_COMMENT = 11;
static final int C_WI_LAST_CHANGED = 12;
static final int C_WI_CLOSED = 13;

protected DummyResource dummyResource;
protected DummyResourceContoller dummyResourceCtl;
protected ResourceType resourceDummyType;
Expand Down Expand Up @@ -192,6 +243,15 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
recomputeFocus(RoleType.class, ROLE_REVIEWER_OID, initTask, initResult);
recomputeFocus(RoleType.class, ROLE_EROOT_USER_ASSIGNMENT_CAMPAIGN_OWNER_OID, initTask, initResult);
recomputeFocus(OrgType.class, ORG_SECURITY_TEAM_OID, initTask, initResult);

initTestObjects(initTask, initResult,
OBJECT_COLLECTION_CERTIFICATION_CAMPAIGNS_ALL,
ARCHETYPE_REPORT,
ARCHETYPE_COLLECTION_REPORT,
REPORT_CERTIFICATION_DEFINITIONS,
REPORT_CERTIFICATION_CAMPAIGNS,
REPORT_CERTIFICATION_CASES,
REPORT_CERTIFICATION_WORK_ITEMS);
}

@NotNull
Expand Down Expand Up @@ -732,4 +792,8 @@ protected void assertCertificationMetadata(MetadataType metadata, String expecte
protected SearchResultList<PrismObject<AccessCertificationCampaignType>> getAllCampaigns(OperationResult result) throws SchemaException {
return repositoryService.searchObjects(AccessCertificationCampaignType.class, null, null, result);
}

int currentYear() {
return Year.now().getValue();
}
}

0 comments on commit 0d552a7

Please sign in to comment.