Skip to content

Commit

Permalink
rename funs and switch to prive
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangs18 committed Jan 18, 2024
1 parent f41fcd6 commit a518c1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/us/kbase/auth2/service/AuthBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/us/kbase/test/auth2/MongoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> command = new LinkedList<String>();
Expand All @@ -102,7 +102,7 @@ public static Version getMongoDBVer(final String mongoExe) throws IOException {
return Version.valueOf(dbVer);
}

public List<String> getMongoServerStartCommand(final String mongoExe,
private List<String> getMongoServerStartCommand(final String mongoExe,
final boolean useWiredTiger,
final Version dbVer) {
List<String> command = new LinkedList<String>();
Expand All @@ -122,7 +122,7 @@ public List<String> getMongoServerStartCommand(final String mongoExe,
return command;
}

public Process startProcess(List<String> command) throws Exception {
private Process startProcess(List<String> command) throws Exception {
ProcessBuilder servpb = new ProcessBuilder(command)
.redirectErrorStream(true)
.redirectOutput(getTempDir().resolve("mongo.log").toFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void checkCollectionNames() throws Exception {

@Test
public void indexesConfig() {
final Set<Document> indexes = updateIndexes("config");
final Set<Document> indexes = getAndNormalizeIndexes("config");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -168,7 +168,7 @@ public void indexesConfig() {

@Test
public void indexesConfigApp() {
final Set<Document> indexes = updateIndexes("config_app");
final Set<Document> indexes = getAndNormalizeIndexes("config_app");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -182,7 +182,7 @@ public void indexesConfigApp() {

@Test
public void indexesConfigExt() {
final Set<Document> indexes = updateIndexes("config_ext");
final Set<Document> indexes = getAndNormalizeIndexes("config_ext");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -196,7 +196,7 @@ public void indexesConfigExt() {

@Test
public void indexesConfigProv() {
final Set<Document> indexes = updateIndexes("config_prov");
final Set<Document> indexes = getAndNormalizeIndexes("config_prov");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -210,7 +210,7 @@ public void indexesConfigProv() {

@Test
public void indexesCustRoles() {
final Set<Document> indexes = updateIndexes("cust_roles");
final Set<Document> indexes = getAndNormalizeIndexes("cust_roles");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -224,7 +224,7 @@ public void indexesCustRoles() {

@Test
public void indexesTestCustRoles() {
final Set<Document> indexes = updateIndexes("test_cust_roles");
final Set<Document> indexes = getAndNormalizeIndexes("test_cust_roles");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -242,7 +242,7 @@ public void indexesTestCustRoles() {

@Test
public void indexesTempData() {
final Set<Document> indexes = updateIndexes("tempdata");
final Set<Document> indexes = getAndNormalizeIndexes("tempdata");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -268,7 +268,7 @@ public void indexesTempData() {

@Test
public void indexesTokens() {
final Set<Document> indexes = updateIndexes("tokens");
final Set<Document> indexes = getAndNormalizeIndexes("tokens");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -293,7 +293,7 @@ public void indexesTokens() {

@Test
public void indexesTestTokens() {
final Set<Document> indexes = updateIndexes("test_tokens");
final Set<Document> indexes = getAndNormalizeIndexes("test_tokens");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("unique", true)
Expand All @@ -318,7 +318,7 @@ public void indexesTestTokens() {

@Test
public void indexesUsers() {
final Set<Document> indexes = updateIndexes("users");
final Set<Document> indexes = getAndNormalizeIndexes("users");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("key", new Document("custrls", 1))
Expand Down Expand Up @@ -352,7 +352,7 @@ public void indexesUsers() {

@Test
public void indexesTestUsers() {
final Set<Document> indexes = updateIndexes("test_users");
final Set<Document> indexes = getAndNormalizeIndexes("test_users");
assertThat("incorrect indexes", indexes, is(set(
new Document("v", indexVer)
.append("key", new Document("custrls", 1))
Expand All @@ -379,9 +379,9 @@ public void indexesTestUsers() {
)));
}

public Set<Document> updateIndexes(final String name) {
private Set<Document> getAndNormalizeIndexes(final String collectionName) {
final Set<Document> 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");
Expand Down

0 comments on commit a518c1b

Please sign in to comment.