@Test public void shouldCheckForCategory() { when(searchRequest.getCategory()).thenReturn(category); indexerConfigMock.setEnabledCategories(Collections.emptyList()); assertTrue(testee.checkDisabledForCategory(indexer)); indexerConfigMock.setEnabledCategories(Arrays.asList("anotherCategory")); assertFalse(testee.checkDisabledForCategory(indexer)); indexerConfigMock.setEnabledCategories(Arrays.asList(("category"))); assertTrue(testee.checkDisabledForCategory(indexer)); }
protected boolean checkDisabledForCategory(Indexer indexer) { if (searchRequest.getCategory().getSubtype().equals(Subtype.ALL)) { return true; } boolean indexerDisabledForThisCategory = !indexer.getConfig().getEnabledCategories().isEmpty() && !indexer.getConfig().getEnabledCategories().contains(searchRequest.getCategory().getName()); if (indexerDisabledForThisCategory) { String message = String.format("Not using %s because it's disabled for category %s", indexer.getName(), searchRequest.getCategory().getName()); return handleIndexerNotSelected(indexer, message, "Disabled for category"); } return true; }
IndexerForSearchSelector { protected boolean checkDisabledForCategory(Indexer indexer) { if (searchRequest.getCategory().getSubtype().equals(Subtype.ALL)) { return true; } boolean indexerDisabledForThisCategory = !indexer.getConfig().getEnabledCategories().isEmpty() && !indexer.getConfig().getEnabledCategories().contains(searchRequest.getCategory().getName()); if (indexerDisabledForThisCategory) { String message = String.format("Not using %s because it's disabled for category %s", indexer.getName(), searchRequest.getCategory().getName()); return handleIndexerNotSelected(indexer, message, "Disabled for category"); } return true; } }
IndexerForSearchSelector { protected boolean checkDisabledForCategory(Indexer indexer) { if (searchRequest.getCategory().getSubtype().equals(Subtype.ALL)) { return true; } boolean indexerDisabledForThisCategory = !indexer.getConfig().getEnabledCategories().isEmpty() && !indexer.getConfig().getEnabledCategories().contains(searchRequest.getCategory().getName()); if (indexerDisabledForThisCategory) { String message = String.format("Not using %s because it's disabled for category %s", indexer.getName(), searchRequest.getCategory().getName()); return handleIndexerNotSelected(indexer, message, "Disabled for category"); } return true; }  }
IndexerForSearchSelector { protected boolean checkDisabledForCategory(Indexer indexer) { if (searchRequest.getCategory().getSubtype().equals(Subtype.ALL)) { return true; } boolean indexerDisabledForThisCategory = !indexer.getConfig().getEnabledCategories().isEmpty() && !indexer.getConfig().getEnabledCategories().contains(searchRequest.getCategory().getName()); if (indexerDisabledForThisCategory) { String message = String.format("Not using %s because it's disabled for category %s", indexer.getName(), searchRequest.getCategory().getName()); return handleIndexerNotSelected(indexer, message, "Disabled for category"); } return true; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); }
IndexerForSearchSelector { protected boolean checkDisabledForCategory(Indexer indexer) { if (searchRequest.getCategory().getSubtype().equals(Subtype.ALL)) { return true; } boolean indexerDisabledForThisCategory = !indexer.getConfig().getEnabledCategories().isEmpty() && !indexer.getConfig().getEnabledCategories().contains(searchRequest.getCategory().getName()); if (indexerDisabledForThisCategory) { String message = String.format("Not using %s because it's disabled for category %s", indexer.getName(), searchRequest.getCategory().getName()); return handleIndexerNotSelected(indexer, message, "Disabled for category"); } return true; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); static final Pattern SCHEDULER_PATTERN; }