@Test void sendPingWhenClientNull() throws Exception { when(jestManager.getClient()).thenReturn(null); PingDataProvider pingDataProvider = this.componentManager.registerMockComponent(PingDataProvider.class, "test"); this.pingSender.sendPing(); verify(pingDataProvider, never()).provideMapping(); verify(pingDataProvider, never()).provideData(); }
@Override public void sendPing() throws Exception { JestClient client = this.jestClientManager.getClient(); if (client != null) { client.execute(new CreateIndex.Builder(JestClientManager.INDEX).build()); PutMapping putMapping = new PutMapping.Builder(JestClientManager.INDEX, JestClientManager.TYPE, constructJSONMapping()).build(); client.execute(putMapping); Index index = new Index.Builder(constructIndexJSON()) .index(JestClientManager.INDEX) .type(JestClientManager.TYPE) .build(); JestResult result = client.execute(index); if (!result.isSucceeded()) { throw new Exception(result.getErrorMessage()); } } }
DefaultPingSender implements PingSender { @Override public void sendPing() throws Exception { JestClient client = this.jestClientManager.getClient(); if (client != null) { client.execute(new CreateIndex.Builder(JestClientManager.INDEX).build()); PutMapping putMapping = new PutMapping.Builder(JestClientManager.INDEX, JestClientManager.TYPE, constructJSONMapping()).build(); client.execute(putMapping); Index index = new Index.Builder(constructIndexJSON()) .index(JestClientManager.INDEX) .type(JestClientManager.TYPE) .build(); JestResult result = client.execute(index); if (!result.isSucceeded()) { throw new Exception(result.getErrorMessage()); } } } }
DefaultPingSender implements PingSender { @Override public void sendPing() throws Exception { JestClient client = this.jestClientManager.getClient(); if (client != null) { client.execute(new CreateIndex.Builder(JestClientManager.INDEX).build()); PutMapping putMapping = new PutMapping.Builder(JestClientManager.INDEX, JestClientManager.TYPE, constructJSONMapping()).build(); client.execute(putMapping); Index index = new Index.Builder(constructIndexJSON()) .index(JestClientManager.INDEX) .type(JestClientManager.TYPE) .build(); JestResult result = client.execute(index); if (!result.isSucceeded()) { throw new Exception(result.getErrorMessage()); } } }  }
DefaultPingSender implements PingSender { @Override public void sendPing() throws Exception { JestClient client = this.jestClientManager.getClient(); if (client != null) { client.execute(new CreateIndex.Builder(JestClientManager.INDEX).build()); PutMapping putMapping = new PutMapping.Builder(JestClientManager.INDEX, JestClientManager.TYPE, constructJSONMapping()).build(); client.execute(putMapping); Index index = new Index.Builder(constructIndexJSON()) .index(JestClientManager.INDEX) .type(JestClientManager.TYPE) .build(); JestResult result = client.execute(index); if (!result.isSucceeded()) { throw new Exception(result.getErrorMessage()); } } }  @Override void sendPing(); }
DefaultPingSender implements PingSender { @Override public void sendPing() throws Exception { JestClient client = this.jestClientManager.getClient(); if (client != null) { client.execute(new CreateIndex.Builder(JestClientManager.INDEX).build()); PutMapping putMapping = new PutMapping.Builder(JestClientManager.INDEX, JestClientManager.TYPE, constructJSONMapping()).build(); client.execute(putMapping); Index index = new Index.Builder(constructIndexJSON()) .index(JestClientManager.INDEX) .type(JestClientManager.TYPE) .build(); JestResult result = client.execute(index); if (!result.isSucceeded()) { throw new Exception(result.getErrorMessage()); } } }  @Override void sendPing();  }