Fix mongo to pass with testsuite

This commit is contained in:
mposolda 2014-10-09 11:37:42 +02:00
parent a00d36eea2
commit 36cc298b32

View file

@ -128,6 +128,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
public List<UserSessionModel> getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults) { public List<UserSessionModel> getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults) {
DBObject query = new QueryBuilder() DBObject query = new QueryBuilder()
.and("clientId").is(client.getId()) .and("clientId").is(client.getId())
.and("sessionId").notEquals(null)
.get(); .get();
DBObject sort = new BasicDBObject("timestamp", 1).append("id", 1); DBObject sort = new BasicDBObject("timestamp", 1).append("id", 1);
@ -142,7 +143,11 @@ public class MongoUserSessionProvider implements UserSessionProvider {
@Override @Override
public int getActiveUserSessions(RealmModel realm, ClientModel client) { public int getActiveUserSessions(RealmModel realm, ClientModel client) {
return getUserSessions(realm, client).size(); DBObject query = new QueryBuilder()
.and("clientId").is(client.getId())
.and("sessionId").notEquals(null)
.get();
return mongoStore.countEntities(MongoClientSessionEntity.class, query, invocationContext);
} }
@Override @Override