Fixing testsuite for mongo
This commit is contained in:
parent
9a5f42039d
commit
bd0887d18e
2 changed files with 11 additions and 0 deletions
|
@ -70,6 +70,9 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||||
|
|
||||||
MongoUserSessionEntity userSessionEntity = entities.get(0);
|
MongoUserSessionEntity userSessionEntity = entities.get(0);
|
||||||
List<MongoClientSessionEntity> sessions = userSessionEntity.getClientSessions();
|
List<MongoClientSessionEntity> sessions = userSessionEntity.getClientSessions();
|
||||||
|
if (sessions == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
for (MongoClientSessionEntity s : sessions) {
|
for (MongoClientSessionEntity s : sessions) {
|
||||||
if (s.getId().equals(id)) {
|
if (s.getId().equals(id)) {
|
||||||
return new ClientSessionAdapter(session, this, realm, s, userSessionEntity, invocationContext);
|
return new ClientSessionAdapter(session, this, realm, s, userSessionEntity, invocationContext);
|
||||||
|
@ -240,6 +243,10 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||||
.get();
|
.get();
|
||||||
List<MongoUserSessionEntity> userSessionEntities = mongoStore.loadEntities(MongoUserSessionEntity.class, query, invocationContext);
|
List<MongoUserSessionEntity> userSessionEntities = mongoStore.loadEntities(MongoUserSessionEntity.class, query, invocationContext);
|
||||||
for (MongoUserSessionEntity e : userSessionEntities) {
|
for (MongoUserSessionEntity e : userSessionEntities) {
|
||||||
|
if (e.getClientSessions() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
List<MongoClientSessionEntity> remove = new LinkedList<MongoClientSessionEntity>();
|
List<MongoClientSessionEntity> remove = new LinkedList<MongoClientSessionEntity>();
|
||||||
for (MongoClientSessionEntity c : e.getClientSessions()) {
|
for (MongoClientSessionEntity c : e.getClientSessions()) {
|
||||||
if (c.getClientId().equals(client.getId())) {
|
if (c.getClientId().equals(client.getId())) {
|
||||||
|
|
|
@ -131,6 +131,10 @@ public class UserSessionAdapter extends AbstractMongoAdapter<MongoUserSessionEnt
|
||||||
@Override
|
@Override
|
||||||
public List<ClientSessionModel> getClientSessions() {
|
public List<ClientSessionModel> getClientSessions() {
|
||||||
List<ClientSessionModel> sessions = new LinkedList<ClientSessionModel>();
|
List<ClientSessionModel> sessions = new LinkedList<ClientSessionModel>();
|
||||||
|
if (entity.getClientSessions() == null) {
|
||||||
|
return sessions;
|
||||||
|
}
|
||||||
|
|
||||||
for (MongoClientSessionEntity e : entity.getClientSessions()) {
|
for (MongoClientSessionEntity e : entity.getClientSessions()) {
|
||||||
sessions.add(new ClientSessionAdapter(keycloakSession, provider, realm, e, entity, invocationContext));
|
sessions.add(new ClientSessionAdapter(keycloakSession, provider, realm, e, entity, invocationContext));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue