From 39512755910405eb5b892d107f18c0cd5c81ad87 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Wed, 7 Feb 2024 15:18:03 +0800 Subject: [PATCH] format code Signed-off-by: zane-neo --- .../models/DeleteModelTransportAction.java | 21 +++++++++---------- .../DeleteModelTransportActionTests.java | 5 +---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java index 7c25046ddb..fa6d41f27a 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java @@ -171,7 +171,8 @@ protected void doExecute(Task task, ActionRequest request, ActionListener { wrappedListener.onFailure((new OpenSearchStatusException("Failed to find model", RestStatus.NOT_FOUND))); })); @@ -233,7 +234,12 @@ public void onFailure(Exception e) { }); } - private void deleteModelChunksAndController(FunctionName functionName, ActionListener actionListener, String modelId, DeleteResponse deleteResponse) { + private void deleteModelChunksAndController( + FunctionName functionName, + ActionListener actionListener, + String modelId, + DeleteResponse deleteResponse + ) { if (FunctionName.REMOTE != functionName) { CountDownLatch countDownLatch = new CountDownLatch(2); AtomicBoolean bothDeleted = new AtomicBoolean(true); @@ -242,11 +248,7 @@ private void deleteModelChunksAndController(FunctionName functionName, ActionLis bothDeleted.compareAndSet(true, b); if (countDownLatch.getCount() == 0) { if (bothDeleted.get()) { - log - .debug( - "model chunks and model controller for model {} deleted successfully", - modelId - ); + log.debug("model chunks and model controller for model {} deleted successfully", modelId); if (deleteResponse != null) { actionListener.onResponse(deleteResponse); } else { @@ -281,10 +283,7 @@ private void deleteModelChunksAndController(FunctionName functionName, ActionLis } }, e -> { log.error("Failed to delete model controller, please try again: " + modelId, e); - actionListener - .onFailure( - new IllegalStateException("Failed to delete model controller, please try again: " + modelId, e) - ); + actionListener.onFailure(new IllegalStateException("Failed to delete model controller, please try again: " + modelId, e)); }); deleteController(modelId, deleteControllerListener); } diff --git a/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java b/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java index 38b57332e5..791b2f43d0 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java @@ -212,10 +212,7 @@ public void testDeleteRemoteModel_deleteModelController_failed() throws IOExcept deleteModelTransportAction.doExecute(null, mlModelDeleteRequest, actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "Failed to delete model controller, please try again: test_id", - argumentCaptor.getValue().getMessage() - ); + assertEquals("Failed to delete model controller, please try again: test_id", argumentCaptor.getValue().getMessage()); } public void testDeleteLocalModel_deleteModelController_failed() throws IOException {