Skip to content

Commit

Permalink
MID-8842 ninja - search item display name processor + test
Browse files Browse the repository at this point in the history
(cherry picked from commit d5fb423)
  • Loading branch information
1azyman committed Aug 1, 2023
1 parent 62d4392 commit 003051f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2010-2023 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.schema.validator.processor;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.validator.UpgradeObjectProcessor;
import com.evolveum.midpoint.schema.validator.UpgradePhase;
import com.evolveum.midpoint.schema.validator.UpgradePriority;
import com.evolveum.midpoint.schema.validator.UpgradeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchItemType;

@SuppressWarnings("unused")
public class SearchItemDisplayNameProcessor implements UpgradeObjectProcessor<ObjectType> {

@Override
public UpgradePhase getPhase() {
return UpgradePhase.AFTER;
}

@Override
public UpgradePriority getPriority() {
return UpgradePriority.NECESSARY;
}

@Override
public UpgradeType getType() {
return UpgradeType.SEAMLESS;
}

@Override
public boolean isApplicable(PrismObject<?> object, ItemPath path) {
return matchParentTypeAndItemName(object, path, SearchItemType.class, SearchItemType.F_DISPLAY_NAME);
}

@Override
public boolean process(PrismObject<ObjectType> object, ItemPath path) throws Exception {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private String getProcessorIdentifier(Class<?> processorClass) {
@Test
public void test30TestSystemConfig() throws Exception {
testUpgradeValidator("system-configuration.xml", result -> {
Assertions.assertThat(result.getItems()).hasSize(7);
Assertions.assertThat(result.getItems()).hasSize(9);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
<objectTypeConfiguration>
<defaultValue>UserType</defaultValue>
</objectTypeConfiguration>
<searchItems>
<searchItem id="7">
<displayName>sample1</displayName>
</searchItem>
</searchItems>
</searchBoxConfiguration>
</objectCollectionView>
<objectCollectionView id="6">
Expand All @@ -81,6 +86,14 @@
<objectTypeConfiguration>
<defaultValue>OrgType</defaultValue>
</objectTypeConfiguration>
<searchItems>
<searchItem id="8">
<displayName>sample2</displayName>
<display>
<label>sample3</label>
</display>
</searchItem>
</searchItems>
</searchBoxConfiguration>
</objectCollectionView>
</objectCollectionViews>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<searchBoxConfiguration>
<defaultScope>oneLevel</defaultScope>
<defaultObjectType>UserType</defaultObjectType>
<searchItems>
<searchItem id="7">
<displayName>sample1</displayName>
</searchItem>
</searchItems>
</searchBoxConfiguration>
</objectCollectionView>
<objectCollectionView id="6">
Expand All @@ -79,6 +84,14 @@
<objectTypeConfiguration>
<defaultValue>OrgType</defaultValue>
</objectTypeConfiguration>
<searchItems>
<searchItem id="8">
<displayName>sample2</displayName>
<display>
<label>sample3</label>
</display>
</searchItem>
</searchItems>
</searchBoxConfiguration>
</objectCollectionView>
</objectCollectionViews>
Expand Down

0 comments on commit 003051f

Please sign in to comment.