diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/LDAPTestConfiguration.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/LDAPTestConfiguration.java index 31b8d2b804..6e433f2197 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/LDAPTestConfiguration.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/LDAPTestConfiguration.java @@ -20,6 +20,7 @@ public class LDAPTestConfiguration { private static final Logger log = Logger.getLogger(LDAPTestConfiguration.class); private String connectionPropertiesLocation; + private int sleepTime; private boolean startEmbeddedLdapLerver = true; private Map config; @@ -109,6 +110,7 @@ public class LDAPTestConfiguration { } startEmbeddedLdapLerver = Boolean.parseBoolean(p.getProperty("idm.test.ldap.start.embedded.ldap.server", "true")); + sleepTime = Integer.parseInt(p.getProperty("idm.test.ldap.sleepTime", "1000")); log.info("Start embedded server: " + startEmbeddedLdapLerver); log.info("Read config: " + config); } @@ -125,4 +127,8 @@ public class LDAPTestConfiguration { return startEmbeddedLdapLerver; } + public int getSleepTime() { + return sleepTime; + } + } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/SyncProvidersTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/SyncProvidersTest.java index f946825437..819ee41712 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/SyncProvidersTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/federation/SyncProvidersTest.java @@ -56,7 +56,6 @@ public class SyncProvidersTest { Map ldapConfig = ldapRule.getConfig(); ldapConfig.put(LDAPConstants.SYNC_REGISTRATIONS, "false"); ldapConfig.put(LDAPConstants.EDIT_MODE, UserFederationProvider.EditMode.WRITABLE.toString()); - ldapModel = appRealm.addUserFederationProvider(LDAPFederationProviderFactory.PROVIDER_NAME, ldapConfig, 0, "test-ldap", -1, -1, 0); @@ -91,7 +90,7 @@ public class SyncProvidersTest { UsersSyncManager usersSyncManager = new UsersSyncManager(); // wait a bit - sleep(1000); + sleep(ldapRule.getSleepTime()); KeycloakSession session = keycloakRule.startSession(); try { @@ -125,7 +124,7 @@ public class SyncProvidersTest { } // wait a bit - sleep(1000); + sleep(ldapRule.getSleepTime()); // Add user to LDAP and update 'user5' in LDAP LDAPFederationProvider ldapFedProvider = FederationTestUtils.getLdapProvider(session, ldapModel); @@ -391,9 +390,9 @@ public class SyncProvidersTest { } private void assertSyncEquals(UserFederationSyncResult syncResult, int expectedAdded, int expectedUpdated, int expectedRemoved, int expectedFailed) { - Assert.assertEquals(syncResult.getAdded(), expectedAdded); - Assert.assertEquals(syncResult.getUpdated(), expectedUpdated); - Assert.assertEquals(syncResult.getRemoved(), expectedRemoved); - Assert.assertEquals(syncResult.getFailed(), expectedFailed); + Assert.assertEquals(expectedAdded, syncResult.getAdded()); + Assert.assertEquals(expectedUpdated, syncResult.getUpdated()); + Assert.assertEquals(expectedRemoved, syncResult.getRemoved()); + Assert.assertEquals(expectedFailed, syncResult.getFailed()); } } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/LDAPRule.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/LDAPRule.java index add9708380..438938f046 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/LDAPRule.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/LDAPRule.java @@ -57,4 +57,8 @@ public class LDAPRule extends ExternalResource { public Map getConfig() { return ldapTestConfiguration.getLDAPConfig(); } + + public int getSleepTime() { + return ldapTestConfiguration.getSleepTime(); + } }