Search in sources :

Example 1 with ReportTO

use of org.apache.syncope.common.lib.to.ReportTO in project syncope by apache.

the class ReportITCase method issueSYNCOPE43.

@Test
public void issueSYNCOPE43() {
    ReportTO reportTO = new ReportTO();
    reportTO.setName("issueSYNCOPE43" + getUUIDString());
    reportTO.setActive(true);
    reportTO.setTemplate("sample");
    reportTO = createReport(reportTO);
    assertNotNull(reportTO);
    ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
    assertNotNull(execution);
    int maxit = 50;
    do {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
        reportTO = reportService.read(reportTO.getKey());
        maxit--;
    } while (reportTO.getExecutions().isEmpty() && maxit > 0);
    assertEquals(1, reportTO.getExecutions().size());
}
Also used : ExecTO(org.apache.syncope.common.lib.to.ExecTO) ExecuteQuery(org.apache.syncope.common.rest.api.beans.ExecuteQuery) ReportTO(org.apache.syncope.common.lib.to.ReportTO) Test(org.junit.jupiter.api.Test)

Example 2 with ReportTO

use of org.apache.syncope.common.lib.to.ReportTO in project syncope by apache.

the class ReportITCase method issueSYNCOPE102.

@Test
public void issueSYNCOPE102() throws IOException {
    // Create
    ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
    reportTO.setKey(null);
    reportTO.setName("issueSYNCOPE102" + getUUIDString());
    reportTO = createReport(reportTO);
    assertNotNull(reportTO);
    // Execute (multiple requests)
    for (int i = 0; i < 10; i++) {
        ExecTO execution = reportService.execute(new ExecuteQuery.Builder().key(reportTO.getKey()).build());
        assertNotNull(execution);
    }
    // Wait for one execution
    int maxit = 50;
    do {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
        reportTO = reportService.read(reportTO.getKey());
        maxit--;
    } while (reportTO.getExecutions().isEmpty() && maxit > 0);
    assertFalse(reportTO.getExecutions().isEmpty());
}
Also used : ExecTO(org.apache.syncope.common.lib.to.ExecTO) ExecuteQuery(org.apache.syncope.common.rest.api.beans.ExecuteQuery) ReportTO(org.apache.syncope.common.lib.to.ReportTO) Test(org.junit.jupiter.api.Test)

Example 3 with ReportTO

use of org.apache.syncope.common.lib.to.ReportTO in project syncope by apache.

the class ReportITCase method executeAndExport.

@Test
public void executeAndExport() throws IOException {
    ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
    reportTO.setKey(null);
    reportTO.setName("executeAndExport" + getUUIDString());
    reportTO.setActive(false);
    reportTO.getExecutions().clear();
    reportTO = createReport(reportTO);
    assertNotNull(reportTO);
    try {
        execReport(reportTO.getKey());
        fail("This should not happen");
    } catch (SyncopeClientException e) {
        assertEquals(ClientExceptionType.Scheduling, e.getType());
        assertTrue(e.getElements().iterator().next().contains("active"));
    }
    reportTO.setActive(true);
    reportService.update(reportTO);
    String execKey = execReport(reportTO.getKey());
    checkExport(execKey, ReportExecExportFormat.XML);
    checkExport(execKey, ReportExecExportFormat.HTML);
    checkExport(execKey, ReportExecExportFormat.PDF);
    checkExport(execKey, ReportExecExportFormat.RTF);
    checkExport(execKey, ReportExecExportFormat.CSV);
}
Also used : SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) ReportTO(org.apache.syncope.common.lib.to.ReportTO) Test(org.junit.jupiter.api.Test)

Example 4 with ReportTO

use of org.apache.syncope.common.lib.to.ReportTO in project syncope by apache.

the class Reports method buildTabList.

private List<ITab> buildTabList() {
    final List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(new ResourceModel("reports")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            final MultilevelPanel mlp = new MultilevelPanel(panelId);
            mlp.setFirstLevel(new ReportDirectoryPanel(mlp, getPageReference()) {

                private static final long serialVersionUID = -2195387360323687302L;

                @Override
                protected void viewTask(final ReportTO reportTO, final AjaxRequestTarget target) {
                    mlp.next(new StringResourceModel("report.view", this, new Model<>(reportTO)).getObject(), new ReportExecutionDetails(reportTO, getPageReference()), target);
                }
            });
            return mlp;
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("report.templates")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new ReportTemplateDirectoryPanel(panelId, getPageReference());
        }
    });
    return tabs;
}
Also used : ReportDirectoryPanel(org.apache.syncope.client.console.reports.ReportDirectoryPanel) ArrayList(java.util.ArrayList) ReportTO(org.apache.syncope.common.lib.to.ReportTO) ReportExecutionDetails(org.apache.syncope.client.console.reports.ReportExecutionDetails) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ReportDirectoryPanel(org.apache.syncope.client.console.reports.ReportDirectoryPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) Panel(org.apache.wicket.markup.html.panel.Panel) MultilevelPanel(org.apache.syncope.client.console.panels.MultilevelPanel) ReportTemplateDirectoryPanel(org.apache.syncope.client.console.reports.ReportTemplateDirectoryPanel) MultilevelPanel(org.apache.syncope.client.console.panels.MultilevelPanel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) StringResourceModel(org.apache.wicket.model.StringResourceModel) ResourceModel(org.apache.wicket.model.ResourceModel) ReportTemplateDirectoryPanel(org.apache.syncope.client.console.reports.ReportTemplateDirectoryPanel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 5 with ReportTO

use of org.apache.syncope.common.lib.to.ReportTO in project syncope by apache.

the class ReportServiceImpl method create.

@Override
public Response create(final ReportTO reportTO) {
    ReportTO createdReportTO = logic.create(reportTO);
    URI location = uriInfo.getAbsolutePathBuilder().path(createdReportTO.getKey()).build();
    return Response.created(location).header(RESTHeaders.RESOURCE_KEY, createdReportTO.getKey()).build();
}
Also used : ReportTO(org.apache.syncope.common.lib.to.ReportTO) URI(java.net.URI)

Aggregations

ReportTO (org.apache.syncope.common.lib.to.ReportTO)16 Test (org.junit.jupiter.api.Test)9 ImplementationTO (org.apache.syncope.common.lib.to.ImplementationTO)5 Response (javax.ws.rs.core.Response)4 UserReportletConf (org.apache.syncope.common.lib.report.UserReportletConf)3 ExecTO (org.apache.syncope.common.lib.to.ExecTO)3 ExecuteQuery (org.apache.syncope.common.rest.api.beans.ExecuteQuery)3 ArrayList (java.util.ArrayList)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 StringResourceModel (org.apache.wicket.model.StringResourceModel)2 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)1 URI (java.net.URI)1 Date (java.util.Date)1 MultilevelPanel (org.apache.syncope.client.console.panels.MultilevelPanel)1 ReportDirectoryPanel (org.apache.syncope.client.console.reports.ReportDirectoryPanel)1 ReportExecutionDetails (org.apache.syncope.client.console.reports.ReportExecutionDetails)1 ReportTemplateDirectoryPanel (org.apache.syncope.client.console.reports.ReportTemplateDirectoryPanel)1 JobActionPanel (org.apache.syncope.client.console.widgets.JobActionPanel)1 LoggerTO (org.apache.syncope.common.lib.log.LoggerTO)1 AuditReportletConf (org.apache.syncope.common.lib.report.AuditReportletConf)1