diff --git a/build.gradle b/build.gradle index ff91d365..450b134b 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/zulia-server/src/test/java/io/zulia/server/test/node/TestHelper.java b/zulia-server/src/test/java/io/zulia/server/test/node/TestHelper.java index 203124ac..ef7fc581 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/node/TestHelper.java +++ b/zulia-server/src/test/java/io/zulia/server/test/node/TestHelper.java @@ -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; @@ -37,6 +37,7 @@ public class TestHelper { ZuliaD.setLuceneStatic(); String mongoServer = getMongoServer(); + MongoProvider.setMongoClient(MongoClients.create(mongoServer)); MongoProvider.getMongoClient().getDatabase(TEST_CLUSTER_NAME).drop(); @@ -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; }