Skip to content

Commit

Permalink
Merge pull request #172 from openstandia/MID-8005
Browse files Browse the repository at this point in the history
MID-8005 Fixed "stringIgnoreCase" matching rule without namespace does not work
  • Loading branch information
virgo47 committed Jul 6, 2022
2 parents d22b79e + ec8acff commit e798315
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 @@ -6,11 +6,10 @@
*/
package com.evolveum.midpoint.repo.sqale.func;

import static com.evolveum.midpoint.prism.PrismConstants.*;
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.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 @@ -208,6 +207,7 @@ public void initObjects() throws Exception {
.modifyTimestamp(asXMLGregorianCalendar(2L)))
.subtype("workerA")
.subtype("workerC")
.employeeNumber("user1")
.policySituation("situationA")
.policySituation("situationC")
.activation(new ActivationType()
Expand Down Expand Up @@ -2639,5 +2639,15 @@ public void test990SearchResourceByAdministrativeOperationalStateAdministrativeA
.eq(AdministrativeAvailabilityStatusType.MAINTENANCE));
// nothing found, but the query is OK :-)
}

@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 e798315

Please sign in to comment.