diff --git a/common/src/test/java/org/opensearch/ml/common/TestHelper.java b/common/src/test/java/org/opensearch/ml/common/TestHelper.java index 9377b123e8..7cfd4bb250 100644 --- a/common/src/test/java/org/opensearch/ml/common/TestHelper.java +++ b/common/src/test/java/org/opensearch/ml/common/TestHelper.java @@ -26,7 +26,7 @@ public static void testParse(ToXContentObject obj, Function void testParse(ToXContentObject obj, Function function, boolean wrapWithObject) throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); if (wrapWithObject) { builder.startObject(); } @@ -46,7 +46,7 @@ public static void testParseFromString(ToXContentObject obj, String jsonStr, } public static String contentObjectToString(ToXContentObject obj) throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); obj.toXContent(builder, ToXContent.EMPTY_PARAMS); return xContentBuilderToString(builder); } diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/BooleanValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/BooleanValueTest.java index 161d5bd8a0..d3fb66f8e2 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/BooleanValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/BooleanValueTest.java @@ -29,7 +29,7 @@ public void booleanValue() { @Test public void testToXContent() throws IOException { BooleanValue value = new BooleanValue(true); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); value.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/ColumnMetaTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/ColumnMetaTest.java index f212473e9f..3ece59c447 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/ColumnMetaTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/ColumnMetaTest.java @@ -51,7 +51,7 @@ public void writeToAndReadStream() throws IOException { @Test public void testToXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); columnMeta.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/DefaultDataFrameTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/DefaultDataFrameTest.java index 1249df6ec5..30c48ab6f3 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/DefaultDataFrameTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/DefaultDataFrameTest.java @@ -227,7 +227,7 @@ public void select_Exception_InvalidColumn(){ @Test public void testToXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); defaultDataFrame.toXContent(builder); builder.endObject(); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/DoubleValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/DoubleValueTest.java index d271a90e00..bd82086c3c 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/DoubleValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/DoubleValueTest.java @@ -47,7 +47,7 @@ public void writeTo() throws IOException { @Test public void testToXContent() throws IOException { DoubleValue doubleValue = new DoubleValue(5.0D); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); doubleValue.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/FloatValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/FloatValueTest.java index cf7600b40a..24f6d376ff 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/FloatValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/FloatValueTest.java @@ -30,7 +30,7 @@ public void floatValue() { @Test public void testToXContent() throws IOException { FloatValue floatValue = new FloatValue(2.1f); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); floatValue.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/IntValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/IntValueTest.java index 11d248784c..dfe7638f4d 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/IntValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/IntValueTest.java @@ -29,7 +29,7 @@ public void intValue() { @Test public void testToXContent() throws IOException { IntValue intValue = new IntValue(2); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); intValue.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/LongValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/LongValueTest.java index 97b6cbcc1c..e69d88584b 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/LongValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/LongValueTest.java @@ -29,7 +29,7 @@ public void longValue() { @Test public void testToXContent() throws IOException { LongValue longValue = new LongValue((long)2); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); longValue.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/NullValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/NullValueTest.java index bceb5a2cbf..a0de8719bb 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/NullValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/NullValueTest.java @@ -30,7 +30,7 @@ public void getValue() { @Test public void testToXContent() throws IOException { NullValue value = new NullValue(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); value.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/RowTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/RowTest.java index b1f9fe30e0..f23eea2c37 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/RowTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/RowTest.java @@ -133,7 +133,7 @@ public void select() { @Test public void testToXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); row.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/ShortValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/ShortValueTest.java index 6db79f115c..e9c95a0aed 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/ShortValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/ShortValueTest.java @@ -29,7 +29,7 @@ public void shortValue() { @Test public void testToXContent() throws IOException { ShortValue shortValue = new ShortValue((short)2); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); shortValue.toXContent(builder); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/dataframe/StringValueTest.java b/common/src/test/java/org/opensearch/ml/common/dataframe/StringValueTest.java index b1e185792b..592f7dfb9b 100644 --- a/common/src/test/java/org/opensearch/ml/common/dataframe/StringValueTest.java +++ b/common/src/test/java/org/opensearch/ml/common/dataframe/StringValueTest.java @@ -34,7 +34,7 @@ public void stringValue_NullPointerException() { @Test public void testToXContent() throws IOException { StringValue value = new StringValue("str"); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); value.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/input/MLInputTest.java b/common/src/test/java/org/opensearch/ml/common/input/MLInputTest.java index 599acad25e..52b865e931 100644 --- a/common/src/test/java/org/opensearch/ml/common/input/MLInputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/input/MLInputTest.java @@ -150,7 +150,7 @@ public void parse_TextEmbedding_NullResultFilter() throws IOException { private void testParse(FunctionName algorithm, MLInputDataset inputDataset, String expectedInputStr, Consumer verify) throws IOException { MLInput input = MLInput.builder().inputDataset(inputDataset).algorithm(algorithm).build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); input.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/input/nlp/TextDocsMLInputTest.java b/common/src/test/java/org/opensearch/ml/common/input/nlp/TextDocsMLInputTest.java index eca558b8ff..2fc36f2b52 100644 --- a/common/src/test/java/org/opensearch/ml/common/input/nlp/TextDocsMLInputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/input/nlp/TextDocsMLInputTest.java @@ -45,7 +45,7 @@ public void setUp() throws Exception { @Test public void parseTextDocsMLInput() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); input.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); parseMLInput(jsonStr); diff --git a/common/src/test/java/org/opensearch/ml/common/output/MLPredictionOutputTest.java b/common/src/test/java/org/opensearch/ml/common/output/MLPredictionOutputTest.java index 7702f224d6..22d7d6959a 100644 --- a/common/src/test/java/org/opensearch/ml/common/output/MLPredictionOutputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/output/MLPredictionOutputTest.java @@ -46,7 +46,7 @@ public void setUp() { } @Test public void toXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals("{\"task_id\":\"test_task_id\",\"status\":\"test_status\",\"prediction_result\":" + @@ -58,7 +58,7 @@ public void toXContent() throws IOException { @Test public void toXContent_EmptyOutput() throws IOException { MLPredictionOutput output = MLPredictionOutput.builder().build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals("{}", jsonStr); diff --git a/common/src/test/java/org/opensearch/ml/common/output/MLTrainingOutputTest.java b/common/src/test/java/org/opensearch/ml/common/output/MLTrainingOutputTest.java index bc51671011..4ba59b0c0f 100644 --- a/common/src/test/java/org/opensearch/ml/common/output/MLTrainingOutputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/output/MLTrainingOutputTest.java @@ -21,7 +21,7 @@ public class MLTrainingOutputTest { public void parse_MLTrain() throws IOException { MLTrainingOutput output = MLTrainingOutput.builder() .modelId("test_modelId").status("test_status").build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals("{\"model_id\":\"test_modelId\",\"status\":\"test_status\"}", jsonStr); diff --git a/common/src/test/java/org/opensearch/ml/common/output/execute/samplecalculator/LocalSampleCalculatorOutputTest.java b/common/src/test/java/org/opensearch/ml/common/output/execute/samplecalculator/LocalSampleCalculatorOutputTest.java index ca2e6fc46d..c5e378d60f 100644 --- a/common/src/test/java/org/opensearch/ml/common/output/execute/samplecalculator/LocalSampleCalculatorOutputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/output/execute/samplecalculator/LocalSampleCalculatorOutputTest.java @@ -31,7 +31,7 @@ public void setUp() { @Test public void toXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.endObject(); @@ -42,7 +42,7 @@ public void toXContent() throws IOException { @Test public void toXContent_EmptyOutput() throws IOException { LocalSampleCalculatorOutput output = LocalSampleCalculatorOutput.builder().build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.endObject(); diff --git a/common/src/test/java/org/opensearch/ml/common/output/sample/SampleAlgoOutputTest.java b/common/src/test/java/org/opensearch/ml/common/output/sample/SampleAlgoOutputTest.java index 06e6274a25..dcc08d4923 100644 --- a/common/src/test/java/org/opensearch/ml/common/output/sample/SampleAlgoOutputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/output/sample/SampleAlgoOutputTest.java @@ -31,7 +31,7 @@ public void setUp() { @Test public void toXContent() throws IOException { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals("{\"sample_result\":1.0}", jsonStr); @@ -40,7 +40,7 @@ public void toXContent() throws IOException { @Test public void toXContent_EmptyOutput() throws IOException { SampleAlgoOutput output = SampleAlgoOutput.builder().build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); output.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals("{}", jsonStr); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLConnectorGetResponseTests.java b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLConnectorGetResponseTests.java index 45c8c5746c..3187e8e888 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLConnectorGetResponseTests.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLConnectorGetResponseTests.java @@ -55,7 +55,7 @@ public void writeTo_Success() throws IOException { @Test public void toXContentTest() throws IOException { MLConnectorGetResponse mlConnectorGetResponse = MLConnectorGetResponse.builder().mlConnector(connector).build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); mlConnectorGetResponse.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java index aeaff7d000..e36ea754e7 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java @@ -141,7 +141,7 @@ public void constructorMLCreateConnectorInput_NullProtocol() { @Test public void testToXContent_FullFields() throws Exception { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); mlCreateConnectorInput.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); @@ -150,7 +150,7 @@ public void testToXContent_FullFields() throws Exception { @Test public void testToXContent_NullFields() throws Exception { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); mlCreateDryRunConnectorInput.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodeResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodeResponseTest.java index 128ac5afe6..cce0c463be 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodeResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodeResponseTest.java @@ -8,7 +8,7 @@ import org.opensearch.Version; import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import java.io.IOException; import java.net.InetAddress; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesRequestTest.java b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesRequestTest.java index 871865478c..938543f230 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesRequestTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesRequestTest.java @@ -9,7 +9,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.StreamInput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import org.opensearch.ml.common.FunctionName; import org.opensearch.ml.common.MLTask; import org.opensearch.ml.common.MLTaskState; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesResponseTest.java index 70ff250548..baff6e2ddf 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelNodesResponseTest.java @@ -11,7 +11,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.Strings; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentType; import org.opensearch.core.xcontent.ToXContent; @@ -76,7 +76,7 @@ public void testToXContent() throws IOException { List failures = new ArrayList<>(); MLDeployModelNodesResponse response = new MLDeployModelNodesResponse(clusterName, nodes, failures); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals( diff --git a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelResponseTest.java index 90d11d3421..f75d998712 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/deploy/MLDeployModelResponseTest.java @@ -43,7 +43,7 @@ public void testToXContent() throws IOException { // Setup MLDeployModelResponse response = new MLDeployModelResponse(taskId, status); // Run the test - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/execute/MLExecuteTaskResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/execute/MLExecuteTaskResponseTest.java index 733a7127fb..43bb791fcd 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/execute/MLExecuteTaskResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/execute/MLExecuteTaskResponseTest.java @@ -87,7 +87,7 @@ public void toXContentTest() throws IOException { .output(output) .build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/forward/MLForwardResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/forward/MLForwardResponseTest.java index bace2b0be1..fb5f76e25b 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/forward/MLForwardResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/forward/MLForwardResponseTest.java @@ -60,7 +60,7 @@ public void testToXContent() throws IOException { // Setup MLForwardResponse response = new MLForwardResponse(status, predictionOutput); // Run the test - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/model/MLModelGetResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/model/MLModelGetResponseTest.java index 2dc347921a..fbd337992f 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/model/MLModelGetResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/model/MLModelGetResponseTest.java @@ -61,7 +61,7 @@ public void writeTo_Success() throws IOException { @Test public void toXContentTest() throws IOException { MLModelGetResponse mlModelGetResponse = MLModelGetResponse.builder().mlModel(mlModel).build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); mlModelGetResponse.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/prediction/MLPredictionTaskResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/prediction/MLPredictionTaskResponseTest.java index 2544e1337c..bad2dcc065 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/prediction/MLPredictionTaskResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/prediction/MLPredictionTaskResponseTest.java @@ -120,7 +120,7 @@ public void toXContentTest() throws IOException { .output(output) .build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelInputTest.java b/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelInputTest.java index 17ccb79dc6..09ad2a856c 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelInputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelInputTest.java @@ -145,7 +145,7 @@ public void constructor_SuccessWithMinimalSetup() { @Test public void testToXContent() throws Exception { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); input.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); @@ -161,7 +161,7 @@ public void testToXContent_Incomplete() throws Exception { input.setModelConfig(null); input.setModelFormat(null); input.setModelNodeIds(null); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); input.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelResponseTest.java index 66365f4d8d..64d954d18b 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/register/MLRegisterModelResponseTest.java @@ -43,7 +43,7 @@ public void testToXContent() throws IOException { // Setup MLRegisterModelResponse response = new MLRegisterModelResponse(taskId, status); // Run the test - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeRequestTest.java b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeRequestTest.java index e1bf0cb7d2..dc16986f64 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeRequestTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeRequestTest.java @@ -9,7 +9,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.StreamInput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import java.io.IOException; import java.net.InetAddress; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeResponseTest.java index 4a5dedccee..56e1672852 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpNodeResponseTest.java @@ -7,7 +7,7 @@ import org.opensearch.Version; import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import java.io.IOException; import java.net.InetAddress; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpResponseTest.java index f8bfe61bf7..9d038c5dca 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/sync/MLSyncUpResponseTest.java @@ -42,7 +42,7 @@ public void testToXContent() throws IOException { // Setup MLSyncUpResponse response = new MLSyncUpResponse(status); // Run the test - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/task/MLTaskGetResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/task/MLTaskGetResponseTest.java index 87727186bf..aee2cd6f07 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/task/MLTaskGetResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/task/MLTaskGetResponseTest.java @@ -69,7 +69,7 @@ public void writeTo_Success() throws IOException { @Test public void toXContentTest() throws IOException { MLTaskGetResponse mlTaskGetResponse = MLTaskGetResponse.builder().mlTask(mlTask).build(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); mlTaskGetResponse.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelInputTest.java b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelInputTest.java index d15d53ad23..f110061bfe 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelInputTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelInputTest.java @@ -35,7 +35,7 @@ public void setUp() throws Exception { @Test public void testToXContent() throws Exception { - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); input.toXContent(builder, ToXContent.EMPTY_PARAMS); assertNotNull(builder); String jsonStr = Strings.toString(builder); diff --git a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodeResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodeResponseTest.java index 4f03c6e077..30dc98f0a9 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodeResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodeResponseTest.java @@ -8,7 +8,7 @@ import org.opensearch.Version; import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import java.io.IOException; import java.net.InetAddress; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesRequestTest.java b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesRequestTest.java index 7f4444dd0a..434ba2dbef 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesRequestTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesRequestTest.java @@ -7,7 +7,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.StreamInput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import java.io.IOException; import java.net.InetAddress; diff --git a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesResponseTest.java b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesResponseTest.java index 5873c3718d..0df3ff2d50 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesResponseTest.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/undeploy/MLUndeployModelNodesResponseTest.java @@ -11,7 +11,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.Strings; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentType; import org.opensearch.core.xcontent.ToXContent; @@ -89,7 +89,7 @@ public void testToXContent() throws IOException { List failures = new ArrayList<>(); MLUndeployModelNodesResponse response = new MLUndeployModelNodesResponse(clusterName, nodes, failures); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); response.toXContent(builder, ToXContent.EMPTY_PARAMS); String jsonStr = Strings.toString(builder); assertEquals( diff --git a/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/anomalylocalization/AnomalyLocalizerImplTests.java b/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/anomalylocalization/AnomalyLocalizerImplTests.java index 327d6516ed..06f79c266c 100644 --- a/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/anomalylocalization/AnomalyLocalizerImplTests.java +++ b/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/anomalylocalization/AnomalyLocalizerImplTests.java @@ -39,7 +39,7 @@ import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.Settings; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import org.opensearch.index.IndexNotFoundException; import org.opensearch.index.query.QueryBuilder; import org.opensearch.ml.common.input.execute.anomalylocalization.AnomalyLocalizationInput; diff --git a/plugin/src/main/java/org/opensearch/ml/action/connector/TransportCreateConnectorAction.java b/plugin/src/main/java/org/opensearch/ml/action/connector/TransportCreateConnectorAction.java index 0408fafe96..74172a1fa8 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/connector/TransportCreateConnectorAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/connector/TransportCreateConnectorAction.java @@ -91,7 +91,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener predictionFuture = client().execute(MLPredictionTaskAction.INSTANCE, predictionRequest); MLTaskResponse predictionResponse = predictionFuture.actionGet(); - XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); + XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); MLPredictionOutput mlPredictionOutput = (MLPredictionOutput) predictionResponse.getOutput(); mlPredictionOutput.getPredictionResult().toXContent(builder, ToXContent.EMPTY_PARAMS); diff --git a/plugin/src/test/java/org/opensearch/ml/utils/TestHelper.java b/plugin/src/test/java/org/opensearch/ml/utils/TestHelper.java index 7eb20ed21d..7f7ac4d7f7 100644 --- a/plugin/src/test/java/org/opensearch/ml/utils/TestHelper.java +++ b/plugin/src/test/java/org/opensearch/ml/utils/TestHelper.java @@ -53,7 +53,7 @@ import org.opensearch.common.settings.ClusterSettings; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; -import org.opensearch.common.transport.TransportAddress; +import org.opensearch.core.common.transport.TransportAddress; import org.opensearch.common.xcontent.LoggingDeprecationHandler; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentType;