@Test public void parseTxtTest() { IndexTxtFileParser indexTxtFileParser = new IndexTxtFileParser(); Set<MongoIndex> indexes = indexTxtFileParser.parse(INDEX_TXT_FILE); assertEquals(2, indexes.size()); Map<String, MongoIndex> expectedIndex = new HashMap<String, MongoIndex>(); DBObject adminDelegationIndex = new BasicDBObject(); adminDelegationIndex.put("body.localEdOrgId", 1); expectedIndex.put("adminDelegation", new MongoIndex("adminDelegation", false, adminDelegationIndex, false)); DBObject applicationAuthorizationIndex = new BasicDBObject(); applicationAuthorizationIndex.put("body.appIds", 1); expectedIndex.put("applicationAuthorization", new MongoIndex("applicationAuthorization", true, applicationAuthorizationIndex, false)); for (MongoIndex index : indexes) { String collection = index.getCollection(); if (collection.equalsIgnoreCase("learningObjective")) { fail("Invalid index was parsed"); } else if (collection.equalsIgnoreCase("adminDelegation")) { assertEquals(index, expectedIndex.get("adminDelegation")); } else if (collection.equalsIgnoreCase("applicationAuthorization")) { assertEquals(index, expectedIndex.get("applicationAuthorization")); assertTrue(index.isUnique()); } } }
@Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); }
IndexTxtFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); } }
IndexTxtFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); }  }
IndexTxtFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); }  @Override Set<MongoIndex> parse(String fileName); static Set<String> loadIndexes(String indexFile); }
IndexTxtFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); }  @Override Set<MongoIndex> parse(String fileName); static Set<String> loadIndexes(String indexFile);  }