@Test public void reloadIndex_EXISTING() throws SolrServerException, IOException { when(solrServer.request(any())).thenReturn(buildSuccessResponse()); when(solrServer.request(isCheckStatus())).thenReturn(buildCheckStatusResponse()); IndexConfiguration indexConfiguration = new IndexConfiguration(); indexConfiguration.setName(EXISTING_INDEX_NAME); indexConfiguration.setInstanceDir("indexDirectory"); indexReloader.reloadIndex(indexConfiguration); ArgumentCaptor<SolrRequest> solrRequestArg = ArgumentCaptor.forClass(SolrRequest.class); verify(solrServer, times(2)).request(solrRequestArg.capture()); SolrRequest actualCheckRequest = solrRequestArg.getAllValues().get(0); SolrRequest actualReloadRequest = solrRequestArg.getAllValues().get(1); assertStatusRequest(actualCheckRequest); assertReloadRequest(actualReloadRequest, EXISTING_INDEX_NAME); }
@Override public void reloadIndex(IndexConfiguration indexConfiguration) { Preconditions.checkNotNull(solrServer); boolean indexExists = checkIndexExists(indexConfiguration); if (indexExists) { reloadIndex(indexConfiguration.getName()); } else { createIndex(indexConfiguration); } }
SolrIndexReloader implements IndexReloader { @Override public void reloadIndex(IndexConfiguration indexConfiguration) { Preconditions.checkNotNull(solrServer); boolean indexExists = checkIndexExists(indexConfiguration); if (indexExists) { reloadIndex(indexConfiguration.getName()); } else { createIndex(indexConfiguration); } } }
SolrIndexReloader implements IndexReloader { @Override public void reloadIndex(IndexConfiguration indexConfiguration) { Preconditions.checkNotNull(solrServer); boolean indexExists = checkIndexExists(indexConfiguration); if (indexExists) { reloadIndex(indexConfiguration.getName()); } else { createIndex(indexConfiguration); } }  }
SolrIndexReloader implements IndexReloader { @Override public void reloadIndex(IndexConfiguration indexConfiguration) { Preconditions.checkNotNull(solrServer); boolean indexExists = checkIndexExists(indexConfiguration); if (indexExists) { reloadIndex(indexConfiguration.getName()); } else { createIndex(indexConfiguration); } }  @Override void reloadIndex(IndexConfiguration indexConfiguration); void setSolrServer(SolrServer solrServer); }
SolrIndexReloader implements IndexReloader { @Override public void reloadIndex(IndexConfiguration indexConfiguration) { Preconditions.checkNotNull(solrServer); boolean indexExists = checkIndexExists(indexConfiguration); if (indexExists) { reloadIndex(indexConfiguration.getName()); } else { createIndex(indexConfiguration); } }  @Override void reloadIndex(IndexConfiguration indexConfiguration); void setSolrServer(SolrServer solrServer);  }