Search in sources :

Example 1 with AuditReportletConf

use of org.apache.syncope.common.lib.report.AuditReportletConf in project syncope by apache.

the class ReportITCase method auditReport.

@Test
public void auditReport() throws IOException {
    AuditLoggerName auditLoggerName = new AuditLoggerName(AuditElements.EventCategoryType.LOGIC, "UserLogic", null, "selfRead", AuditElements.Result.SUCCESS);
    try {
        LoggerTO loggerTO = new LoggerTO();
        loggerTO.setKey(auditLoggerName.toLoggerName());
        loggerTO.setLevel(LoggerLevel.DEBUG);
        loggerService.update(LoggerType.AUDIT, loggerTO);
        ImplementationTO auditReportlet = new ImplementationTO();
        auditReportlet.setKey("UserReportletConf" + getUUIDString());
        auditReportlet.setEngine(ImplementationEngine.JAVA);
        auditReportlet.setType(ImplementationType.REPORTLET);
        auditReportlet.setBody(POJOHelper.serialize(new AuditReportletConf("auditReportlet" + getUUIDString())));
        Response response = implementationService.create(auditReportlet);
        auditReportlet.setKey(response.getHeaderString(RESTHeaders.RESOURCE_KEY));
        ReportTO report = new ReportTO();
        report.setName("auditReport" + getUUIDString());
        report.setActive(true);
        report.getReportlets().add(auditReportlet.getKey());
        report.setTemplate("sample");
        report = createReport(report);
        String execKey = execReport(report.getKey());
        checkExport(execKey, ReportExecExportFormat.XML);
        report = reportService.read(report.getKey());
        assertNotNull(report.getLastExec());
    } finally {
        loggerService.delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
    }
}
Also used : LoggerTO(org.apache.syncope.common.lib.log.LoggerTO) ImplementationTO(org.apache.syncope.common.lib.to.ImplementationTO) Response(javax.ws.rs.core.Response) AuditReportletConf(org.apache.syncope.common.lib.report.AuditReportletConf) ReportTO(org.apache.syncope.common.lib.to.ReportTO) AuditLoggerName(org.apache.syncope.common.lib.types.AuditLoggerName) Test(org.junit.jupiter.api.Test)

Aggregations

Response (javax.ws.rs.core.Response)1 LoggerTO (org.apache.syncope.common.lib.log.LoggerTO)1 AuditReportletConf (org.apache.syncope.common.lib.report.AuditReportletConf)1 ImplementationTO (org.apache.syncope.common.lib.to.ImplementationTO)1 ReportTO (org.apache.syncope.common.lib.to.ReportTO)1 AuditLoggerName (org.apache.syncope.common.lib.types.AuditLoggerName)1 Test (org.junit.jupiter.api.Test)1