3535import java .util .stream .Collectors ;
3636
3737import static org .elasticsearch .test .hamcrest .RegexMatcher .matches ;
38- import static org .elasticsearch .xpack .deprecation .TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE1 ;
39- import static org .elasticsearch .xpack .deprecation .TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE2 ;
40- import static org .elasticsearch .xpack .deprecation .TestDeprecationHeaderRestAction .TEST_NOT_DEPRECATED_SETTING ;
4138import static org .hamcrest .Matchers .containsString ;
4239import static org .hamcrest .Matchers .equalTo ;
4340import static org .hamcrest .Matchers .greaterThan ;
@@ -59,10 +56,19 @@ public void testDeprecatedSettingsReturnWarnings() throws IOException {
5956 XContentBuilder builder = JsonXContent .contentBuilder ()
6057 .startObject ()
6158 .startObject ("transient" )
62- .field (TEST_DEPRECATED_SETTING_TRUE1 .getKey (), !TEST_DEPRECATED_SETTING_TRUE1 .getDefault (Settings .EMPTY ))
63- .field (TEST_DEPRECATED_SETTING_TRUE2 .getKey (), !TEST_DEPRECATED_SETTING_TRUE2 .getDefault (Settings .EMPTY ))
59+ .field (
60+ TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE1 .getKey (),
61+ !TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE1 .getDefault (Settings .EMPTY )
62+ )
63+ .field (
64+ TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE2 .getKey (),
65+ !TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE2 .getDefault (Settings .EMPTY )
66+ )
6467 // There should be no warning for this field
65- .field (TEST_NOT_DEPRECATED_SETTING .getKey (), !TEST_NOT_DEPRECATED_SETTING .getDefault (Settings .EMPTY ))
68+ .field (
69+ TestDeprecationHeaderRestAction .TEST_NOT_DEPRECATED_SETTING .getKey (),
70+ !TestDeprecationHeaderRestAction .TEST_NOT_DEPRECATED_SETTING .getDefault (Settings .EMPTY )
71+ )
6672 .endObject ()
6773 .endObject ();
6874
@@ -73,7 +79,10 @@ public void testDeprecatedSettingsReturnWarnings() throws IOException {
7379 final List <String > deprecatedWarnings = getWarningHeaders (response .getHeaders ());
7480 final List <Matcher <String >> headerMatchers = new ArrayList <>(2 );
7581
76- for (Setting <Boolean > setting : List .of (TEST_DEPRECATED_SETTING_TRUE1 , TEST_DEPRECATED_SETTING_TRUE2 )) {
82+ for (Setting <Boolean > setting : List .of (
83+ TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE1 ,
84+ TestDeprecationHeaderRestAction .TEST_DEPRECATED_SETTING_TRUE2
85+ )) {
7786 headerMatchers .add (
7887 equalTo (
7988 "["
@@ -170,14 +179,14 @@ private void doTestDeprecationWarningsAppearInHeaders() throws IOException {
170179
171180 // deprecated settings should also trigger a deprecation warning
172181 final List <Setting <Boolean >> settings = new ArrayList <>(3 );
173- settings .add (TEST_DEPRECATED_SETTING_TRUE1 );
182+ settings .add (TestDeprecationHeaderRestAction . TEST_DEPRECATED_SETTING_TRUE1 );
174183
175184 if (randomBoolean ()) {
176- settings .add (TEST_DEPRECATED_SETTING_TRUE2 );
185+ settings .add (TestDeprecationHeaderRestAction . TEST_DEPRECATED_SETTING_TRUE2 );
177186 }
178187
179188 if (useNonDeprecatedSetting ) {
180- settings .add (TEST_NOT_DEPRECATED_SETTING );
189+ settings .add (TestDeprecationHeaderRestAction . TEST_NOT_DEPRECATED_SETTING );
181190 }
182191
183192 Collections .shuffle (settings , random ());
@@ -216,7 +225,7 @@ public void testDeprecationMessagesCanBeIndexed() throws Exception {
216225 configureWriteDeprecationLogsToIndex (true );
217226
218227 Request request = new Request ("GET" , "/_test_cluster/deprecated_settings" );
219- request .setEntity (buildSettingsRequest (List .of (TEST_DEPRECATED_SETTING_TRUE1 ), true ));
228+ request .setEntity (buildSettingsRequest (List .of (TestDeprecationHeaderRestAction . TEST_DEPRECATED_SETTING_TRUE1 ), true ));
220229 assertOK (client ().performRequest (request ));
221230
222231 assertBusy (() -> {
0 commit comments