diff --git a/src/us/kbase/auth2/service/AuthBuilder.java b/src/us/kbase/auth2/service/AuthBuilder.java index eb7bf3c7..e80de19a 100644 --- a/src/us/kbase/auth2/service/AuthBuilder.java +++ b/src/us/kbase/auth2/service/AuthBuilder.java @@ -64,7 +64,7 @@ public AuthBuilder( private MongoClient buildMongo(final AuthStartupConfig c) throws StorageInitException { //TODO ZLATER MONGO handle shards & replica sets - MongoClientSettings.Builder mongoBuilder = MongoClientSettings.builder().applyToClusterSettings( + final MongoClientSettings.Builder mongoBuilder = MongoClientSettings.builder().applyToClusterSettings( builder -> builder.hosts(Arrays.asList(new ServerAddress(c.getMongoHost())))); try { diff --git a/src/us/kbase/test/auth2/MongoController.java b/src/us/kbase/test/auth2/MongoController.java index fef8a80a..6d33266d 100644 --- a/src/us/kbase/test/auth2/MongoController.java +++ b/src/us/kbase/test/auth2/MongoController.java @@ -80,7 +80,7 @@ public void destroy(boolean deleteTempFiles) throws IOException { } } - public static Version getMongoDBVer(final String mongoExe) throws IOException { + private static Version getMongoDBVer(final String mongoExe) throws IOException { // build MongoDB version check command List command = new LinkedList(); @@ -102,7 +102,7 @@ public static Version getMongoDBVer(final String mongoExe) throws IOException { return Version.valueOf(dbVer); } - public List getMongoServerStartCommand(final String mongoExe, + private List getMongoServerStartCommand(final String mongoExe, final boolean useWiredTiger, final Version dbVer) { List command = new LinkedList(); @@ -122,7 +122,7 @@ public List getMongoServerStartCommand(final String mongoExe, return command; } - public Process startProcess(List command) throws Exception { + private Process startProcess(List command) throws Exception { ProcessBuilder servpb = new ProcessBuilder(command) .redirectErrorStream(true) .redirectOutput(getTempDir().resolve("mongo.log").toFile()); diff --git a/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java b/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java index d44d89bb..f6642907 100644 --- a/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java +++ b/src/us/kbase/test/auth2/lib/storage/mongo/MongoStorageStartUpTest.java @@ -154,7 +154,7 @@ public void checkCollectionNames() throws Exception { @Test public void indexesConfig() { - final Set indexes = updateIndexes("config"); + final Set indexes = getAndNormalizeIndexes("config"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -168,7 +168,7 @@ public void indexesConfig() { @Test public void indexesConfigApp() { - final Set indexes = updateIndexes("config_app"); + final Set indexes = getAndNormalizeIndexes("config_app"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -182,7 +182,7 @@ public void indexesConfigApp() { @Test public void indexesConfigExt() { - final Set indexes = updateIndexes("config_ext"); + final Set indexes = getAndNormalizeIndexes("config_ext"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -196,7 +196,7 @@ public void indexesConfigExt() { @Test public void indexesConfigProv() { - final Set indexes = updateIndexes("config_prov"); + final Set indexes = getAndNormalizeIndexes("config_prov"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -210,7 +210,7 @@ public void indexesConfigProv() { @Test public void indexesCustRoles() { - final Set indexes = updateIndexes("cust_roles"); + final Set indexes = getAndNormalizeIndexes("cust_roles"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -224,7 +224,7 @@ public void indexesCustRoles() { @Test public void indexesTestCustRoles() { - final Set indexes = updateIndexes("test_cust_roles"); + final Set indexes = getAndNormalizeIndexes("test_cust_roles"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -242,7 +242,7 @@ public void indexesTestCustRoles() { @Test public void indexesTempData() { - final Set indexes = updateIndexes("tempdata"); + final Set indexes = getAndNormalizeIndexes("tempdata"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -268,7 +268,7 @@ public void indexesTempData() { @Test public void indexesTokens() { - final Set indexes = updateIndexes("tokens"); + final Set indexes = getAndNormalizeIndexes("tokens"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -293,7 +293,7 @@ public void indexesTokens() { @Test public void indexesTestTokens() { - final Set indexes = updateIndexes("test_tokens"); + final Set indexes = getAndNormalizeIndexes("test_tokens"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("unique", true) @@ -318,7 +318,7 @@ public void indexesTestTokens() { @Test public void indexesUsers() { - final Set indexes = updateIndexes("users"); + final Set indexes = getAndNormalizeIndexes("users"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("key", new Document("custrls", 1)) @@ -352,7 +352,7 @@ public void indexesUsers() { @Test public void indexesTestUsers() { - final Set indexes = updateIndexes("test_users"); + final Set indexes = getAndNormalizeIndexes("test_users"); assertThat("incorrect indexes", indexes, is(set( new Document("v", indexVer) .append("key", new Document("custrls", 1)) @@ -379,9 +379,9 @@ public void indexesTestUsers() { ))); } - public Set updateIndexes(final String name) { + private Set getAndNormalizeIndexes(final String collectionName) { final Set indexes = new HashSet<>(); - for (Document index: db.getCollection(name).listIndexes()) { + for (Document index: db.getCollection(collectionName).listIndexes()) { // In MongoDB 4.4, the listIndexes and the mongo shell helper method db.collection.getIndexes() // no longer returns the namespace ns field in the index specification documents. index.remove("ns");