This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git
commit b7c73ce4607c776a9fce6fc196cb5ba6529bd9a7 Author: Francesco Chicchiriccò <[email protected]> AuthorDate: Mon Oct 26 11:02:38 2026 +0100 Cleanup --- .../core/persistence/jpa/inner/AttrRepoTest.java | 13 ++++-------- .../core/persistence/jpa/inner/AuthModuleTest.java | 23 +++++++++------------- .../jpa/inner/PasswordManagementTest.java | 20 ++++--------------- .../core/persistence/neo4j/inner/AttrRepoTest.java | 13 ++++-------- .../persistence/neo4j/inner/AuthModuleTest.java | 23 +++++++++------------- .../neo4j/inner/PasswordManagementTest.java | 19 ++++++------------ 6 files changed, 36 insertions(+), 75 deletions(-) diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AttrRepoTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AttrRepoTest.java index 766178f8a9..503852e539 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AttrRepoTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AttrRepoTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.UUID; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.attr.AttrRepoConf; import org.apache.syncope.common.lib.attr.JDBCAttrRepoConf; import org.apache.syncope.common.lib.attr.LDAPAttrRepoConf; @@ -43,10 +42,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class AttrRepoTest extends AbstractTest { - private static boolean isSpecificConf(final AttrRepoConf conf, final Class<? extends AttrRepoConf> clazz) { - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private AttrRepoDAO attrRepoDAO; @@ -78,16 +73,16 @@ public class AttrRepoTest extends AbstractTest { public void findByType() { List<? extends AttrRepo> attrRepos = attrRepoDAO.findAll(); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), LDAPAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof LDAPAttrRepoConf && attrRepo.getKey().equals("DefaultLDAPAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), JDBCAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof JDBCAttrRepoConf && attrRepo.getKey().equals("DefaultJDBCAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), SyncopeAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof SyncopeAttrRepoConf && attrRepo.getKey().equals("DefaultSyncopeAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), StubAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof StubAttrRepoConf && attrRepo.getKey().equals("DefaultStubAttrRepo"))); } diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthModuleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthModuleTest.java index d8a3ea4b65..ad869a8a9e 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthModuleTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthModuleTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.UUID; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.auth.AuthModuleConf; import org.apache.syncope.common.lib.auth.DuoMfaAuthModuleConf; import org.apache.syncope.common.lib.auth.GoogleMfaAuthModuleConf; @@ -49,10 +48,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class AuthModuleTest extends AbstractTest { - private static boolean isSpecificConf(final AuthModuleConf conf, final Class<? extends AuthModuleConf> clazz) { - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private AuthModuleDAO authModuleDAO; @@ -101,31 +96,31 @@ public class AuthModuleTest extends AbstractTest { public void findByType() { List<? extends AuthModule> authModules = authModuleDAO.findAll(); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), LDAPAuthModuleConf.class) + authModule -> authModule.getConf() instanceof LDAPAuthModuleConf && authModule.getKey().equals("DefaultLDAPAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), JDBCAuthModuleConf.class) + authModule -> authModule.getConf() instanceof JDBCAuthModuleConf && authModule.getKey().equals("DefaultJDBCAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), GoogleMfaAuthModuleConf.class) + authModule -> authModule.getConf() instanceof GoogleMfaAuthModuleConf && authModule.getKey().equals("DefaultGoogleMfaAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), DuoMfaAuthModuleConf.class) + authModule -> authModule.getConf() instanceof DuoMfaAuthModuleConf && authModule.getKey().equals("DefaultDuoMfaAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), OIDCAuthModuleConf.class) + authModule -> authModule.getConf() instanceof OIDCAuthModuleConf && authModule.getKey().equals("DefaultOIDCAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), SAML2IdPAuthModuleConf.class) + authModule -> authModule.getConf() instanceof SAML2IdPAuthModuleConf && authModule.getKey().equals("DefaultSAML2IdPAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), JaasAuthModuleConf.class) + authModule -> authModule.getConf() instanceof JaasAuthModuleConf && authModule.getKey().equals("DefaultJaasAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), StaticAuthModuleConf.class) + authModule -> authModule.getConf() instanceof StaticAuthModuleConf && authModule.getKey().equals("DefaultStaticAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), SyncopeAuthModuleConf.class) + authModule -> authModule.getConf() instanceof SyncopeAuthModuleConf && authModule.getKey().equals("DefaultSyncopeAuthModule"))); } diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PasswordManagementTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PasswordManagementTest.java index 967bedac43..51cd4b9052 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PasswordManagementTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PasswordManagementTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.password.JDBCPasswordManagementConf; import org.apache.syncope.common.lib.password.LDAPPasswordManagementConf; import org.apache.syncope.common.lib.password.PasswordManagementConf; @@ -41,13 +40,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class PasswordManagementTest extends AbstractTest { - private static boolean isSpecificConf( - final PasswordManagementConf conf, - final Class<? extends PasswordManagementConf> clazz) { - - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private PasswordManagementDAO passwordManagementDAO; @@ -79,20 +71,16 @@ public class PasswordManagementTest extends AbstractTest { public void findByType() { List<? extends PasswordManagement> passwordManagements = passwordManagementDAO.findAll(); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - SyncopePasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof SyncopePasswordManagementConf && passwordManagement.getKey().equals("DefaultSyncopePasswordManagement"))); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - LDAPPasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof LDAPPasswordManagementConf && passwordManagement.getKey().equals("DefaultLDAPPasswordManagement"))); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - JDBCPasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof JDBCPasswordManagementConf && passwordManagement.getKey().equals("DefaultJDBCPasswordManagement"))); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - RESTPasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof RESTPasswordManagementConf && passwordManagement.getKey().equals("DefaultRESTPasswordManagement"))); } diff --git a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AttrRepoTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AttrRepoTest.java index b10328594c..6b09ddc753 100644 --- a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AttrRepoTest.java +++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AttrRepoTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.UUID; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.attr.AttrRepoConf; import org.apache.syncope.common.lib.attr.JDBCAttrRepoConf; import org.apache.syncope.common.lib.attr.LDAPAttrRepoConf; @@ -43,10 +42,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class AttrRepoTest extends AbstractTest { - private static boolean isSpecificConf(final AttrRepoConf conf, final Class<? extends AttrRepoConf> clazz) { - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private AttrRepoDAO attrRepoDAO; @@ -78,16 +73,16 @@ public class AttrRepoTest extends AbstractTest { public void findByType() { List<? extends AttrRepo> attrRepos = attrRepoDAO.findAll(); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), LDAPAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof LDAPAttrRepoConf && attrRepo.getKey().equals("DefaultLDAPAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), JDBCAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof JDBCAttrRepoConf && attrRepo.getKey().equals("DefaultJDBCAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), SyncopeAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof SyncopeAttrRepoConf && attrRepo.getKey().equals("DefaultSyncopeAttrRepo"))); assertTrue(attrRepos.stream().anyMatch( - attrRepo -> isSpecificConf(attrRepo.getConf(), StubAttrRepoConf.class) + attrRepo -> attrRepo.getConf() instanceof StubAttrRepoConf && attrRepo.getKey().equals("DefaultStubAttrRepo"))); } diff --git a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AuthModuleTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AuthModuleTest.java index 8443eaa69b..c39e014731 100644 --- a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AuthModuleTest.java +++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/AuthModuleTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.UUID; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.auth.AuthModuleConf; import org.apache.syncope.common.lib.auth.DuoMfaAuthModuleConf; import org.apache.syncope.common.lib.auth.GoogleMfaAuthModuleConf; @@ -49,10 +48,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class AuthModuleTest extends AbstractTest { - private static boolean isSpecificConf(final AuthModuleConf conf, final Class<? extends AuthModuleConf> clazz) { - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private AuthModuleDAO authModuleDAO; @@ -101,31 +96,31 @@ public class AuthModuleTest extends AbstractTest { public void findByType() { List<? extends AuthModule> authModules = authModuleDAO.findAll(); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), LDAPAuthModuleConf.class) + authModule -> authModule.getConf() instanceof LDAPAuthModuleConf && authModule.getKey().equals("DefaultLDAPAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), JDBCAuthModuleConf.class) + authModule -> authModule.getConf() instanceof JDBCAuthModuleConf && authModule.getKey().equals("DefaultJDBCAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), GoogleMfaAuthModuleConf.class) + authModule -> authModule.getConf() instanceof GoogleMfaAuthModuleConf && authModule.getKey().equals("DefaultGoogleMfaAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), DuoMfaAuthModuleConf.class) + authModule -> authModule.getConf() instanceof DuoMfaAuthModuleConf && authModule.getKey().equals("DefaultDuoMfaAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), OIDCAuthModuleConf.class) + authModule -> authModule.getConf() instanceof OIDCAuthModuleConf && authModule.getKey().equals("DefaultOIDCAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), SAML2IdPAuthModuleConf.class) + authModule -> authModule.getConf() instanceof SAML2IdPAuthModuleConf && authModule.getKey().equals("DefaultSAML2IdPAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), JaasAuthModuleConf.class) + authModule -> authModule.getConf() instanceof JaasAuthModuleConf && authModule.getKey().equals("DefaultJaasAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), StaticAuthModuleConf.class) + authModule -> authModule.getConf() instanceof StaticAuthModuleConf && authModule.getKey().equals("DefaultStaticAuthModule"))); assertTrue(authModules.stream().anyMatch( - authModule -> isSpecificConf(authModule.getConf(), SyncopeAuthModuleConf.class) + authModule -> authModule.getConf() instanceof SyncopeAuthModuleConf && authModule.getKey().equals("DefaultSyncopeAuthModule"))); } diff --git a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/PasswordManagementTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/PasswordManagementTest.java index ab03275a80..2d3e10848c 100644 --- a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/PasswordManagementTest.java +++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/PasswordManagementTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import org.apache.commons.lang3.ClassUtils; import org.apache.syncope.common.lib.password.JDBCPasswordManagementConf; import org.apache.syncope.common.lib.password.LDAPPasswordManagementConf; import org.apache.syncope.common.lib.password.PasswordManagementConf; @@ -41,13 +40,6 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class PasswordManagementTest extends AbstractTest { - private static boolean isSpecificConf( - final PasswordManagementConf conf, - final Class<? extends PasswordManagementConf> clazz) { - - return ClassUtils.isAssignable(clazz, conf.getClass()); - } - @Autowired private PasswordManagementDAO passwordManagementDAO; @@ -76,16 +68,17 @@ public class PasswordManagementTest extends AbstractTest { public void findByType() { List<? extends PasswordManagement> passwordManagements = passwordManagementDAO.findAll(); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - SyncopePasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof SyncopePasswordManagementConf && passwordManagement.getKey().equals("DefaultSyncopePasswordManagement"))); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), - LDAPPasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof LDAPPasswordManagementConf && passwordManagement.getKey().equals("DefaultLDAPPasswordManagement"))); assertTrue(passwordManagements.stream().anyMatch( - passwordManagement -> isSpecificConf(passwordManagement.getConf(), JDBCPasswordManagementConf.class) + passwordManagement -> passwordManagement.getConf() instanceof JDBCPasswordManagementConf && passwordManagement.getKey().equals("DefaultJDBCPasswordManagement"))); + assertTrue(passwordManagements.stream().anyMatch( + passwordManagement -> passwordManagement.getConf() instanceof RESTPasswordManagementConf + && passwordManagement.getKey().equals("DefaultRESTPasswordManagement"))); } private void savePasswordManagement(final String key, final PasswordManagementConf conf) {
