plan.expectsAffectedRows(true);
Job job = executor.newJob(plan);
List<ListenableFuture<TaskResult>> futures = executor.execute(job);
ListenableFuture<List<TaskResult>> listenableFuture = Futures.allAsList(futures);
TaskResult taskResult = listenableFuture.get().get(0);
Object[][] objects = listenableFuture.get().get(0).rows();
assertThat(taskResult.rowCount(), is(1L));
assertThat(objects.length, is(0));
assertEquals("panic", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().persistentSettings().get(persistentSetting));
// Update transient only
Settings transientSettings = ImmutableSettings.builder()
.put(transientSetting, "123")
.build();
node = new ESClusterUpdateSettingsNode(EMPTY_SETTINGS, transientSettings);
plan = new Plan();
plan.add(node);
plan.expectsAffectedRows(true);
job = executor.newJob(plan);
futures = executor.execute(job);
listenableFuture = Futures.allAsList(futures);
taskResult = listenableFuture.get().get(0);
objects = listenableFuture.get().get(0).rows();
assertThat(taskResult.rowCount(), is(1L));
assertThat(objects.length, is(0));
assertEquals("123", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().transientSettings().get(transientSetting));
// Update persistent & transient
persistentSettings = ImmutableSettings.builder()
.put(persistentSetting, "normal")
.build();
transientSettings = ImmutableSettings.builder()
.put(transientSetting, "243")
.build();
node = new ESClusterUpdateSettingsNode(persistentSettings, transientSettings);
plan = new Plan();
plan.add(node);
plan.expectsAffectedRows(true);
job = executor.newJob(plan);
futures = executor.execute(job);
listenableFuture = Futures.allAsList(futures);
taskResult = listenableFuture.get().get(0);
objects = listenableFuture.get().get(0).rows();
assertThat(taskResult.rowCount(), is(1L));
assertThat(objects.length, is(0));
assertEquals("normal", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().persistentSettings().get(persistentSetting));
assertEquals("243", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().transientSettings().get(transientSetting));
}