diff --git a/model/report-impl/src/test/java/com/evolveum/midpoint/report/BasicNewReportTest.java b/model/report-impl/src/test/java/com/evolveum/midpoint/report/BasicNewReportTest.java index a77edad95f3..49f52af8b7b 100644 --- a/model/report-impl/src/test/java/com/evolveum/midpoint/report/BasicNewReportTest.java +++ b/model/report-impl/src/test/java/com/evolveum/midpoint/report/BasicNewReportTest.java @@ -53,19 +53,24 @@ public abstract class BasicNewReportTest extends AbstractReportIntegrationTest { public static final File COLLECTION_TASK_WITH_VIEW_FILE = new File(COMMON_DIR, "object-collection-all-task-with-view.xml"); public static final File COLLECTION_USER_WITH_VIEW_FILE = new File(COMMON_DIR, "object-collection-all-user-with-view.xml"); public static final File COLLECTION_AUDIT_WITH_VIEW_FILE = new File(COMMON_DIR, "object-collection-all-audit-records-with-view.xml"); + public static final File COLLECTION_AUDIT_EMPTY_FILE = new File(COMMON_DIR, "object-collection-audit-empty.xml"); + public static final File COLLECTION_EMPTY_FILE = new File(COMMON_DIR, "object-collection-empty.xml"); public static final File COLLECTION_ASSIGNMENT_HOLDER_WITH_VIEW_FILE = new File(COMMON_DIR, "object-collection-all-assignment-holder-with-view.xml"); public static final File COLLECTION_SHADOW_WITH_VIEW_FILE = new File(COMMON_DIR, "object-collection-shadow-of-resource-with-view.xml"); public static final File DASHBOARD_TRIPLE_VIEW_FILE = new File(COMMON_DIR, "dashboard-with-triple-view.xml"); + public static final File DASHBOARD_EMPTY_FILE = new File(COMMON_DIR, "dashboard-empty.xml"); public static final File COLLECTION_BASIC = new File(COMMON_DIR, "object-collection-basic-filter.xml"); public static final File REPORT_DASHBOARD_WITH_DEFAULT_COLUMN_FILE = new File(TEST_REPORTS_DIR, "report-dashboard-with-default-column.xml"); public static final File REPORT_DASHBOARD_WITH_VIEW_FILE = new File(TEST_REPORTS_DIR, "report-dashboard-with-view.xml"); public static final File REPORT_DASHBOARD_WITH_TRIPLE_VIEW_FILE = new File(TEST_REPORTS_DIR, "report-dashboard-with-triple-view.xml"); + public static final File REPORT_DASHBOARD_EMPTY_FILE = new File(TEST_REPORTS_DIR, "report-dashboard-empty.xml"); public static final File REPORT_AUDIT_COLLECTION_WITH_DEFAULT_COLUMN_FILE = new File(TEST_REPORTS_DIR, "report-audit-collection-with-default-column.xml"); public static final File REPORT_AUDIT_COLLECTION_WITH_VIEW_FILE = new File(TEST_REPORTS_DIR, "report-audit-collection-with-view.xml"); public static final File REPORT_AUDIT_COLLECTION_WITH_DOUBLE_VIEW_FILE = new File(TEST_REPORTS_DIR, "report-audit-collection-with-double-view.xml"); public static final File REPORT_AUDIT_COLLECTION_WITH_CONDITION_FILE = new File(TEST_REPORTS_DIR, "report-audit-collection-with-condition.xml"); + public static final File REPORT_AUDIT_COLLECTION_EMPTY_FILE = new File(TEST_REPORTS_DIR, "report-audit-collection-empty.xml"); public static final File REPORT_OBJECT_COLLECTION_WITH_DEFAULT_COLUMN_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-with-default-column.xml"); public static final File REPORT_OBJECT_COLLECTION_WITH_VIEW_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-with-view.xml"); @@ -73,16 +78,19 @@ public abstract class BasicNewReportTest extends AbstractReportIntegrationTest { public static final File REPORT_OBJECT_COLLECTION_WITH_FILTER_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-with-filter.xml"); public static final File REPORT_OBJECT_COLLECTION_WITH_FILTER_AND_BASIC_COLLECTION_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-with-filter-and-basic-collection.xml"); public static final File REPORT_OBJECT_COLLECTION_WITH_CONDITION_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-with-condition.xml"); + public static final File REPORT_OBJECT_COLLECTION_EMPTY_FILE = new File(TEST_REPORTS_DIR, "report-object-collection-empty.xml"); public static final File REPORT_WITH_IMPORT_SCRIPT = new File(TEST_REPORTS_DIR, "report-with-import-script.xml"); public static final String REPORT_DASHBOARD_WITH_DEFAULT_COLUMN_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a8582"; public static final String REPORT_DASHBOARD_WITH_VIEW_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a8533"; public static final String REPORT_DASHBOARD_WITH_TRIPLE_VIEW_OID = "2b87aa2e-dd86-4842-bcf5-76200a9a8533"; + public static final String REPORT_DASHBOARD_EMPTY_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a8eq2"; public static final String REPORT_AUDIT_COLLECTION_WITH_DEFAULT_COLUMN_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85bc"; public static final String REPORT_AUDIT_COLLECTION_WITH_VIEW_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85cd"; public static final String REPORT_AUDIT_COLLECTION_WITH_DOUBLE_VIEW_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85fg"; public static final String REPORT_AUDIT_COLLECTION_WITH_CONDITION_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85rr"; + public static final String REPORT_AUDIT_COLLECTION_EMPTY_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85qf"; public static final String REPORT_OBJECT_COLLECTION_WITH_DEFAULT_COLUMN_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85ab"; public static final String REPORT_OBJECT_COLLECTION_WITH_VIEW_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85de"; @@ -90,6 +98,7 @@ public abstract class BasicNewReportTest extends AbstractReportIntegrationTest { public static final String REPORT_OBJECT_COLLECTION_WITH_FILTER_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85gh"; public static final String REPORT_OBJECT_COLLECTION_WITH_FILTER_AND_BASIC_COLLECTION_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85hi"; public static final String REPORT_OBJECT_COLLECTION_WITH_CONDITION_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a851a"; + public static final String REPORT_OBJECT_COLLECTION_EMPTY_LIST_OID = "2b44aa2e-dd86-4842-bcf5-762c8a9a85sq"; public static final String REPORT_WITH_IMPORT_SCRIPT_OID = "2b44aa2e-dd86-4842-bcf5-762c8c4a851a"; public static final String RESOURCE_DUMMY_OID = "10000000-0000-0000-0000-000000000004"; @@ -123,13 +132,17 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti importObjectFromFile(COLLECTION_RESOURCE_WITH_VIEW_FILE, initResult); importObjectFromFile(COLLECTION_TASK_WITH_VIEW_FILE, initResult); importObjectFromFile(COLLECTION_AUDIT_WITH_VIEW_FILE, initResult); + importObjectFromFile(COLLECTION_AUDIT_EMPTY_FILE, initResult); importObjectFromFile(COLLECTION_ASSIGNMENT_HOLDER_WITH_VIEW_FILE, initResult); importObjectFromFile(COLLECTION_SHADOW_WITH_VIEW_FILE, initResult); + importObjectFromFile(COLLECTION_EMPTY_FILE, initResult); importObjectFromFile(DASHBOARD_TRIPLE_VIEW_FILE, initResult); + importObjectFromFile(DASHBOARD_EMPTY_FILE, initResult); importObjectFromFile(REPORT_DASHBOARD_WITH_DEFAULT_COLUMN_FILE, initResult); importObjectFromFile(REPORT_DASHBOARD_WITH_VIEW_FILE, initResult); importObjectFromFile(REPORT_DASHBOARD_WITH_TRIPLE_VIEW_FILE, initResult); + importObjectFromFile(REPORT_DASHBOARD_EMPTY_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_DEFAULT_COLUMN_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_VIEW_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_DOUBLE_VIEW_FILE, initResult); @@ -137,9 +150,11 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti importObjectFromFile(REPORT_AUDIT_COLLECTION_WITH_VIEW_FILE, initResult); importObjectFromFile(REPORT_AUDIT_COLLECTION_WITH_DOUBLE_VIEW_FILE, initResult); importObjectFromFile(REPORT_AUDIT_COLLECTION_WITH_CONDITION_FILE, initResult); + importObjectFromFile(REPORT_AUDIT_COLLECTION_EMPTY_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_FILTER_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_FILTER_AND_BASIC_COLLECTION_FILE, initResult); importObjectFromFile(REPORT_OBJECT_COLLECTION_WITH_CONDITION_FILE, initResult); + importObjectFromFile(REPORT_OBJECT_COLLECTION_EMPTY_FILE, initResult); importObjectFromFile(REPORT_WITH_IMPORT_SCRIPT, initResult); } @@ -164,6 +179,13 @@ public void test003CreateDashboardReportWithTripleView() throws Exception { basicCheckOutputFile(report); } + @Test + public void test004CreateDashboardReportEmpty() throws Exception { + PrismObject report = getObject(ReportType.class, REPORT_DASHBOARD_EMPTY_OID); + runReport(report, false); + basicCheckOutputFile(report); + } + @Test public void test101CreateAuditCollectionReportWithDefaultColumn() throws Exception { PrismObject report = getObject(ReportType.class, REPORT_AUDIT_COLLECTION_WITH_DEFAULT_COLUMN_OID); @@ -192,6 +214,13 @@ public void test104CreateAuditCollectionReportWithCondition() throws Exception { basicCheckOutputFile(report); } + @Test + public void test105CreateAuditCollectionReportEmpty() throws Exception { + PrismObject report = getObject(ReportType.class, REPORT_AUDIT_COLLECTION_EMPTY_OID); + runReport(report, false); + basicCheckOutputFile(report); + } + @Test public void test110CreateObjectCollectionReportWithDefaultColumn() throws Exception { PrismObject report = getObject(ReportType.class, REPORT_OBJECT_COLLECTION_WITH_DEFAULT_COLUMN_OID); @@ -234,6 +263,13 @@ public void test115CreateObjectCollectionReportWithCondition() throws Exception basicCheckOutputFile(report); } + @Test + public void test116CreateObjectCollectionEmptyReport() throws Exception { + PrismObject report = getObject(ReportType.class, REPORT_OBJECT_COLLECTION_EMPTY_LIST_OID); + runReport(report, false); + basicCheckOutputFile(report); + } + protected PrismObject runReport(PrismObject report, boolean errorOk) throws Exception { Task task = createTask(OP_CREATE_REPORT); OperationResult result = task.getResult(); diff --git a/model/report-impl/src/test/java/com/evolveum/midpoint/report/TestCsvReport.java b/model/report-impl/src/test/java/com/evolveum/midpoint/report/TestCsvReport.java index 72caeffa968..bb499d60d7b 100644 --- a/model/report-impl/src/test/java/com/evolveum/midpoint/report/TestCsvReport.java +++ b/model/report-impl/src/test/java/com/evolveum/midpoint/report/TestCsvReport.java @@ -70,6 +70,13 @@ public void test003CreateDashboardReportWithTripleView() throws Exception { super.test003CreateDashboardReportWithTripleView(); } + @Override + public void test004CreateDashboardReportEmpty() throws Exception { + expectedColumns = 3; + expectedRow = 3; + super.test004CreateDashboardReportEmpty(); + } + @Override public void test101CreateAuditCollectionReportWithDefaultColumn() throws Exception { expectedColumns = 8; @@ -98,6 +105,13 @@ public void test104CreateAuditCollectionReportWithCondition() throws Exception { super.test104CreateAuditCollectionReportWithCondition(); } + @Override + public void test105CreateAuditCollectionReportEmpty() throws Exception { + expectedColumns = 8; + expectedRow = 1; + super.test105CreateAuditCollectionReportEmpty(); + } + @Override public void test110CreateObjectCollectionReportWithDefaultColumn() throws Exception { expectedColumns = 6; @@ -140,6 +154,13 @@ public void test115CreateObjectCollectionReportWithCondition() throws Exception super.test115CreateObjectCollectionReportWithCondition(); } + @Test + public void test116CreateObjectCollectionEmptyReport() throws Exception { + expectedColumns = 6; + expectedRow = 1; + super.test116CreateObjectCollectionEmptyReport(); + } + @Test public void test200ImportReportForUser() throws Exception { PrismObject report = getObject(ReportType.class, REPORT_IMPORT_OBJECT_COLLECTION_WITH_CONDITION_OID); @@ -242,7 +263,7 @@ public void test202ImportReportWithImportScript() throws Exception { private void setExpectedValueForDashboardReport() { expectedColumns = 3; - expectedRow = 7; + expectedRow = 8; } @Override diff --git a/model/report-impl/src/test/resources/common/dashboard-default-columns.xml b/model/report-impl/src/test/resources/common/dashboard-default-columns.xml index 1c46b2e9b1c..2dc1effb750 100644 --- a/model/report-impl/src/test/resources/common/dashboard-default-columns.xml +++ b/model/report-impl/src/test/resources/common/dashboard-default-columns.xml @@ -170,38 +170,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + shadow-of-resource + + + #00a65a + + fa fa-database + + + + objectCollection + + + + + + + value + + + + + + + + unit + + shadows + + + + all audit diff --git a/model/report-impl/src/test/resources/common/dashboard-empty.xml b/model/report-impl/src/test/resources/common/dashboard-empty.xml new file mode 100644 index 00000000000..bf451684cbb --- /dev/null +++ b/model/report-impl/src/test/resources/common/dashboard-empty.xml @@ -0,0 +1,77 @@ + + + + test-dashboard-empty + + + + + user-all + + + #00a65a + + fa fa-user + + + + objectCollection + + + + + + + value + + + + + + + + unit + + users + + + + + + all audit + + + #00a65a + + fa fa-cog + + + + auditSearch + + + + + + + value + + + + + + + + unit + + records + + + + + diff --git a/model/report-impl/src/test/resources/common/dashboard-with-triple-view.xml b/model/report-impl/src/test/resources/common/dashboard-with-triple-view.xml index 9b6426506bc..c37a24edfca 100644 --- a/model/report-impl/src/test/resources/common/dashboard-with-triple-view.xml +++ b/model/report-impl/src/test/resources/common/dashboard-with-triple-view.xml @@ -215,47 +215,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + shadow-of-resource + + + #00a65a + + fa fa-database + + + + objectCollection + + + + + + + value + + + + + + + + unit + + shadows + + + + + nameColumnDashboard + name + + + + + + + all audit diff --git a/model/report-impl/src/test/resources/common/dashboard-with-view.xml b/model/report-impl/src/test/resources/common/dashboard-with-view.xml index dd01967c9b7..5f3a12364ce 100644 --- a/model/report-impl/src/test/resources/common/dashboard-with-view.xml +++ b/model/report-impl/src/test/resources/common/dashboard-with-view.xml @@ -300,62 +300,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + shadow-of-resource + + + #00a65a + + fa fa-database + + + + objectCollection + + + + + + + value + + + + + + + + unit + + shadows + + + + + nameColumn + name + + + + + + nameColumn2 + name + + + + nameColumn + + + + + + + + + all audit diff --git a/model/report-impl/src/test/resources/common/object-collection-audit-empty.xml b/model/report-impl/src/test/resources/common/object-collection-audit-empty.xml new file mode 100644 index 00000000000..b4b20cdf698 --- /dev/null +++ b/model/report-impl/src/test/resources/common/object-collection-audit-empty.xml @@ -0,0 +1,24 @@ + + + + Audit records empty + AuditEventRecordType + + + + eventStage + execution + + + timestamp + 9999-01-01T00:00:00.000+02:00 + + + + + diff --git a/model/report-impl/src/test/resources/common/object-collection-empty.xml b/model/report-impl/src/test/resources/common/object-collection-empty.xml new file mode 100644 index 00000000000..f3d30007c75 --- /dev/null +++ b/model/report-impl/src/test/resources/common/object-collection-empty.xml @@ -0,0 +1,17 @@ + + + + Empty list + UserType + + + name + testXXXXXXtest00 + + + diff --git a/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource-with-view.xml b/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource-with-view.xml index 79d7c87db0e..a03cca2df45 100644 --- a/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource-with-view.xml +++ b/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource-with-view.xml @@ -30,4 +30,11 @@ nameColumnReport + + + diff --git a/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource.xml b/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource.xml index 027c37d6abe..0869469f1cb 100644 --- a/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource.xml +++ b/model/report-impl/src/test/resources/common/object-collection-shadow-of-resource.xml @@ -20,4 +20,11 @@ + + + diff --git a/model/report-impl/src/test/resources/reports/report-audit-collection-empty.xml b/model/report-impl/src/test/resources/reports/report-audit-collection-empty.xml new file mode 100644 index 00000000000..af2aac4eb80 --- /dev/null +++ b/model/report-impl/src/test/resources/reports/report-audit-collection-empty.xml @@ -0,0 +1,15 @@ + + + + Audit Collection report empty + + + + + + diff --git a/model/report-impl/src/test/resources/reports/report-dashboard-empty.xml b/model/report-impl/src/test/resources/reports/report-dashboard-empty.xml new file mode 100644 index 00000000000..e943ec260c9 --- /dev/null +++ b/model/report-impl/src/test/resources/reports/report-dashboard-empty.xml @@ -0,0 +1,13 @@ + + + + Dashboard report empty + + + + diff --git a/model/report-impl/src/test/resources/reports/report-object-collection-empty.xml b/model/report-impl/src/test/resources/reports/report-object-collection-empty.xml new file mode 100644 index 00000000000..f2ef51193fe --- /dev/null +++ b/model/report-impl/src/test/resources/reports/report-object-collection-empty.xml @@ -0,0 +1,15 @@ + + + + Object Collection report empty + + + + + +