Skip to content

Commit

Permalink
update test cases for new mongodb java driver version
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis95 committed Aug 11, 2018
1 parent 74b9d75 commit 58f9169
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ subprojects {
test {
useTestNG()

systemProperty 'mongoServer', 'localhost'
systemProperty 'mongoPort', '27017'
systemProperty 'mongoTestConnection', 'mongodb://127.0.0.1:27017'

//tweaking memory settings for the forked vm that runs tests
jvmArgs '-Xmx1500m'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

public class TestHelper {

public static final String MONGO_SERVER_PROPERTY = "mongoServer";
public static final String MONGO_TEST_CONNECTION = "mongoTestConnection";
public static final String TEST_CLUSTER_NAME = "zuliaTest";

public static final String MONGO_SERVER_PROPERTY_DEFAULT = "127.0.0.1";
public static final String MONGO_TEST_CONNECTION_DEFAULT = "mongodb://127.0.0.1:27017";

private static final MongoNodeService nodeService;

Expand All @@ -37,6 +37,7 @@ public class TestHelper {
ZuliaD.setLuceneStatic();

String mongoServer = getMongoServer();

MongoProvider.setMongoClient(MongoClients.create(mongoServer));

MongoProvider.getMongoClient().getDatabase(TEST_CLUSTER_NAME).drop();
Expand All @@ -61,10 +62,12 @@ public class TestHelper {

private static String getMongoServer() {

String mongoServer = System.getProperty(MONGO_SERVER_PROPERTY);
String mongoServer = System.getProperty(MONGO_TEST_CONNECTION);
if (mongoServer == null) {
mongoServer = MONGO_SERVER_PROPERTY_DEFAULT;
mongoServer = MONGO_TEST_CONNECTION_DEFAULT;
System.out.println(mongoServer);
}

return mongoServer;
}

Expand Down

0 comments on commit 58f9169

Please sign in to comment.