Skip to content

Commit c83bfac

Browse files
committed
apply spotless
Signed-off-by: xinyual <xinyual@amazon.com>
1 parent d9e0925 commit c83bfac

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java

+20-21
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,14 @@ public void testDeleteModel_BlockedBySearchPipelineAndIngestionPipeline() throws
211211
return null;
212212
}).when(client).get(any(), any());
213213

214-
215-
when(getSearchPipelineResponse.toString()).thenReturn(
216-
StringUtils.toJson(Map.of("search_1", configDataMap))
217-
);
214+
when(getSearchPipelineResponse.toString()).thenReturn(StringUtils.toJson(Map.of("search_1", configDataMap)));
218215
doAnswer(invocation -> {
219216
ActionListener<GetSearchPipelineResponse> listener = invocation.getArgument(2);
220217
listener.onResponse(getSearchPipelineResponse);
221218
return null;
222219
}).when(client).execute(eq(GetSearchPipelineAction.INSTANCE), any(), any());
223220

224-
when(getIngestionPipelineResponse.toString()).thenReturn(
225-
StringUtils.toJson(Map.of("ingest_1", Map.of("model_id", "test_id")))
226-
);
221+
when(getIngestionPipelineResponse.toString()).thenReturn(StringUtils.toJson(Map.of("ingest_1", Map.of("model_id", "test_id"))));
227222
doAnswer(invocation -> {
228223
ActionListener<GetPipelineResponse> listener = invocation.getArgument(2);
229224
listener.onResponse(getIngestionPipelineResponse);
@@ -236,7 +231,13 @@ public void testDeleteModel_BlockedBySearchPipelineAndIngestionPipeline() throws
236231
String totalErrorMessage = argumentCaptor.getValue().getMessage();
237232
String[] separateErrorMessages = totalErrorMessage.split("\\. ");
238233
Set<String> generateErrorMessages = new HashSet<>(List.of(separateErrorMessages));
239-
Set<String> expectedErrorMessages = new HashSet<>(List.of("1 ingest pipelines are still using this model, please delete or update the pipelines first: [ingest_1]", "1 search pipelines are still using this model, please delete or update the pipelines first: [search_1]"));
234+
Set<String> expectedErrorMessages = new HashSet<>(
235+
List
236+
.of(
237+
"1 ingest pipelines are still using this model, please delete or update the pipelines first: [ingest_1]",
238+
"1 search pipelines are still using this model, please delete or update the pipelines first: [search_1]"
239+
)
240+
);
240241
Boolean flag = false;
241242
for (String errorMessage : generateErrorMessages) {
242243
if (!expectedErrorMessages.contains(errorMessage)) {
@@ -311,16 +312,16 @@ public void testDeleteModel_UseSettingToSkipBlockedByIngestPipeline() throws IOE
311312
when(clusterService.getClusterSettings()).thenReturn(clusterSettings);
312313
when(clusterService.getSettings()).thenReturn(settings);
313314
deleteModelTransportAction = spy(
314-
new DeleteModelTransportAction(
315-
transportService,
316-
actionFilters,
317-
client,
318-
settings,
319-
xContentRegistry,
320-
clusterService,
321-
modelAccessControlHelper,
322-
agentModelsSearcher
323-
)
315+
new DeleteModelTransportAction(
316+
transportService,
317+
actionFilters,
318+
client,
319+
settings,
320+
xContentRegistry,
321+
clusterService,
322+
modelAccessControlHelper,
323+
agentModelsSearcher
324+
)
324325
);
325326

326327
threadContext = new ThreadContext(settings);
@@ -334,12 +335,10 @@ public void testDeleteModel_UseSettingToSkipBlockedByIngestPipeline() throws IOE
334335
return null;
335336
}).when(modelAccessControlHelper).validateModelGroupAccess(any(), any(), any(), any());
336337

337-
338-
339338
Map<String, Object> ingestPipelineConfig1 = Map.of("model_id", "test_id");
340339
Map<String, Object> ingestPipelineConfig2 = Map.of("nothing", "test_id");
341340
when(getIngestionPipelineResponse.toString())
342-
.thenReturn(StringUtils.toJson(Map.of("ingest_1", ingestPipelineConfig1, "ingest_2", ingestPipelineConfig2)));
341+
.thenReturn(StringUtils.toJson(Map.of("ingest_1", ingestPipelineConfig1, "ingest_2", ingestPipelineConfig2)));
343342
// when(getIngestionPipelineResponse.pipelines())
344343
// .thenReturn(List.of(ingestPipelineConfiguration, independentIngestPipelineConfiguration));
345344
doAnswer(invocation -> {

0 commit comments

Comments
 (0)