use of com.yelp.nrtsearch.server.luceneserver.state.backend.RemoteStateBackend in project nrtsearch by Yelp.
the class BackendGlobalStateTest method testUseRemoteBackend.
@Test
public void testUseRemoteBackend() throws IOException {
String configFile = String.join("\n", "stateConfig:", " backendType: REMOTE", "stateDir: " + folder.newFolder("state").getAbsolutePath(), "indexDir: " + folder.newFolder("index").getAbsolutePath());
LuceneServerConfiguration config = new LuceneServerConfiguration(new ByteArrayInputStream(configFile.getBytes()));
Path tmpStateFolder = Paths.get(folder.getRoot().getAbsolutePath(), StateUtils.GLOBAL_STATE_FOLDER);
StateUtils.ensureDirectory(tmpStateFolder);
StateUtils.writeStateToFile(new PersistentGlobalState(), tmpStateFolder, StateUtils.GLOBAL_STATE_FILE);
Archiver archiver = mock(Archiver.class);
when(archiver.download(any(), any())).thenReturn(Paths.get(folder.getRoot().getAbsolutePath()));
BackendGlobalState backendGlobalState = new BackendGlobalState(config, archiver);
assertTrue(backendGlobalState.getStateBackend() instanceof RemoteStateBackend);
}
Aggregations