From 26422bb59fea035baf62ca04541f8232237c5134 Mon Sep 17 00:00:00 2001 From: Owais Kazi Date: Mon, 9 Oct 2023 15:16:43 -0700 Subject: [PATCH] Addressed PR Comments Signed-off-by: Owais Kazi --- .../opensearch/ml/client/MachineLearningClient.java | 2 +- .../ml/client/MachineLearningNodeClient.java | 4 +--- .../ml/client/MachineLearningNodeClientTest.java | 13 +++++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/org/opensearch/ml/client/MachineLearningClient.java b/client/src/main/java/org/opensearch/ml/client/MachineLearningClient.java index f5898a9b8a..901961a33c 100644 --- a/client/src/main/java/org/opensearch/ml/client/MachineLearningClient.java +++ b/client/src/main/java/org/opensearch/ml/client/MachineLearningClient.java @@ -272,7 +272,7 @@ default ActionFuture deploy(String modelId) { /** * Create connector for remote model - * @param mlCreateConnectorInput Create Connector Input + * @param mlCreateConnectorInput Create Connector Input, refer: https://opensearch.org/docs/latest/ml-commons-plugin/extensibility/connectors/ * @return the result future */ default ActionFuture createConnector(MLCreateConnectorInput mlCreateConnectorInput) { diff --git a/client/src/main/java/org/opensearch/ml/client/MachineLearningNodeClient.java b/client/src/main/java/org/opensearch/ml/client/MachineLearningNodeClient.java index 6a5a8a892e..d186acdb94 100644 --- a/client/src/main/java/org/opensearch/ml/client/MachineLearningNodeClient.java +++ b/client/src/main/java/org/opensearch/ml/client/MachineLearningNodeClient.java @@ -235,9 +235,7 @@ public void deploy(String modelId, ActionListener listene @Override public void createConnector(MLCreateConnectorInput mlCreateConnectorInput, ActionListener listener) { MLCreateConnectorRequest createConnectorRequest = new MLCreateConnectorRequest(mlCreateConnectorInput); - client.execute(MLCreateConnectorAction.INSTANCE, createConnectorRequest, ActionListener.wrap(listener::onResponse, e -> { - listener.onFailure(e); - })); + client.execute(MLCreateConnectorAction.INSTANCE, createConnectorRequest, listener); } private ActionListener getMlPredictionTaskResponseActionListener(ActionListener listener) { diff --git a/client/src/test/java/org/opensearch/ml/client/MachineLearningNodeClientTest.java b/client/src/test/java/org/opensearch/ml/client/MachineLearningNodeClientTest.java index 3ff76108c4..f734053a37 100644 --- a/client/src/test/java/org/opensearch/ml/client/MachineLearningNodeClientTest.java +++ b/client/src/test/java/org/opensearch/ml/client/MachineLearningNodeClientTest.java @@ -27,7 +27,12 @@ import org.opensearch.core.xcontent.ToXContent; import org.opensearch.core.xcontent.ToXContentObject; import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.ml.common.*; +import org.opensearch.ml.common.FunctionName; +import org.opensearch.ml.common.MLModel; +import org.opensearch.ml.common.MLTask; +import org.opensearch.ml.common.MLTaskState; +import org.opensearch.ml.common.AccessMode; +import org.opensearch.ml.common.MLTaskType; import org.opensearch.ml.common.dataframe.DataFrame; import org.opensearch.ml.common.dataset.MLInputDataset; import org.opensearch.ml.common.input.MLInput; @@ -74,7 +79,11 @@ import org.opensearch.search.suggest.Suggest; import java.io.IOException; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Arrays; +import java.util.List; import static org.junit.Assert.assertEquals; import static org.mockito.Answers.RETURNS_DEEP_STUBS;