Merge pull request #321 from stianst/master

Fix testsuite for mongo
This commit is contained in:
Stian Thorgersen 2014-04-07 13:38:01 +01:00
commit 6081572179
2 changed files with 21 additions and 6 deletions

View file

@ -56,8 +56,10 @@ public class MongoAuditProvider implements AuditProvider {
e.put("error", o.getError());
BasicDBObject details = new BasicDBObject();
for (Map.Entry<String, String> entry : o.getDetails().entrySet()) {
details.put(entry.getKey(), entry.getValue());
if (o.getDetails() != null) {
for (Map.Entry<String, String> entry : o.getDetails().entrySet()) {
details.put(entry.getKey(), entry.getValue());
}
}
e.put("details", details);
@ -75,12 +77,14 @@ public class MongoAuditProvider implements AuditProvider {
e.setError(o.getString("error"));
BasicDBObject d = (BasicDBObject) o.get("details");
Map<String, String> details = new HashMap<String, String>();
for (Object k : d.keySet()) {
details.put((String) k, d.getString((String) k));
if (d != null) {
Map<String, String> details = new HashMap<String, String>();
for (Object k : d.keySet()) {
details.put((String) k, d.getString((String) k));
}
e.setDetails(details);
}
e.setDetails(details);
return e;
}

View file

@ -302,6 +302,11 @@
<artifactId>keycloak-model-mongo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-audit-mongo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
@ -425,6 +430,12 @@
<keycloak.mongo.host>${keycloak.mongo.host}</keycloak.mongo.host>
<keycloak.mongo.port>${keycloak.mongo.port}</keycloak.mongo.port>
<keycloak.mongo.db>${keycloak.mongo.db}</keycloak.mongo.db>
<keycloak.audit>mongo</keycloak.audit>
<keycloak.audit.host>${keycloak.mongo.host}</keycloak.audit.host>
<keycloak.audit.port>${keycloak.mongo.port}</keycloak.audit.port>
<keycloak.audit.db>${keycloak.mongo.db}</keycloak.audit.db>
<keycloak.mongo.clearOnStartup>${keycloak.mongo.clearOnStartup}</keycloak.mongo.clearOnStartup>
</systemPropertyVariables>
</configuration>