Merge pull request #1634 from pdrozd/sync-ldap-sleep
Added configurable sleep time
This commit is contained in:
commit
b17bbc9b86
3 changed files with 16 additions and 7 deletions
|
@ -20,6 +20,7 @@ public class LDAPTestConfiguration {
|
||||||
private static final Logger log = Logger.getLogger(LDAPTestConfiguration.class);
|
private static final Logger log = Logger.getLogger(LDAPTestConfiguration.class);
|
||||||
|
|
||||||
private String connectionPropertiesLocation;
|
private String connectionPropertiesLocation;
|
||||||
|
private int sleepTime;
|
||||||
private boolean startEmbeddedLdapLerver = true;
|
private boolean startEmbeddedLdapLerver = true;
|
||||||
private Map<String, String> config;
|
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"));
|
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("Start embedded server: " + startEmbeddedLdapLerver);
|
||||||
log.info("Read config: " + config);
|
log.info("Read config: " + config);
|
||||||
}
|
}
|
||||||
|
@ -125,4 +127,8 @@ public class LDAPTestConfiguration {
|
||||||
return startEmbeddedLdapLerver;
|
return startEmbeddedLdapLerver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSleepTime() {
|
||||||
|
return sleepTime;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class SyncProvidersTest {
|
||||||
Map<String,String> ldapConfig = ldapRule.getConfig();
|
Map<String,String> ldapConfig = ldapRule.getConfig();
|
||||||
ldapConfig.put(LDAPConstants.SYNC_REGISTRATIONS, "false");
|
ldapConfig.put(LDAPConstants.SYNC_REGISTRATIONS, "false");
|
||||||
ldapConfig.put(LDAPConstants.EDIT_MODE, UserFederationProvider.EditMode.WRITABLE.toString());
|
ldapConfig.put(LDAPConstants.EDIT_MODE, UserFederationProvider.EditMode.WRITABLE.toString());
|
||||||
|
|
||||||
ldapModel = appRealm.addUserFederationProvider(LDAPFederationProviderFactory.PROVIDER_NAME, ldapConfig, 0, "test-ldap",
|
ldapModel = appRealm.addUserFederationProvider(LDAPFederationProviderFactory.PROVIDER_NAME, ldapConfig, 0, "test-ldap",
|
||||||
-1, -1, 0);
|
-1, -1, 0);
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ public class SyncProvidersTest {
|
||||||
UsersSyncManager usersSyncManager = new UsersSyncManager();
|
UsersSyncManager usersSyncManager = new UsersSyncManager();
|
||||||
|
|
||||||
// wait a bit
|
// wait a bit
|
||||||
sleep(1000);
|
sleep(ldapRule.getSleepTime());
|
||||||
|
|
||||||
KeycloakSession session = keycloakRule.startSession();
|
KeycloakSession session = keycloakRule.startSession();
|
||||||
try {
|
try {
|
||||||
|
@ -125,7 +124,7 @@ public class SyncProvidersTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait a bit
|
// wait a bit
|
||||||
sleep(1000);
|
sleep(ldapRule.getSleepTime());
|
||||||
|
|
||||||
// Add user to LDAP and update 'user5' in LDAP
|
// Add user to LDAP and update 'user5' in LDAP
|
||||||
LDAPFederationProvider ldapFedProvider = FederationTestUtils.getLdapProvider(session, ldapModel);
|
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) {
|
private void assertSyncEquals(UserFederationSyncResult syncResult, int expectedAdded, int expectedUpdated, int expectedRemoved, int expectedFailed) {
|
||||||
Assert.assertEquals(syncResult.getAdded(), expectedAdded);
|
Assert.assertEquals(expectedAdded, syncResult.getAdded());
|
||||||
Assert.assertEquals(syncResult.getUpdated(), expectedUpdated);
|
Assert.assertEquals(expectedUpdated, syncResult.getUpdated());
|
||||||
Assert.assertEquals(syncResult.getRemoved(), expectedRemoved);
|
Assert.assertEquals(expectedRemoved, syncResult.getRemoved());
|
||||||
Assert.assertEquals(syncResult.getFailed(), expectedFailed);
|
Assert.assertEquals(expectedFailed, syncResult.getFailed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,8 @@ public class LDAPRule extends ExternalResource {
|
||||||
public Map<String, String> getConfig() {
|
public Map<String, String> getConfig() {
|
||||||
return ldapTestConfiguration.getLDAPConfig();
|
return ldapTestConfiguration.getLDAPConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSleepTime() {
|
||||||
|
return ldapTestConfiguration.getSleepTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue