diff --git a/server/src/test/java/org/cloudfoundry/identity/uaa/resources/jdbc/SimpleSearchQueryConverterTests.java b/server/src/test/java/org/cloudfoundry/identity/uaa/resources/jdbc/SimpleSearchQueryConverterTests.java index 59497461c6b..934b83ea53d 100644 --- a/server/src/test/java/org/cloudfoundry/identity/uaa/resources/jdbc/SimpleSearchQueryConverterTests.java +++ b/server/src/test/java/org/cloudfoundry/identity/uaa/resources/jdbc/SimpleSearchQueryConverterTests.java @@ -1,5 +1,6 @@ package org.cloudfoundry.identity.uaa.resources.jdbc; +import org.cloudfoundry.identity.uaa.resources.JoinAttributeNameMapper; import org.cloudfoundry.identity.uaa.test.ModelTestUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -9,6 +10,7 @@ import java.util.Arrays; import java.util.List; +import java.util.Map; import static org.cloudfoundry.identity.uaa.util.AssertThrowsWithMessage.assertThrowsWithMessageThat; import static org.hamcrest.MatcherAssert.assertThat; @@ -94,4 +96,20 @@ void invalidOperator(final String operator) { () -> converter.getFilterValues(query, validAttributes), is("[" + operator + "] operator is not supported.")); } -} \ No newline at end of file + + @Test + void testJoinFilterAttributes() { + String query = "origin eq \"origin-value\" and id eq \"group-value\""; + List validAttributes = Arrays.asList("origin", "id".toLowerCase()); + JoinAttributeNameMapper joinAttributeNameMapper = new JoinAttributeNameMapper("prefix"); + converter.setAttributeNameMapper(joinAttributeNameMapper); + Map filterValues = converter.getFilterValues(query, validAttributes); + assertNotNull(filterValues); + assertEquals("[origin-value]", filterValues.get("origin").toString()); + assertEquals("[group-value]", filterValues.get("id").toString()); + assertEquals("prefix.origin", converter.map("origin")); + assertEquals("prefix.id", converter.map("id")); + assertEquals("prefix", converter.getCustomPrefix()); + assertEquals("origin", joinAttributeNameMapper.mapFromInternal("prefix.origin")); + } +}