Skip to content

Commit

Permalink
MID-8005 Fixed "stringIgnoreCase" matching rule without namespace doe…
Browse files Browse the repository at this point in the history
…s not work

(cherry picked from commit ec8acff)
  • Loading branch information
wadahiro authored and virgo47 committed Jul 6, 2022
1 parent 33e10af commit 4ac85de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import static org.assertj.core.api.Assertions.*;
import static org.testng.Assert.*;

import static com.evolveum.midpoint.prism.PrismConstants.T_OBJECT_REFERENCE;
import static com.evolveum.midpoint.prism.PrismConstants.T_PARENT;
import static com.evolveum.midpoint.prism.PrismConstants.*;
import static com.evolveum.midpoint.prism.xml.XmlTypeConverter.createXMLGregorianCalendar;
import static com.evolveum.midpoint.schema.constants.SchemaConstants.ORG_DEFAULT;
import static com.evolveum.midpoint.util.MiscUtil.asXMLGregorianCalendar;
Expand Down Expand Up @@ -191,6 +190,7 @@ public void initObjects() throws Exception {
.modifyTimestamp(asXMLGregorianCalendar(2L)))
.subtype("workerA")
.subtype("workerC")
.employeeNumber("user1")
.policySituation("situationA")
.policySituation("situationC")
.activation(new ActivationType(prismContext)
Expand Down Expand Up @@ -2383,5 +2383,15 @@ public void test971IsDescendant() throws Exception {
expect("isDescendant returns false for reverse relationship");
assertFalse(repositoryService.isDescendant(org11, org112Oid));
}

@Test(description = "MID-8005")
public void test991SearchObjectWithStringIgnoreCaseWithoutNamespace()
throws SchemaException {
searchUsersTest("with string item matching ignore-case comparison",
f -> f.item(UserType.F_EMPLOYEE_NUMBER).contains("USer1")
// Use QName without namespace
.matching(new QName(STRING_IGNORE_CASE_MATCHING_RULE_NAME.getLocalPart())),
user1Oid);
}
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ protected FilterOperation operation(ValueFilter<?, ?> filter) throws QueryExcept
throw new QueryException("Can't translate filter '" + filter + "' to operation.");
}

private static final String STRING_IGNORE_CASE = STRING_IGNORE_CASE_MATCHING_RULE_NAME.getLocalPart();

protected boolean isIgnoreCaseFilter(ValueFilter<?, ?> filter) {
return filter.getMatchingRule() != null
&& filter.getMatchingRule().equals(STRING_IGNORE_CASE_MATCHING_RULE_NAME);
&& filter.getMatchingRule().getLocalPart().equals(STRING_IGNORE_CASE);
}

@NotNull
Expand Down

0 comments on commit 4ac85de

Please sign in to comment.