From c25e11c57a5802f1cb9e6423766391af76dc2aa2 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Wed, 15 Feb 2023 09:44:44 -0700 Subject: [PATCH] Test DirContextProcessor Runtime Hints Issue gh-721 --- .../aot/hint/LdapCoreRuntimeHintsTests.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/src/test/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHintsTests.java b/core/src/test/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHintsTests.java index 37b9f0dd..63a759f6 100644 --- a/core/src/test/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHintsTests.java +++ b/core/src/test/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHintsTests.java @@ -1,5 +1,9 @@ package org.springframework.ldap.aot.hint; +import javax.naming.ldap.PagedResultsControl; +import javax.naming.ldap.PagedResultsResponseControl; +import javax.naming.ldap.SortControl; +import javax.naming.ldap.SortResponseControl; import javax.net.ssl.SSLSocketFactory; import org.junit.Before; @@ -48,6 +52,30 @@ public class LdapCoreRuntimeHintsTests { .accepts(this.hints); } + @Test + public void pagedResultsControlHasHints() { + assertThat(RuntimeHintsPredicates.reflection().onType(PagedResultsControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.PagedResultsControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(PagedResultsResponseControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.PagedResultsResponseControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + } + + @Test + public void sortControlHasHints() { + assertThat(RuntimeHintsPredicates.reflection().onType(SortControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.SortControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(SortResponseControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + assertThat(RuntimeHintsPredicates.reflection().onType(com.sun.jndi.ldap.ctl.SortResponseControl.class).withMemberCategories( + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)).accepts(this.hints); + } + @Test public void sslSocketFactoryHasHints() throws Exception { assertThat(RuntimeHintsPredicates.reflection().onMethod(SSLSocketFactory.class.getDeclaredMethod("getDefault")))