boolean value2 = true;
Settings transientSettings1 = ImmutableSettings.builder().put(key1, value1).build();
Settings persistentSettings1 = ImmutableSettings.builder().put(key2, value2).build();
ClusterUpdateSettingsResponse response1 = client().admin().cluster()
.prepareUpdateSettings()
.setTransientSettings(transientSettings1)
.setPersistentSettings(persistentSettings1)
.execute()
.actionGet();
assertAcked(response1);
assertThat(response1.getTransientSettings().get(key1), notNullValue());
assertThat(response1.getTransientSettings().get(key2), nullValue());
assertThat(response1.getPersistentSettings().get(key1), nullValue());
assertThat(response1.getPersistentSettings().get(key2), notNullValue());
Settings transientSettings2 = ImmutableSettings.builder().put(key1, value1).put(key2, value2).build();
Settings persistentSettings2 = ImmutableSettings.EMPTY;
ClusterUpdateSettingsResponse response2 = client().admin().cluster()
.prepareUpdateSettings()
.setTransientSettings(transientSettings2)
.setPersistentSettings(persistentSettings2)
.execute()
.actionGet();
assertAcked(response2);
assertThat(response2.getTransientSettings().get(key1), notNullValue());
assertThat(response2.getTransientSettings().get(key2), notNullValue());
assertThat(response2.getPersistentSettings().get(key1), nullValue());
assertThat(response2.getPersistentSettings().get(key2), nullValue());
Settings transientSettings3 = ImmutableSettings.EMPTY;
Settings persistentSettings3 = ImmutableSettings.builder().put(key1, value1).put(key2, value2).build();
ClusterUpdateSettingsResponse response3 = client().admin().cluster()
.prepareUpdateSettings()
.setTransientSettings(transientSettings3)
.setPersistentSettings(persistentSettings3)
.execute()
.actionGet();
assertAcked(response3);
assertThat(response3.getTransientSettings().get(key1), nullValue());
assertThat(response3.getTransientSettings().get(key2), nullValue());
assertThat(response3.getPersistentSettings().get(key1), notNullValue());
assertThat(response3.getPersistentSettings().get(key2), notNullValue());
}