@Test public void shouldCheckIfSelectedByUser() { when(searchModuleProviderMock.getIndexers()).thenReturn(Arrays.asList(indexer)); when(searchRequest.getSource()).thenReturn(SearchSource.INTERNAL); when(searchRequest.getIndexers()).thenReturn(Optional.of(Sets.newSet("anotherIndexer"))); assertFalse(testee.checkIndexerSelectedByUser(indexer)); when(searchRequest.getSource()).thenReturn(SearchSource.API); assertFalse(testee.checkIndexerSelectedByUser(indexer)); when(searchRequest.getIndexers()).thenReturn(Optional.of(Sets.newSet("indexer"))); when(searchRequest.getSource()).thenReturn(SearchSource.INTERNAL); assertTrue(testee.checkIndexerSelectedByUser(indexer)); when(searchRequest.getSource()).thenReturn(SearchSource.API); assertTrue(testee.checkIndexerSelectedByUser(indexer)); }
protected boolean checkIndexerSelectedByUser(Indexer indexer) { boolean indexerNotSelectedByUser = (searchRequest.getIndexers().isPresent() && !searchRequest.getIndexers().get().isEmpty()) && !searchRequest.getIndexers().get().contains(indexer.getName()); if (indexerNotSelectedByUser) { logger.info(String.format("Not using %s because it was not selected by the user", indexer.getName())); notSelectedIndersWithReason.put(indexer, "Not selected by the user"); return false; } return true; }
IndexerForSearchSelector { protected boolean checkIndexerSelectedByUser(Indexer indexer) { boolean indexerNotSelectedByUser = (searchRequest.getIndexers().isPresent() && !searchRequest.getIndexers().get().isEmpty()) && !searchRequest.getIndexers().get().contains(indexer.getName()); if (indexerNotSelectedByUser) { logger.info(String.format("Not using %s because it was not selected by the user", indexer.getName())); notSelectedIndersWithReason.put(indexer, "Not selected by the user"); return false; } return true; } }
IndexerForSearchSelector { protected boolean checkIndexerSelectedByUser(Indexer indexer) { boolean indexerNotSelectedByUser = (searchRequest.getIndexers().isPresent() && !searchRequest.getIndexers().get().isEmpty()) && !searchRequest.getIndexers().get().contains(indexer.getName()); if (indexerNotSelectedByUser) { logger.info(String.format("Not using %s because it was not selected by the user", indexer.getName())); notSelectedIndersWithReason.put(indexer, "Not selected by the user"); return false; } return true; }  }
IndexerForSearchSelector { protected boolean checkIndexerSelectedByUser(Indexer indexer) { boolean indexerNotSelectedByUser = (searchRequest.getIndexers().isPresent() && !searchRequest.getIndexers().get().isEmpty()) && !searchRequest.getIndexers().get().contains(indexer.getName()); if (indexerNotSelectedByUser) { logger.info(String.format("Not using %s because it was not selected by the user", indexer.getName())); notSelectedIndersWithReason.put(indexer, "Not selected by the user"); return false; } return true; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); }
IndexerForSearchSelector { protected boolean checkIndexerSelectedByUser(Indexer indexer) { boolean indexerNotSelectedByUser = (searchRequest.getIndexers().isPresent() && !searchRequest.getIndexers().get().isEmpty()) && !searchRequest.getIndexers().get().contains(indexer.getName()); if (indexerNotSelectedByUser) { logger.info(String.format("Not using %s because it was not selected by the user", indexer.getName())); notSelectedIndersWithReason.put(indexer, "Not selected by the user"); return false; } return true; }  IndexerForSearchSelection pickIndexers(SearchRequest searchRequest); static final Pattern SCHEDULER_PATTERN; }