@Test public synchronized void readIndicesSegmentsInfo_missingAllIndices() throws Exception { try { Client client = prepareESClientForUnitTest(); SourceClientESClient tested = new SourceClientESClient(client); tested.readIndicesSegmentsInfo(null); Assert.fail("IOException must be thrown due missing index"); } catch (IOException e) { Assert.assertEquals( "response status is NOT_FOUND with content {\"error\":\"IndexMissingException[[_all] missing]\",\"status\":404}", e.getMessage()); } finally { finalizeESClientForUnitTest(); } }
@Test public synchronized void readIndicesSegmentsInfo_missingOneIndex() throws Exception { try { Client client = prepareESClientForUnitTest(); SourceClientESClient tested = new SourceClientESClient(client); Map<String, String> params = new HashMap<String, String>(); params.put("index", "test"); tested.readIndicesSegmentsInfo(params); Assert.fail("IOException must be thrown due missing index"); } catch (IOException e) { Assert.assertEquals( "response status is NOT_FOUND with content {\"error\":\"IndexMissingException[[test] missing]\",\"status\":404}", e.getMessage()); } finally { finalizeESClientForUnitTest(); } }
@Test public synchronized void readIndicesSegmentsInfo_allIndices() throws Exception { try { Client client = prepareESClientForUnitTest(); SourceClientESClient tested = new SourceClientESClient(client); indexCreate("test_index"); String info = tested.readIndicesSegmentsInfo(null); System.out.println(info); assertStartsWith( "{\"_shards\":{\"total\":10,\"successful\":5,\"failed\":0},\"indices\":{\"test_index\":{\"", info); } finally { finalizeESClientForUnitTest(); } }