Fix failing tests
This commit is contained in:
parent
2f0498bb7f
commit
279a70bcb8
3 changed files with 16 additions and 5 deletions
|
@ -16,7 +16,11 @@ import org.picketlink.idm.IdentityManager;
|
|||
import org.picketlink.idm.PartitionManager;
|
||||
import org.picketlink.idm.model.IdentityType;
|
||||
import org.picketlink.idm.model.basic.User;
|
||||
import org.picketlink.idm.query.AttributeParameter;
|
||||
import org.picketlink.idm.query.Condition;
|
||||
import org.picketlink.idm.query.IdentityQuery;
|
||||
import org.picketlink.idm.query.IdentityQueryBuilder;
|
||||
import org.picketlink.idm.query.QueryParameter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
@ -84,13 +88,15 @@ public class LDAPFederationProviderFactory implements UserFederationProviderFact
|
|||
|
||||
// Sync newly created users
|
||||
IdentityManager identityManager = partitionMgr.createIdentityManager();
|
||||
IdentityQuery<User> userQuery = identityManager.createIdentityQuery(User.class)
|
||||
.setParameter(IdentityType.CREATED_AFTER, lastSync);
|
||||
IdentityQueryBuilder queryBuilder = identityManager.getQueryBuilder();
|
||||
Condition condition = queryBuilder.greaterThanOrEqualTo(IdentityType.CREATED_DATE, lastSync);
|
||||
IdentityQuery<User> userQuery = queryBuilder.createIdentityQuery(User.class).where(condition);
|
||||
syncImpl(sessionFactory, userQuery, realmId, model);
|
||||
|
||||
// Sync updated users
|
||||
userQuery = identityManager.createIdentityQuery(User.class)
|
||||
.setParameter(IdentityType.MODIFIED_AFTER, lastSync);
|
||||
queryBuilder = identityManager.getQueryBuilder();
|
||||
condition = queryBuilder.greaterThanOrEqualTo(LDAPUtils.MODIFY_DATE, lastSync);
|
||||
userQuery = queryBuilder.createIdentityQuery(User.class).where(condition);
|
||||
syncImpl(sessionFactory, userQuery, realmId, model);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import org.picketlink.idm.credential.UsernamePasswordCredentials;
|
|||
import org.picketlink.idm.model.Attribute;
|
||||
import org.picketlink.idm.model.basic.BasicModel;
|
||||
import org.picketlink.idm.model.basic.User;
|
||||
import org.picketlink.idm.query.AttributeParameter;
|
||||
import org.picketlink.idm.query.QueryParameter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,6 +22,8 @@ import java.util.List;
|
|||
*/
|
||||
public class LDAPUtils {
|
||||
|
||||
public static QueryParameter MODIFY_DATE = new AttributeParameter("modifyDate");
|
||||
|
||||
public static User addUser(PartitionManager partitionManager, String username, String firstName, String lastName, String email) {
|
||||
IdentityManager identityManager = getIdentityManager(partitionManager);
|
||||
|
||||
|
|
|
@ -25,8 +25,9 @@ public class LDAPRule extends ExternalResource {
|
|||
protected void after() {
|
||||
try {
|
||||
embeddedServer.tearDown();
|
||||
embeddedServer = null;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error starting Embedded LDAP server.", e);
|
||||
throw new RuntimeException("Error tearDown Embedded LDAP server.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue