nfsantos commented on code in PR #1180:
URL: https://github.com/apache/jackrabbit-oak/pull/1180#discussion_r1372779246


##########
oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/blueGreen/CustomizedIndexTest.java:
##########
@@ -211,4 +233,25 @@ private void createFolders() throws IOException {
         indexDir = tempDir.newFolder("index");
     }
 
+    private static String getActiveLuceneIndexes(Persistence p) {
+        return getActiveLuceneIndexes(p.getCompositeNodestore(), 
p.getMountInfoProvider());
+    }
+
+    private static String getActiveLuceneIndexes(NodeStore ns, 
MountInfoProvider m) {
+        ArrayList<String> list = new ArrayList<>();
+        IndexInfoServiceImpl indexService = new IndexInfoServiceImpl(ns,
+                new IndexPathServiceImpl(ns, m));
+        for (IndexInfo info : indexService.getAllIndexInfo()) {
+            if (!LuceneIndexConstants.TYPE_LUCENE.equals(info.getType())) {
+                continue;
+            }
+            if (!info.isActive()) {
+                continue;
+            }
+            list.add(info.getIndexPath());
+        }
+        Collections.sort(list);
+        return list.toString();
+    }

Review Comment:
   If we use strings, we are comparing two things:
   - that the index names are the same (the goal of the test)
   - that the String format used to convert a list of names to a single string 
is the same in the expected and actual values
   
   We care only about the index names being the same, the string format is an 
additional complexity that we are introducing only for the test. For instance, 
we need to get the commas and the spacing right, while if we compare based on 
`Set<String>` we avoid these details. 
   
   Why would it be easier to fix the tests with Strings as compared with having 
something like ` assertEquals(Set.of("/oak:index/lucene", 
"/oak:index/test-2")`, ...`
   
   Anyway, it's not a big issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to