Added configurable sleep time

This commit is contained in:
Pavel Drozd 2015-09-22 15:29:21 +02:00
parent 2865a3c047
commit d4c5349e1a
3 changed files with 16 additions and 7 deletions

View file

@ -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<String, String> 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;
}
}

View file

@ -56,7 +56,6 @@ public class SyncProvidersTest {
Map<String,String> 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());
}
}

View file

@ -57,4 +57,8 @@ public class LDAPRule extends ExternalResource {
public Map<String, String> getConfig() {
return ldapTestConfiguration.getLDAPConfig();
}
public int getSleepTime() {
return ldapTestConfiguration.getSleepTime();
}
}