Skip to content

Commit 6ae8ec2

Browse files
committed
fix ci
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 0c3e90e commit 6ae8ec2

11 files changed

Lines changed: 36 additions & 66 deletions

File tree

direct-query/src/test/java/org/opensearch/sql/directquery/rest/RestDirectQueryManagementActionTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ public void testWhenDataSourcesAreEnabled() {
103103
"{\"query\":\"up\",\"language\":\"promql\",\"options\":{\"queryType\":\"instant\",\"time\":\"1609459200\"}}";
104104
when(request.contentParser())
105105
.thenReturn(
106-
new org.opensearch.common.xcontent.json.JsonXContentParser(
106+
org.opensearch.common.xcontent.json.JsonXContent.jsonXContent.createParser(
107107
org.opensearch.core.xcontent.NamedXContentRegistry.EMPTY,
108108
org.opensearch.core.xcontent.DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
109-
new com.fasterxml.jackson.core.JsonFactory().createParser(requestContent)));
109+
requestContent));
110110
when(request.contentParser())
111111
.thenReturn(
112-
new org.opensearch.common.xcontent.json.JsonXContentParser(
112+
org.opensearch.common.xcontent.json.JsonXContent.jsonXContent.createParser(
113113
org.opensearch.core.xcontent.NamedXContentRegistry.EMPTY,
114114
org.opensearch.core.xcontent.DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
115-
new com.fasterxml.jackson.core.JsonFactory().createParser(requestContent)));
115+
requestContent));
116116

117117
unit.handleRequest(request, channel, nodeClient);
118118
verify(threadPool, Mockito.times(1))
@@ -389,10 +389,10 @@ private ActionListener makeRequest(String requestContent) {
389389
Mockito.when(request.param("dataSources")).thenReturn("testDataSource");
390390
Mockito.when(request.contentParser())
391391
.thenReturn(
392-
new org.opensearch.common.xcontent.json.JsonXContentParser(
392+
org.opensearch.common.xcontent.json.JsonXContent.jsonXContent.createParser(
393393
org.opensearch.core.xcontent.NamedXContentRegistry.EMPTY,
394394
org.opensearch.core.xcontent.DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
395-
new com.fasterxml.jackson.core.JsonFactory().createParser(requestContent)));
395+
requestContent));
396396
Mockito.when(request.consumedParams()).thenReturn(java.util.Collections.emptyList());
397397
Mockito.when(request.params()).thenReturn(java.util.Collections.emptyMap());
398398

integ-test/src/test/java/org/opensearch/sql/legacy/DateFunctionsIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import static org.hamcrest.Matchers.lessThan;
1111
import static org.hamcrest.Matchers.matchesPattern;
1212

13-
import com.fasterxml.jackson.core.JsonFactory;
1413
import java.io.IOException;
1514
import java.time.Month;
1615
import org.joda.time.DateTime;
@@ -21,7 +20,7 @@
2120
import org.junit.Test;
2221
import org.opensearch.action.search.SearchResponse;
2322
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
24-
import org.opensearch.common.xcontent.json.JsonXContentParser;
23+
import org.opensearch.common.xcontent.json.JsonXContent;
2524
import org.opensearch.core.xcontent.NamedXContentRegistry;
2625
import org.opensearch.core.xcontent.XContentParser;
2726
import org.opensearch.search.SearchHit;
@@ -262,10 +261,8 @@ private SearchHit[] execute(String sqlRequest) throws IOException {
262261
final JSONObject jsonObject = executeRequest(makeRequest(sqlRequest));
263262

264263
final XContentParser parser =
265-
new JsonXContentParser(
266-
NamedXContentRegistry.EMPTY,
267-
LoggingDeprecationHandler.INSTANCE,
268-
new JsonFactory().createParser(jsonObject.toString()));
264+
JsonXContent.jsonXContent.createParser(
265+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonObject.toString());
269266
return SearchResponse.fromXContent(parser).getHits().getHits();
270267
}
271268

integ-test/src/test/java/org/opensearch/sql/legacy/JSONRequestIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
import static org.hamcrest.Matchers.greaterThan;
1111
import static org.hamcrest.Matchers.lessThan;
1212

13-
import com.fasterxml.jackson.core.JsonFactory;
1413
import java.io.IOException;
1514
import java.util.Map;
1615
import org.json.JSONObject;
1716
import org.junit.Ignore;
1817
import org.junit.Test;
1918
import org.opensearch.action.search.SearchResponse;
2019
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
21-
import org.opensearch.common.xcontent.json.JsonXContentParser;
20+
import org.opensearch.common.xcontent.json.JsonXContent;
2221
import org.opensearch.core.xcontent.NamedXContentRegistry;
2322
import org.opensearch.core.xcontent.XContentParser;
2423
import org.opensearch.search.SearchHit;
@@ -200,10 +199,8 @@ private SearchHits query(String request) throws IOException {
200199
final JSONObject jsonObject = executeRequest(request);
201200

202201
final XContentParser parser =
203-
new JsonXContentParser(
204-
NamedXContentRegistry.EMPTY,
205-
LoggingDeprecationHandler.INSTANCE,
206-
new JsonFactory().createParser(jsonObject.toString()));
202+
JsonXContent.jsonXContent.createParser(
203+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonObject.toString());
207204
return SearchResponse.fromXContent(parser).getHits();
208205
}
209206
}

integ-test/src/test/java/org/opensearch/sql/legacy/MathFunctionsIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
import static org.hamcrest.Matchers.equalTo;
1111
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
1212

13-
import com.fasterxml.jackson.core.JsonFactory;
1413
import java.io.IOException;
1514
import org.junit.Ignore;
1615
import org.junit.Test;
1716
import org.opensearch.action.search.SearchResponse;
1817
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
19-
import org.opensearch.common.xcontent.json.JsonXContentParser;
18+
import org.opensearch.common.xcontent.json.JsonXContent;
2019
import org.opensearch.core.xcontent.NamedXContentRegistry;
2120
import org.opensearch.core.xcontent.XContentParser;
2221
import org.opensearch.search.SearchHit;
@@ -217,10 +216,8 @@ private SearchHit[] query(String select, String... statements) throws IOExceptio
217216
executeQueryWithStringOutput(select + " " + FROM + " " + String.join(" ", statements));
218217

219218
final XContentParser parser =
220-
new JsonXContentParser(
221-
NamedXContentRegistry.EMPTY,
222-
LoggingDeprecationHandler.INSTANCE,
223-
new JsonFactory().createParser(response));
219+
JsonXContent.jsonXContent.createParser(
220+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, response);
224221
return SearchResponse.fromXContent(parser).getHits().getHits();
225222
}
226223

integ-test/src/test/java/org/opensearch/sql/legacy/NestedFieldQueryIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import static org.opensearch.sql.util.MatcherUtils.hitAll;
1515
import static org.opensearch.sql.util.MatcherUtils.kvString;
1616

17-
import com.fasterxml.jackson.core.JsonFactory;
1817
import java.io.IOException;
1918
import java.math.BigDecimal;
2019
import java.util.ArrayList;
@@ -32,7 +31,7 @@
3231
import org.opensearch.action.search.SearchResponse;
3332
import org.opensearch.client.ResponseException;
3433
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
35-
import org.opensearch.common.xcontent.json.JsonXContentParser;
34+
import org.opensearch.common.xcontent.json.JsonXContent;
3635
import org.opensearch.core.rest.RestStatus;
3736
import org.opensearch.core.xcontent.NamedXContentRegistry;
3837
import org.opensearch.core.xcontent.XContentParser;
@@ -813,10 +812,8 @@ private SearchResponse execute(String sql) throws IOException {
813812
final JSONObject jsonObject = executeQuery(sql);
814813

815814
final XContentParser parser =
816-
new JsonXContentParser(
817-
NamedXContentRegistry.EMPTY,
818-
LoggingDeprecationHandler.INSTANCE,
819-
new JsonFactory().createParser(jsonObject.toString()));
815+
JsonXContent.jsonXContent.createParser(
816+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonObject.toString());
820817
return SearchResponse.fromXContent(parser);
821818
}
822819

integ-test/src/test/java/org/opensearch/sql/legacy/QueryFunctionsIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_NESTED_TYPE;
1414
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_PHRASE;
1515

16-
import com.fasterxml.jackson.core.JsonFactory;
1716
import java.io.IOException;
1817
import java.util.Arrays;
1918
import java.util.HashMap;
@@ -30,7 +29,7 @@
3029
import org.junit.Test;
3130
import org.opensearch.action.search.SearchResponse;
3231
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
33-
import org.opensearch.common.xcontent.json.JsonXContentParser;
32+
import org.opensearch.common.xcontent.json.JsonXContent;
3433
import org.opensearch.core.xcontent.NamedXContentRegistry;
3534
import org.opensearch.core.xcontent.XContentParser;
3635
import org.opensearch.search.SearchHit;
@@ -242,10 +241,8 @@ private SearchResponse execute(String sql) throws IOException {
242241
final JSONObject jsonObject = executeQuery(sql);
243242

244243
final XContentParser parser =
245-
new JsonXContentParser(
246-
NamedXContentRegistry.EMPTY,
247-
LoggingDeprecationHandler.INSTANCE,
248-
new JsonFactory().createParser(jsonObject.toString()));
244+
JsonXContent.jsonXContent.createParser(
245+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonObject.toString());
249246
return SearchResponse.fromXContent(parser);
250247
}
251248
}

integ-test/src/test/java/org/opensearch/sql/legacy/SQLFunctionsIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
2828
import static org.opensearch.sql.util.MatcherUtils.verifySchema;
2929

30-
import com.fasterxml.jackson.core.JsonFactory;
3130
import java.io.IOException;
3231
import java.util.Date;
3332
import java.util.stream.IntStream;
@@ -38,7 +37,7 @@
3837
import org.junit.Test;
3938
import org.opensearch.action.search.SearchResponse;
4039
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
41-
import org.opensearch.common.xcontent.json.JsonXContentParser;
40+
import org.opensearch.common.xcontent.json.JsonXContent;
4241
import org.opensearch.core.xcontent.NamedXContentRegistry;
4342
import org.opensearch.core.xcontent.XContentParser;
4443
import org.opensearch.search.SearchHit;
@@ -844,10 +843,8 @@ private SearchHits query(String query) throws IOException {
844843
final String rsp = executeQueryWithStringOutput(query);
845844

846845
final XContentParser parser =
847-
new JsonXContentParser(
848-
NamedXContentRegistry.EMPTY,
849-
LoggingDeprecationHandler.INSTANCE,
850-
new JsonFactory().createParser(rsp));
846+
JsonXContent.jsonXContent.createParser(
847+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, rsp);
851848
return SearchResponse.fromXContent(parser).getHits();
852849
}
853850

integ-test/src/test/java/org/opensearch/sql/legacy/SourceFieldIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_ACCOUNT;
99

10-
import com.fasterxml.jackson.core.JsonFactory;
1110
import java.io.IOException;
1211
import java.util.Set;
1312
import org.json.JSONObject;
@@ -16,7 +15,7 @@
1615
import org.junit.Test;
1716
import org.opensearch.action.search.SearchResponse;
1817
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
19-
import org.opensearch.common.xcontent.json.JsonXContentParser;
18+
import org.opensearch.common.xcontent.json.JsonXContent;
2019
import org.opensearch.core.xcontent.NamedXContentRegistry;
2120
import org.opensearch.core.xcontent.XContentParser;
2221
import org.opensearch.search.SearchHit;
@@ -100,10 +99,8 @@ private SearchHits query(String query) throws IOException {
10099
final JSONObject jsonObject = executeQuery(query);
101100

102101
final XContentParser parser =
103-
new JsonXContentParser(
104-
NamedXContentRegistry.EMPTY,
105-
LoggingDeprecationHandler.INSTANCE,
106-
new JsonFactory().createParser(jsonObject.toString()));
102+
JsonXContent.jsonXContent.createParser(
103+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonObject.toString());
107104
return SearchResponse.fromXContent(parser).getHits();
108105
}
109106
}

integ-test/src/test/java/org/opensearch/sql/sql/ConditionalIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
1919
import static org.opensearch.sql.util.MatcherUtils.verifySchema;
2020

21-
import com.fasterxml.jackson.core.JsonFactory;
2221
import java.io.IOException;
2322
import java.util.ArrayList;
2423
import java.util.List;
@@ -28,7 +27,7 @@
2827
import org.junit.Test;
2928
import org.opensearch.action.search.SearchResponse;
3029
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
31-
import org.opensearch.common.xcontent.json.JsonXContentParser;
30+
import org.opensearch.common.xcontent.json.JsonXContent;
3231
import org.opensearch.core.xcontent.NamedXContentRegistry;
3332
import org.opensearch.core.xcontent.XContentParser;
3433
import org.opensearch.search.SearchHits;
@@ -283,10 +282,8 @@ private SearchHits query(String query) throws IOException {
283282
final String rsp = executeQueryWithStringOutput(query);
284283

285284
final XContentParser parser =
286-
new JsonXContentParser(
287-
NamedXContentRegistry.EMPTY,
288-
LoggingDeprecationHandler.INSTANCE,
289-
new JsonFactory().createParser(rsp));
285+
JsonXContent.jsonXContent.createParser(
286+
NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, rsp);
290287
return SearchResponse.fromXContent(parser).getHits();
291288
}
292289
}

legacy/src/test/java/org/opensearch/sql/legacy/util/AggregationUtils.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55

66
package org.opensearch.sql.legacy.util;
77

8-
import com.fasterxml.jackson.core.JsonFactory;
98
import com.google.common.collect.ImmutableMap;
109
import java.io.IOException;
1110
import java.util.List;
1211
import java.util.stream.Collectors;
1312
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
14-
import org.opensearch.common.xcontent.json.JsonXContentParser;
13+
import org.opensearch.common.xcontent.json.JsonXContent;
1514
import org.opensearch.core.ParseField;
1615
import org.opensearch.core.xcontent.ContextParser;
1716
import org.opensearch.core.xcontent.NamedXContentRegistry;
@@ -78,10 +77,8 @@ Aggregation.class, new ParseField(entry.getKey()), entry.getValue()))
7877
public static Aggregations fromJson(String json) {
7978
try {
8079
XContentParser xContentParser =
81-
new JsonXContentParser(
82-
namedXContentRegistry,
83-
LoggingDeprecationHandler.INSTANCE,
84-
new JsonFactory().createParser(json));
80+
JsonXContent.jsonXContent.createParser(
81+
namedXContentRegistry, LoggingDeprecationHandler.INSTANCE, json);
8582
xContentParser.nextToken();
8683
return Aggregations.fromXContent(xContentParser);
8784
} catch (IOException e) {

0 commit comments

Comments
 (0)