88import java .nio .file .Files ;
99import java .nio .file .Path ;
1010import java .util .List ;
11+ import java .util .Locale ;
1112
1213import org .junit .After ;
1314import org .junit .Before ;
@@ -71,9 +72,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorNameParam() {
7172
7273 String agentInput2 = "{\" parameters\" :{\" detectorName\" : \" " + detectorName + "\" }}" ;
7374 String result2 = executeAgent (agentId , agentInput2 );
74- assertTrue (result2 .contains (String .format ("id=%s" , detectorId )));
75- assertTrue (result2 .contains (String .format ("name=%s" , detectorName )));
76- assertTrue (result2 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
75+ assertTrue (result2 .contains (String .format (Locale . ROOT , "id=%s" , detectorId )));
76+ assertTrue (result2 .contains (String .format (Locale . ROOT , "name=%s" , detectorName )));
77+ assertTrue (result2 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
7778 } finally {
7879 if (detectorId != null ) {
7980 deleteDetector (detectorId );
@@ -95,9 +96,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorNamePatternParam()
9596
9697 String agentInput2 = "{\" parameters\" :{\" detectorNamePattern\" : \" " + detectorName + "*" + "\" }}" ;
9798 String result2 = executeAgent (agentId , agentInput2 );
98- assertTrue (result2 .contains (String .format ("id=%s" , detectorId )));
99- assertTrue (result2 .contains (String .format ("name=%s" , detectorName )));
100- assertTrue (result2 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
99+ assertTrue (result2 .contains (String .format (Locale . ROOT , "id=%s" , detectorId )));
100+ assertTrue (result2 .contains (String .format (Locale . ROOT , "name=%s" , detectorName )));
101+ assertTrue (result2 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
101102 } finally {
102103 if (detectorId != null ) {
103104 deleteDetector (detectorId );
@@ -120,7 +121,7 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_indicesParam() {
120121
121122 String agentInput2 = "{\" parameters\" :{\" indices\" : \" test-index\" }}" ;
122123 String result2 = executeAgent (agentId , agentInput2 );
123- assertTrue (result2 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
124+ assertTrue (result2 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
124125 } finally {
125126 if (detectorId != null ) {
126127 deleteDetector (detectorId );
@@ -143,9 +144,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_highCardinalityParam() {
143144
144145 String agentInput2 = "{\" parameters\" :{\" highCardinality\" : \" false\" }}" ;
145146 String result2 = executeAgent (agentId , agentInput2 );
146- assertTrue (result2 .contains (String .format ("id=%s" , detectorId )));
147- assertTrue (result2 .contains (String .format ("name=%s" , detectorName )));
148- assertTrue (result2 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
147+ assertTrue (result2 .contains (String .format (Locale . ROOT , "id=%s" , detectorId )));
148+ assertTrue (result2 .contains (String .format (Locale . ROOT , "name=%s" , detectorName )));
149+ assertTrue (result2 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
149150 } finally {
150151 if (detectorId != null ) {
151152 deleteDetector (detectorId );
@@ -172,45 +173,45 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_detectorStateParams() {
172173 String agentId = createAgent (registerAgentRequestBody );
173174 String agentInput = "{\" parameters\" :{\" running\" : \" true\" }}" ;
174175 String result = executeAgent (agentId , agentInput );
175- assertTrue (result .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
176+ assertTrue (result .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
176177 assertTrue (result .contains (detectorIdRunning ));
177178
178179 String agentInput2 = "{\" parameters\" :{\" running\" : \" false\" }}" ;
179180 String result2 = executeAgent (agentId , agentInput2 );
180- assertTrue (result2 .contains (String .format ("TotalAnomalyDetectors=%d" , 2 )));
181+ assertTrue (result2 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 2 )));
181182 assertTrue (result2 .contains (detectorIdDisabled1 ));
182183 assertTrue (result2 .contains (detectorIdDisabled2 ));
183184
184185 String agentInput3 = "{\" parameters\" :{\" failed\" : \" true\" }}" ;
185186 String result3 = executeAgent (agentId , agentInput3 );
186- assertTrue (result3 .contains (String .format ("TotalAnomalyDetectors=%d" , 0 )));
187+ assertTrue (result3 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 0 )));
187188
188189 String agentInput4 = "{\" parameters\" :{\" failed\" : \" false\" }}" ;
189190 String result4 = executeAgent (agentId , agentInput4 );
190- assertTrue (result4 .contains (String .format ("TotalAnomalyDetectors=%d" , 3 )));
191+ assertTrue (result4 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 3 )));
191192 assertTrue (result4 .contains (detectorIdRunning ));
192193 assertTrue (result4 .contains (detectorIdDisabled1 ));
193194 assertTrue (result4 .contains (detectorIdDisabled2 ));
194195
195196 String agentInput5 = "{\" parameters\" :{\" running\" : \" true\" , \" failed\" : \" true\" }}" ;
196197 String result5 = executeAgent (agentId , agentInput5 );
197- assertTrue (result5 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
198+ assertTrue (result5 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
198199 assertTrue (result5 .contains (detectorIdRunning ));
199200
200201 String agentInput6 = "{\" parameters\" :{\" running\" : \" true\" , \" failed\" : \" false\" }}" ;
201202 String result6 = executeAgent (agentId , agentInput6 );
202- assertTrue (result6 .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
203+ assertTrue (result6 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
203204 assertTrue (result6 .contains (detectorIdRunning ));
204205
205206 String agentInput7 = "{\" parameters\" :{\" running\" : \" false\" , \" failed\" : \" true\" }}" ;
206207 String result7 = executeAgent (agentId , agentInput7 );
207- assertTrue (result7 .contains (String .format ("TotalAnomalyDetectors=%d" , 2 )));
208+ assertTrue (result7 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 2 )));
208209 assertTrue (result7 .contains (detectorIdDisabled1 ));
209210 assertTrue (result7 .contains (detectorIdDisabled2 ));
210211
211212 String agentInput8 = "{\" parameters\" :{\" running\" : \" false\" , \" failed\" : \" false\" }}" ;
212213 String result8 = executeAgent (agentId , agentInput8 );
213- assertTrue (result8 .contains (String .format ("TotalAnomalyDetectors=%d" , 2 )));
214+ assertTrue (result8 .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 2 )));
214215 assertTrue (result8 .contains (detectorIdDisabled1 ));
215216 assertTrue (result8 .contains (detectorIdDisabled2 ));
216217 } finally {
@@ -243,9 +244,9 @@ public void testSearchAnomalyDetectorsToolInFlowAgent_complexParams() {
243244 + detectorName
244245 + "\" , \" highCardinality\" : false, \" sortOrder\" : \" asc\" , \" sortString\" : \" name.keyword\" , \" size\" : 10, \" startIndex\" : 0 }}" ;
245246 String result = executeAgent (agentId , agentInput );
246- assertTrue (result .contains (String .format ("id=%s" , detectorId )));
247- assertTrue (result .contains (String .format ("name=%s" , detectorName )));
248- assertTrue (result .contains (String .format ("TotalAnomalyDetectors=%d" , 1 )));
247+ assertTrue (result .contains (String .format (Locale . ROOT , "id=%s" , detectorId )));
248+ assertTrue (result .contains (String .format (Locale . ROOT , "name=%s" , detectorName )));
249+ assertTrue (result .contains (String .format (Locale . ROOT , "TotalAnomalyDetectors=%d" , 1 )));
249250 } finally {
250251 if (detectorId != null ) {
251252 deleteDetector (detectorId );
0 commit comments