From 159694ae234f278973500c0606c84beda15fc244 Mon Sep 17 00:00:00 2001 From: lskublik Date: Fri, 29 May 2020 00:47:15 +0200 Subject: [PATCH] fixes for tests after merging of report branch to master --- .../HeterogenousContainerWrapperFactory.java | 7 ++ .../xml/ns/public/common/common-core-3.xsd | 4 +- .../impl/controller/CollectionProcessor.java | 61 ++++++---- .../impl/security/GuiProfileCompiler.java | 2 +- .../midpoint/report/TestCsvReport.java | 8 +- .../common/dashboard-default-columns.xml | 64 +++++----- .../common/dashboard-with-triple-view.xml | 82 ++++++------- .../resources/common/dashboard-with-view.xml | 112 +++++++++--------- model/report-impl/testng-integration.xml | 1 + 9 files changed, 180 insertions(+), 161 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/wrapper/HeterogenousContainerWrapperFactory.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/wrapper/HeterogenousContainerWrapperFactory.java index 0cc9f965023..ff8b521be54 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/wrapper/HeterogenousContainerWrapperFactory.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/wrapper/HeterogenousContainerWrapperFactory.java @@ -11,6 +11,8 @@ import javax.annotation.PostConstruct; import javax.xml.namespace.QName; +import com.evolveum.midpoint.xml.ns._public.common.common_3.CollectionRefSpecificationType; + import org.springframework.stereotype.Component; import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext; @@ -55,6 +57,11 @@ private boolean filterDefinitins(PrismContainerValue value, ItemDefinition public boolean match(ItemDefinition def) { QName defName = def.getTypeName(); + if (CollectionRefSpecificationType.COMPLEX_TYPE.equals(defName) + && def.getItemName().equivalent(CollectionRefSpecificationType.F_BASE_COLLECTION_REF)) { + return true; + } + if (TaskPartitionsDefinitionType.COMPLEX_TYPE.equals(defName)) { return true; } diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd index 7daa2e65c0a..5d5c04b09de 100755 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd @@ -17151,9 +17151,9 @@ This collection is merge with filter. - true 4.2 - CollectionSpecificationType.collectionRef + CollectionSpecificationType.baseCollectionRef + true diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/CollectionProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/CollectionProcessor.java index 7c428f817de..39f983a2156 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/CollectionProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/CollectionProcessor.java @@ -343,23 +343,27 @@ private void compileObjectCollectionView(CompiledObjectCollectionView existingVi existingView.setFilter(combinedFilter); } - compileView(existingView, objectCollectionType.getDefaultView()); + compileView(existingView, objectCollectionType.getDefaultView(), false); } public void compileView(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + compileView(existingView, objectListViewType, true); + } + + private void compileView(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { if (objectListViewType != null) { compileObjectType(existingView, objectListViewType); compileActions(existingView, objectListViewType); - compileAdditionalPanels(existingView, objectListViewType); + compileAdditionalPanels(existingView, objectListViewType, replaceIfExist); compileColumns(existingView, objectListViewType); - compileDisplay(existingView, objectListViewType); - compileDistinct(existingView, objectListViewType); - compileSorting(existingView, objectListViewType); - compileCounting(existingView, objectListViewType); - compileDisplayOrder(existingView, objectListViewType); - compileSearchBox(existingView, objectListViewType); - compileRefreshInterval(existingView, objectListViewType); + compileDisplay(existingView, objectListViewType, replaceIfExist); + compileDistinct(existingView, objectListViewType, replaceIfExist); + compileSorting(existingView, objectListViewType, replaceIfExist); + compileCounting(existingView, objectListViewType, replaceIfExist); + compileDisplayOrder(existingView, objectListViewType, replaceIfExist); + compileSearchBox(existingView, objectListViewType, replaceIfExist); + compileRefreshInterval(existingView, objectListViewType, replaceIfExist); } } @@ -387,13 +391,15 @@ private void compileActions(CompiledObjectCollectionView existingView, GuiObject } - private void compileAdditionalPanels(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileAdditionalPanels(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { GuiObjectListViewAdditionalPanelsType newAdditionalPanels = objectListViewType.getAdditionalPanels(); if (newAdditionalPanels == null) { return; } // TODO: later: merge additional panel definitions - existingView.setAdditionalPanels(newAdditionalPanels); + if (existingView.getAdditionalPanels() == null || replaceIfExist) { + existingView.setAdditionalPanels(newAdditionalPanels); + } } private void compileColumns(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { @@ -409,60 +415,65 @@ private void compileColumns(CompiledObjectCollectionView existingView, GuiObject existingColumns.addAll(orderedList); } - private void compileDisplay(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileDisplay(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { DisplayType newDisplay = objectListViewType.getDisplay(); if (newDisplay == null) { return; } if (existingView.getDisplay() == null) { existingView.setDisplay(newDisplay); + } else if (replaceIfExist) { + MiscSchemaUtil.mergeDisplay(existingView.getDisplay(), newDisplay); } - MiscSchemaUtil.mergeDisplay(existingView.getDisplay(), newDisplay); } - private void compileDistinct(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileDistinct(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { DistinctSearchOptionType newDistinct = objectListViewType.getDistinct(); if (newDistinct == null) { return; } - existingView.setDistinct(newDistinct); + if (existingView.getDistinct() == null || replaceIfExist) { + existingView.setDistinct(newDistinct); + } } - private void compileSorting(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileSorting(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { Boolean newDisableSorting = objectListViewType.isDisableSorting(); - if (newDisableSorting != null) { + if (newDisableSorting != null && (existingView.getDisableSorting() == null || replaceIfExist)) { existingView.setDisableSorting(newDisableSorting); } } - private void compileRefreshInterval(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileRefreshInterval(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { Integer refreshInterval = objectListViewType.getRefreshInterval(); - if (refreshInterval != null) { + if (refreshInterval != null && (existingView.getRefreshInterval() == null || replaceIfExist)) { existingView.setRefreshInterval(refreshInterval); } } - private void compileCounting(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileCounting(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { Boolean newDisableCounting = objectListViewType.isDisableCounting(); - if (newDisableCounting != null) { + if (newDisableCounting != null && (existingView.isDisableCounting() == null || replaceIfExist)) { existingView.setDisableCounting(newDisableCounting); } } - private void compileDisplayOrder(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType){ + private void compileDisplayOrder(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist){ Integer newDisplayOrder = objectListViewType.getDisplayOrder(); - if (newDisplayOrder != null){ + if (newDisplayOrder != null && (existingView.getDisplayOrder() == null || replaceIfExist)){ existingView.setDisplayOrder(newDisplayOrder); } } - private void compileSearchBox(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType) { + private void compileSearchBox(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, boolean replaceIfExist) { SearchBoxConfigurationType newSearchBoxConfig = objectListViewType.getSearchBoxConfiguration(); if (newSearchBoxConfig == null) { return; } // TODO: merge - existingView.setSearchBoxConfiguration(newSearchBoxConfig); + if (existingView.getSearchBoxConfiguration() == null || replaceIfExist) { + existingView.setSearchBoxConfiguration(newSearchBoxConfig); + } } } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/GuiProfileCompiler.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/GuiProfileCompiler.java index 113ed96848d..353b684f26f 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/GuiProfileCompiler.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/GuiProfileCompiler.java @@ -324,8 +324,8 @@ public void compileView(CompiledObjectCollectionView existingView, GuiObjectList // compileDisplayOrder(existingView, objectListViewType); // compileSearchBox(existingView, objectListViewType); // compileRefreshInterval(existingView, objectListViewType); - compileCollection(existingView, objectListViewType, task, result); collectionProcessor.compileView(existingView, objectListViewType); + compileCollection(existingView, objectListViewType, task, result); } private void compileCollection(CompiledObjectCollectionView existingView, GuiObjectListViewType objectListViewType, Task task, OperationResult result) 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 162d9c8e11a..eaf9abbe842 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 @@ -68,21 +68,21 @@ public void test012CreateObjectCollectionReportWithDoubleView() throws Exception @Override public void test013CreateAuditCollectionReportWithDefaultColumn() throws Exception { expectedColumns = 8; - expectedRow = 47; + expectedRow = 46; super.test013CreateAuditCollectionReportWithDefaultColumn(); } @Override public void test014CreateAuditCollectionReportWithView() throws Exception { expectedColumns = 2; - expectedRow = 49; + expectedRow = 48; super.test014CreateAuditCollectionReportWithView(); } @Override public void test015CreateAuditCollectionReportWithDoubleView() throws Exception { expectedColumns = 3; - expectedRow = 51; + expectedRow = 50; super.test015CreateAuditCollectionReportWithDoubleView(); } @@ -102,7 +102,7 @@ public void test017CreateObjectCollectionReportWithFilterAndBasicCollection() th private void setExpectedValueForDashboardReport() { expectedColumns = 3; - expectedRow = 8; + expectedRow = 7; } @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 2dc1effb750..1c46b2e9b1c 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-with-triple-view.xml b/model/report-impl/src/test/resources/common/dashboard-with-triple-view.xml index c37a24edfca..9b6426506bc 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 3cf9b1c0cfb..91a3a506c7d 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 @@ -290,62 +290,62 @@ - - shadow-of-resource - - - #00a65a - - fa fa-database - - - - objectCollection - - - - - - - value - - - - - - - - unit - - shadows - - - - - nameColumn - name - - - - - - nameColumn2 - name - - - - nameColumn - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all audit diff --git a/model/report-impl/testng-integration.xml b/model/report-impl/testng-integration.xml index 8d4a5a6cd18..8863bbea45a 100644 --- a/model/report-impl/testng-integration.xml +++ b/model/report-impl/testng-integration.xml @@ -13,6 +13,7 @@ +