Skip to content
Snippets Groups Projects
Commit d506ae77 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Updated driver version.

parent 2e8d8849
No related branches found
No related tags found
No related merge requests found
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
<dependency> <dependency>
<groupId>org.mongodb</groupId> <groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId> <artifactId>mongo-java-driver</artifactId>
<version>2.13.0</version> <version>3.0.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
......
...@@ -697,13 +697,7 @@ public class StartMongoMojo extends AbstractMongoMojo { ...@@ -697,13 +697,7 @@ public class StartMongoMojo extends AbstractMongoMojo {
throw new MojoExecutionException("Database name is missing"); throw new MojoExecutionException("Database name is missing");
} }
final MongoClient mongoClient; final MongoClient mongoClient = new MongoClient(new ServerAddress("localhost", getPort()));
try {
// mongoClient = new MongoClient(Arrays.asList(new ServerAddress("localhost", getPort())));
mongoClient = new MongoClient(new ServerAddress("localhost", getPort()));
} catch (final UnknownHostException e) {
throw new MojoExecutionException("Unable to connect to mongo instance", e);
}
getLog().info("Connected to MongoDB"); getLog().info("Connected to MongoDB");
return mongoClient.getDB(databaseName); return mongoClient.getDB(databaseName);
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
*/ */
package com.mongodb; package com.mongodb;
import org.bson.BsonDocument;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Set; import java.util.Set;
...@@ -26,44 +28,20 @@ public class EmbedMongoDB extends DB { ...@@ -26,44 +28,20 @@ public class EmbedMongoDB extends DB {
} }
public CommandResult notOkErrorResult(String message) { public CommandResult notOkErrorResult(String message) {
try { CommandResult commandResult = new CommandResult(new BsonDocument(), new ServerAddress("localhost"));
CommandResult commandResult = new CommandResult(new ServerAddress("localhost")); commandResult.put("errmsg", message);
commandResult.put("errmsg", message); commandResult.put("ok", 0);
commandResult.put("ok", 0); return commandResult;
return commandResult;
} catch (UnknownHostException e) {
return null;
}
} }
@Override @Override
public CommandResult doEval(String code, Object... args) { public CommandResult doEval(String code, Object... args) {
CommandResult commandResult; CommandResult commandResult = new CommandResult(new BsonDocument(), new ServerAddress("localhost"));
try { commandResult.put("ok", 1.0);
commandResult = new CommandResult(new ServerAddress("localhost")); commandResult.put("retval", "null");
commandResult.put("ok", 1.0);
commandResult.put("retval", "null");
} catch (UnknownHostException e) {
return notOkErrorResult(e.getMessage());
}
return commandResult; return commandResult;
} }
@Override
public void requestStart() {
}
@Override
public void requestDone() {
}
@Override
public void requestEnsureConnection() {
}
@Override @Override
protected DBCollection doGetCollection(String name) { protected DBCollection doGetCollection(String name) {
return null; return null;
...@@ -73,14 +51,4 @@ public class EmbedMongoDB extends DB { ...@@ -73,14 +51,4 @@ public class EmbedMongoDB extends DB {
public Set<String> getCollectionNames() { public Set<String> getCollectionNames() {
return null; return null;
} }
@Override
CommandResult doAuthenticate(MongoCredential credentials) {
return null;
}
@Override
public void cleanCursors(boolean force) {
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment