Merge pull request #2004 from stianst/master

KEYCLOAK-2288
This commit is contained in:
Stian Thorgersen 2016-01-11 17:32:38 +01:00
commit 747c0f9869
6 changed files with 6 additions and 18 deletions

View file

@ -44,7 +44,7 @@ public abstract class Update {
o.append(f, 1);
}
col.ensureIndex(o, new BasicDBObject("unique", unique).append("sparse", sparse));
col.createIndex(o, new BasicDBObject("unique", unique).append("sparse", sparse));
log.debugv("Created index {0}, fields={1}, unique={2}, sparse={3}", name, Arrays.toString(fields), unique, sparse);
}

View file

@ -18,7 +18,7 @@ public class Update1_0_0_Final extends Update {
@Override
public void update(KeycloakSession session) throws ClassNotFoundException {
DBCollection realmsCollection = db.getCollection("realms");
realmsCollection.ensureIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true));
realmsCollection.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true));
DefaultMongoUpdaterProvider.log.debugv("Created collection {0}", "realms");

View file

@ -174,7 +174,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
operationalInfo.put("mongoHosts", hosts);
operationalInfo.put("mongoDatabaseName", dbName);
operationalInfo.put("mongoUser", uri.getUsername());
operationalInfo.put("mongoDriverVersion", client.getVersion());
logger.debugv("Initialized mongo model. host(s): %s, db: %s", uri.getHosts(), dbName);
return client;
@ -198,7 +197,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
operationalInfo.put("mongoServerAddress", client.getAddress().toString());
operationalInfo.put("mongoDatabaseName", dbName);
operationalInfo.put("mongoUser", user);
operationalInfo.put("mongoDriverVersion", client.getVersion());
logger.debugv("Initialized mongo model. host: %s, port: %d, db: %s", host, port, dbName);
return client;
@ -214,9 +212,6 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
checkIntOption("socketTimeout", builder);
checkBooleanOption("socketKeepAlive", builder);
checkBooleanOption("autoConnectRetry", builder);
if (config.getLong("maxAutoConnectRetryTime") != null) {
builder.maxAutoConnectRetryTime(config.getLong("maxAutoConnectRetryTime"));
}
if(config.getBoolean("ssl", false)) {
builder.socketFactory(SSLSocketFactory.getDefault());
}

View file

@ -1,13 +1,6 @@
package org.keycloak.connections.mongo.impl;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoException;
import com.mongodb.WriteResult;
import com.mongodb.*;
import org.jboss.logging.Logger;
import org.keycloak.connections.mongo.api.MongoCollection;
import org.keycloak.connections.mongo.api.MongoEntity;
@ -133,7 +126,7 @@ public class MongoStoreImpl implements MongoStore {
}
public static ModelException convertException(MongoException e) {
if (e instanceof MongoException.DuplicateKey) {
if (e instanceof DuplicateKeyException) {
return new ModelDuplicateException(e);
} else {
return new ModelException(e);

View file

@ -35,7 +35,7 @@
<keycloak.apache.httpcomponents.version>4.2.1</keycloak.apache.httpcomponents.version>
<undertow.version>1.1.1.Final</undertow.version>
<picketlink.version>2.7.0.Final</picketlink.version>
<mongo.driver.version>2.11.3</mongo.driver.version>
<mongo.driver.version>3.2.0</mongo.driver.version>
<jboss.logging.version>3.1.4.GA</jboss.logging.version>
<syslog4j.version>0.9.30</syslog4j.version>
<jboss-logging-tools.version>1.2.0.Beta1</jboss-logging-tools.version>

View file

@ -16,8 +16,8 @@ import org.w3c.dom.Document;
import javax.ws.rs.core.Response;
import java.util.List;
import static com.mongodb.util.MyAsserts.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.auth.page.AuthRealm.SAMLSERVLETDEMO;
import static org.keycloak.testsuite.util.IOUtil.*;