Skip to content

Commit dd54ea5

Browse files
authored
fix Jenkins CI pipeline for OS 3.0 version bump (#901)
* fix Jenkins CI pipeline for OS 3.0 version bump Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Remove build cache Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Bug fix Signed-off-by: Sicheng Song <sicheng.song@outlook.com> * Code fix on OS 3.0 major refactor Signed-off-by: Sicheng Song <sicheng.song@outlook.com> --------- Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
1 parent ce6e6c7 commit dd54ea5

File tree

54 files changed

+383
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+383
-307
lines changed

client/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jacocoTestCoverageVerification {
4848
check.dependsOn jacocoTestCoverageVerification
4949

5050
tasks.named("jar").configure { dependsOn("publishShadowPublicationToMavenLocal") }
51+
tasks.named("jar").configure { dependsOn("publishShadowPublicationToStagingRepository") }
5152

5253
shadowJar {
5354
archiveClassifier.set(null)

common/src/test/java/org/opensearch/ml/common/TestHelper.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package org.opensearch.ml.common;
77

8-
import org.opensearch.common.Strings;
8+
import org.opensearch.core.common.Strings;
99
import org.opensearch.common.bytes.BytesReference;
1010
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
1111
import org.opensearch.common.xcontent.XContentFactory;
@@ -16,7 +16,6 @@
1616
import org.opensearch.core.xcontent.XContentBuilder;
1717
import org.opensearch.core.xcontent.XContentParser;
1818

19-
2019
import java.io.IOException;
2120
import java.util.function.Function;
2221

@@ -26,7 +25,8 @@ public static <T> void testParse(ToXContentObject obj, Function<XContentParser,
2625
testParse(obj, function, false);
2726
}
2827

29-
public static <T> void testParse(ToXContentObject obj, Function<XContentParser, T> function, boolean wrapWithObject) throws IOException {
28+
public static <T> void testParse(ToXContentObject obj, Function<XContentParser, T> function, boolean wrapWithObject)
29+
throws IOException {
3030
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
3131
if (wrapWithObject) {
3232
builder.startObject();
@@ -35,12 +35,14 @@ public static <T> void testParse(ToXContentObject obj, Function<XContentParser,
3535
if (wrapWithObject) {
3636
builder.endObject();
3737
}
38-
String jsonStr = Strings.toString(builder);
38+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3939
testParseFromString(obj, jsonStr, function);
4040
}
4141

42-
public static <T> void testParseFromString(ToXContentObject obj, String jsonStr, Function<XContentParser, T> function) throws IOException {
43-
XContentParser parser = XContentType.JSON.xContent().createParser(NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, jsonStr);
42+
public static <T> void testParseFromString(ToXContentObject obj, String jsonStr,
43+
Function<XContentParser, T> function) throws IOException {
44+
XContentParser parser = XContentType.JSON.xContent().createParser(NamedXContentRegistry.EMPTY,
45+
LoggingDeprecationHandler.INSTANCE, jsonStr);
4446
parser.nextToken();
4547
T parsedObj = function.apply(parser);
4648
obj.equals(parsedObj);

common/src/test/java/org/opensearch/ml/common/dataframe/BooleanValueTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.xcontent.XContentFactory;
1111
import org.opensearch.common.xcontent.XContentType;
1212
import org.opensearch.core.xcontent.XContentBuilder;
@@ -31,7 +31,7 @@ public void testToXContent() throws IOException {
3131
value.toXContent(builder);
3232

3333
assertNotNull(builder);
34-
String jsonStr = Strings.toString(builder);
34+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3535
assertEquals("{\"column_type\":\"BOOLEAN\",\"value\":true}", jsonStr);
3636
}
3737
}

common/src/test/java/org/opensearch/ml/common/dataframe/ColumnMetaTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import org.junit.Before;
99
import org.junit.Test;
10-
import org.opensearch.common.Strings;
10+
import org.opensearch.core.common.Strings;
1111
import org.opensearch.common.io.stream.BytesStreamOutput;
1212
import org.opensearch.common.xcontent.XContentFactory;
1313
import org.opensearch.common.xcontent.XContentType;
@@ -55,7 +55,7 @@ public void testToXContent() throws IOException {
5555
columnMeta.toXContent(builder);
5656

5757
assertNotNull(builder);
58-
String jsonStr = Strings.toString(builder);
58+
String jsonStr = org.opensearch.common.Strings.toString(builder);
5959
assertEquals("{\"name\":\"columnMetaName\",\"column_type\":\"STRING\"}", jsonStr);
6060
}
6161

common/src/test/java/org/opensearch/ml/common/dataframe/DefaultDataFrameTest.java

+30-29
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.junit.Rule;
1010
import org.junit.Test;
1111
import org.junit.rules.ExpectedException;
12-
import org.opensearch.common.Strings;
12+
import org.opensearch.core.common.Strings;
1313
import org.opensearch.common.io.stream.BytesStreamOutput;
1414
import org.opensearch.common.io.stream.StreamInput;
1515
import org.opensearch.common.xcontent.XContentFactory;
@@ -173,21 +173,21 @@ public void columnMetas_Success() {
173173
}
174174

175175
@Test
176-
public void remove_Exception_InputColumnIndexBiggerThanColumensLength(){
176+
public void remove_Exception_InputColumnIndexBiggerThanColumensLength() {
177177
exceptionRule.expect(IllegalArgumentException.class);
178178
exceptionRule.expectMessage("columnIndex can't be negative or bigger than columns length:4");
179179
defaultDataFrame.remove(4);
180180
}
181181

182182
@Test
183-
public void remove_Exception_InputColumnIndexNegtiveColumensLength(){
183+
public void remove_Exception_InputColumnIndexNegtiveColumensLength() {
184184
exceptionRule.expect(IllegalArgumentException.class);
185185
exceptionRule.expectMessage("columnIndex can't be negative or bigger than columns length:4");
186186
defaultDataFrame.remove(-1);
187187
}
188188

189189
@Test
190-
public void remove_EmptyColumnMeta(){
190+
public void remove_EmptyColumnMeta() {
191191
exceptionRule.expect(IllegalArgumentException.class);
192192
exceptionRule.expectMessage("columnIndex can't be negative or bigger than columns length:0");
193193
DefaultDataFrame dataFrame = new DefaultDataFrame(new ColumnMeta[0]);
@@ -196,31 +196,31 @@ public void remove_EmptyColumnMeta(){
196196
}
197197

198198
@Test
199-
public void remove_Success(){
199+
public void remove_Success() {
200200
DataFrame dataFrame = defaultDataFrame.remove(3);
201201
assertEquals(3, dataFrame.columnMetas().length);
202202
assertEquals(3, dataFrame.getRow(0).size());
203203
}
204204

205205
@Test
206-
public void select_Success(){
207-
DataFrame dataFrame = defaultDataFrame.select(new int[]{1, 3});
206+
public void select_Success() {
207+
DataFrame dataFrame = defaultDataFrame.select(new int[] { 1, 3 });
208208
assertEquals(2, dataFrame.columnMetas().length);
209209
assertEquals(2, dataFrame.getRow(0).size());
210210
}
211211

212212
@Test
213-
public void select_Exception_EmptyInputColumns(){
213+
public void select_Exception_EmptyInputColumns() {
214214
exceptionRule.expect(IllegalArgumentException.class);
215215
exceptionRule.expectMessage("columns can't be null or empty");
216216
defaultDataFrame.select(new int[0]);
217217
}
218218

219219
@Test
220-
public void select_Exception_InvalidColumn(){
220+
public void select_Exception_InvalidColumn() {
221221
exceptionRule.expect(IllegalArgumentException.class);
222222
exceptionRule.expectMessage("columnIndex can't be negative or bigger than columns length");
223-
defaultDataFrame.select(new int[]{5});
223+
defaultDataFrame.select(new int[] { 5 });
224224
}
225225

226226
@Test
@@ -231,43 +231,44 @@ public void testToXContent() throws IOException {
231231
builder.endObject();
232232

233233
assertNotNull(builder);
234-
String jsonStr = Strings.toString(builder);
234+
String jsonStr = org.opensearch.common.Strings.toString(builder);
235235
assertEquals("{\"column_metas\":[" +
236-
"{\"name\":\"c1\",\"column_type\":\"STRING\"}," +
237-
"{\"name\":\"c2\",\"column_type\":\"INTEGER\"}," +
238-
"{\"name\":\"c3\",\"column_type\":\"DOUBLE\"}," +
239-
"{\"name\":\"c4\",\"column_type\":\"BOOLEAN\"}]," +
240-
"\"rows\":[" +
241-
"{\"values\":[" +
242-
"{\"column_type\":\"STRING\",\"value\":\"string\"}," +
243-
"{\"column_type\":\"INTEGER\",\"value\":1}," +
244-
"{\"column_type\":\"DOUBLE\",\"value\":2.0}," +
245-
"{\"column_type\":\"BOOLEAN\",\"value\":true}]}]}", jsonStr);
236+
"{\"name\":\"c1\",\"column_type\":\"STRING\"}," +
237+
"{\"name\":\"c2\",\"column_type\":\"INTEGER\"}," +
238+
"{\"name\":\"c3\",\"column_type\":\"DOUBLE\"}," +
239+
"{\"name\":\"c4\",\"column_type\":\"BOOLEAN\"}]," +
240+
"\"rows\":[" +
241+
"{\"values\":[" +
242+
"{\"column_type\":\"STRING\",\"value\":\"string\"}," +
243+
"{\"column_type\":\"INTEGER\",\"value\":1}," +
244+
"{\"column_type\":\"DOUBLE\",\"value\":2.0}," +
245+
"{\"column_type\":\"BOOLEAN\",\"value\":true}]}]}", jsonStr);
246246
}
247247

248248
@Test
249249
public void testParse_EmptyDataFrame() throws IOException {
250-
ColumnMeta[] columnMetas = new ColumnMeta[] {new ColumnMeta("test_int", ColumnType.INTEGER)};
250+
ColumnMeta[] columnMetas = new ColumnMeta[] { new ColumnMeta("test_int", ColumnType.INTEGER) };
251251
DefaultDataFrame dataFrame = new DefaultDataFrame(columnMetas);
252252
TestHelper.testParse(dataFrame, function, true);
253253
}
254254

255255
@Test
256256
public void testParse_DataFrame() throws IOException {
257-
ColumnMeta[] columnMetas = new ColumnMeta[] {new ColumnMeta("test_int", ColumnType.INTEGER)};
257+
ColumnMeta[] columnMetas = new ColumnMeta[] { new ColumnMeta("test_int", ColumnType.INTEGER) };
258258
DefaultDataFrame dataFrame = new DefaultDataFrame(columnMetas);
259-
dataFrame.appendRow(new Integer[]{1});
260-
dataFrame.appendRow(new Integer[]{2});
259+
dataFrame.appendRow(new Integer[] { 1 });
260+
dataFrame.appendRow(new Integer[] { 2 });
261261
TestHelper.testParse(dataFrame, function, true);
262262
}
263263

264264
@Test
265265
public void testParse_WrongExtraField() throws IOException {
266-
ColumnMeta[] columnMetas = new ColumnMeta[] {new ColumnMeta("test_int", ColumnType.INTEGER)};
266+
ColumnMeta[] columnMetas = new ColumnMeta[] { new ColumnMeta("test_int", ColumnType.INTEGER) };
267267
DefaultDataFrame dataFrame = new DefaultDataFrame(columnMetas);
268-
dataFrame.appendRow(new Integer[]{1});
269-
dataFrame.appendRow(new Integer[]{2});
270-
String jsonStr = "{\"wrong_field\":{\"test\":\"abc\"},\"column_metas\":[{\"name\":\"test_int\",\"column_type\":" +
268+
dataFrame.appendRow(new Integer[] { 1 });
269+
dataFrame.appendRow(new Integer[] { 2 });
270+
String jsonStr = "{\"wrong_field\":{\"test\":\"abc\"},\"column_metas\":[{\"name\":\"test_int\",\"column_type\":"
271+
+
271272
"\"INTEGER\"}],\"rows\":[{\"values\":[{\"column_type\":\"INTEGER\",\"value\":1}]},{\"values\":" +
272273
"[{\"column_type\":\"INTEGER\",\"value\":2}]}]}";
273274
TestHelper.testParseFromString(dataFrame, jsonStr, function);

common/src/test/java/org/opensearch/ml/common/dataframe/DoubleValueTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.io.stream.BytesStreamOutput;
1111
import org.opensearch.common.xcontent.XContentFactory;
1212
import org.opensearch.common.xcontent.XContentType;
@@ -51,7 +51,7 @@ public void testToXContent() throws IOException {
5151
doubleValue.toXContent(builder);
5252

5353
assertNotNull(builder);
54-
String jsonStr = Strings.toString(builder);
54+
String jsonStr = org.opensearch.common.Strings.toString(builder);
5555
assertEquals("{\"column_type\":\"DOUBLE\",\"value\":5.0}", jsonStr);
5656
}
5757
}

common/src/test/java/org/opensearch/ml/common/dataframe/FloatValueTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.xcontent.XContentFactory;
1111
import org.opensearch.common.xcontent.XContentType;
1212
import org.opensearch.core.xcontent.XContentBuilder;
@@ -34,7 +34,7 @@ public void testToXContent() throws IOException {
3434
floatValue.toXContent(builder);
3535

3636
assertNotNull(builder);
37-
String jsonStr = Strings.toString(builder);
37+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3838
assertEquals("{\"column_type\":\"FLOAT\",\"value\":2.1}", jsonStr);
3939
}
4040
}

common/src/test/java/org/opensearch/ml/common/dataframe/IntValueTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.xcontent.XContentFactory;
1111
import org.opensearch.common.xcontent.XContentType;
1212
import org.opensearch.core.xcontent.XContentBuilder;
@@ -33,7 +33,7 @@ public void testToXContent() throws IOException {
3333
intValue.toXContent(builder);
3434

3535
assertNotNull(builder);
36-
String jsonStr = Strings.toString(builder);
36+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3737
assertEquals("{\"column_type\":\"INTEGER\",\"value\":2}", jsonStr);
3838
}
3939
}

common/src/test/java/org/opensearch/ml/common/dataframe/LongValueTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.xcontent.XContentFactory;
1111
import org.opensearch.common.xcontent.XContentType;
1212
import org.opensearch.core.xcontent.XContentBuilder;
@@ -20,20 +20,20 @@ public class LongValueTest {
2020

2121
@Test
2222
public void longValue() {
23-
LongValue longValue = new LongValue((long)2);
23+
LongValue longValue = new LongValue((long) 2);
2424
assertEquals(ColumnType.LONG, longValue.columnType());
2525
assertEquals(2L, longValue.getValue());
2626
assertEquals(2.0d, longValue.doubleValue(), 1e-5);
2727
}
2828

2929
@Test
3030
public void testToXContent() throws IOException {
31-
LongValue longValue = new LongValue((long)2);
31+
LongValue longValue = new LongValue((long) 2);
3232
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
3333
longValue.toXContent(builder);
3434

3535
assertNotNull(builder);
36-
String jsonStr = Strings.toString(builder);
36+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3737
assertEquals("{\"column_type\":\"LONG\",\"value\":2}", jsonStr);
3838
}
3939
}

common/src/test/java/org/opensearch/ml/common/dataframe/NullValueTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.opensearch.ml.common.dataframe;
77

88
import org.junit.Test;
9-
import org.opensearch.common.Strings;
9+
import org.opensearch.core.common.Strings;
1010
import org.opensearch.common.xcontent.XContentFactory;
1111
import org.opensearch.common.xcontent.XContentType;
1212
import org.opensearch.core.xcontent.ToXContent;
@@ -34,7 +34,7 @@ public void testToXContent() throws IOException {
3434
value.toXContent(builder, ToXContent.EMPTY_PARAMS);
3535

3636
assertNotNull(builder);
37-
String jsonStr = Strings.toString(builder);
37+
String jsonStr = org.opensearch.common.Strings.toString(builder);
3838
assertEquals("{\"column_type\":\"NULL\"}", jsonStr);
3939
}
4040
}

0 commit comments

Comments
 (0)