IndexDisabler { public boolean markDisableFlagIfRequired(String currentIndexPath, NodeBuilder idxBuilder) { boolean disableRequired = isAnyIndexToBeDisabled(currentIndexPath, idxBuilder); if (disableRequired) { idxBuilder.setProperty(DISABLE_INDEXES_ON_NEXT_CYCLE, true); } return disableRequired; } IndexDisabler(NodeBuilder rootBuilder); boolean markDisableFlagIfRequired(String currentIndexPath, NodeBuilder idxBuilder); List<String> disableOldIndexes(String currentIndexPath, NodeBuilder idxBuilder);  }
@Test public void indexToBeDisabled_Noop() throws Exception{ assertFalse(disabler.markDisableFlagIfRequired("/oak:index/foo", builder)); assertFalse(builder.getBoolean(DISABLE_INDEXES_ON_NEXT_CYCLE)); }
@Test public void indexToBeDisabled_PathNotExists() throws Exception{ builder.setProperty(IndexConstants.SUPERSEDED_INDEX_PATHS, asList("/oak:index/fooIndex", "/oak:index/barIndex"), Type.STRINGS); assertFalse(disabler.markDisableFlagIfRequired("/oak:index/foo", builder)); assertFalse(builder.getBoolean(DISABLE_INDEXES_ON_NEXT_CYCLE)); }
@Test public void nodeTypeIndexToBeDisabled_PathNotExists() throws Exception{ builder.setProperty(IndexConstants.SUPERSEDED_INDEX_PATHS, asList("/oak:index/fooIndex/@bar", "/oak:index/barIndex"), Type.STRINGS); assertFalse(disabler.markDisableFlagIfRequired("/oak:index/foo", builder)); assertFalse(builder.getBoolean(DISABLE_INDEXES_ON_NEXT_CYCLE)); }