Skip to content

Commit eb8c59d

Browse files
opensearch-trigger-bot[bot]cwperksRyanL1997
authored
[Backport 2.x] Increment version to 2.7.0-SNAPSHOT and update usage of XContentFactory.xContent (#2451)
* Update usage of XContentFactory.xContent (#2433) * Switch from XContentType to MediaType Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: Peter Nied <petern@amazon.com> Co-authored-by: Peter Nied <petern@amazon.com> (cherry picked from commit bae002b) * Increment version to 2.7.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Update bwcVersion Signed-off-by: Craig Perkins <cwperx@amazon.com> * Update bwc_version in ci.yml Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com>
1 parent ce207b8 commit eb8c59d

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- run: |
6464
echo "Running backwards compatibility tests ..."
6565
security_plugin_version_no_snapshot=$(./gradlew properties -q | grep -E '^version:' | awk '{print $2}' | sed 's/-SNAPSHOT//g')
66-
bwc_version=2.4.0
66+
bwc_version=2.6.0
6767
cp -r build/ ./bwc-test/
6868
mkdir ./bwc-test/src/test/resources/security_plugin_version_no_snapshot
6969
cp build/distributions/opensearch-security-${security_plugin_version_no_snapshot}.zip ./bwc-test/src/test/resources/${security_plugin_version_no_snapshot}

.github/workflows/plugin_install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Plugin Install
33
on: [push, pull_request, workflow_dispatch]
44

55
env:
6-
OPENSEARCH_VERSION: 2.6.0
6+
OPENSEARCH_VERSION: 2.7.0
77
PLUGIN_NAME: opensearch-security
88

99
jobs:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import org.opensearch.gradle.test.RestIntegTestTask
1313

1414
buildscript {
1515
ext {
16-
opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT")
16+
opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT")
1717
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
1818
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
1919

bwc-test/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ext {
4747

4848
buildscript {
4949
ext {
50-
opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT")
50+
opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT")
5151
opensearch_group = "org.opensearch"
5252
}
5353
repositories {
@@ -73,16 +73,16 @@ dependencies {
7373
testImplementation "org.opensearch.test:framework:${opensearch_version}"
7474
}
7575

76-
String bwcVersion = "2.4.0.0";
76+
String bwcVersion = "2.6.0.0";
7777
String baseName = "securityBwcCluster"
7878
String bwcFilePath = "src/test/resources/"
79-
String projectVersion = "2.6.0.0"
79+
String projectVersion = "2.7.0.0"
8080

8181
2.times {i ->
8282
testClusters {
8383
"${baseName}$i" {
8484
testDistribution = "ARCHIVE"
85-
versions = ["2.4.0","2.6.0"]
85+
versions = ["2.6.0","2.7.0"]
8686
numberOfNodes = 3
8787
plugin(provider(new Callable<RegularFile>() {
8888
@Override

src/main/java/org/opensearch/security/support/ConfigHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.opensearch.action.support.WriteRequest.RefreshPolicy;
4242
import org.opensearch.client.Client;
4343
import org.opensearch.common.bytes.BytesReference;
44+
import org.opensearch.common.xcontent.MediaType;
4445
import org.opensearch.common.xcontent.NamedXContentRegistry;
4546
import org.opensearch.common.xcontent.XContentBuilder;
4647
import org.opensearch.common.xcontent.XContentFactory;
@@ -116,11 +117,11 @@ public static String createEmptySdcYaml(CType cType, int configVersion) throws E
116117
return DefaultObjectMapper.YAML_MAPPER.writeValueAsString(createEmptySdc(cType, configVersion));
117118
}
118119

119-
public static BytesReference readXContent(final Reader reader, final XContentType xContentType) throws IOException {
120+
public static BytesReference readXContent(final Reader reader, final MediaType mediaType) throws IOException {
120121
BytesReference retVal;
121122
XContentParser parser = null;
122123
try {
123-
parser = XContentFactory.xContent(xContentType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, reader);
124+
parser = XContentFactory.xContent(mediaType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, reader);
124125
parser.nextToken();
125126
final XContentBuilder builder = XContentFactory.jsonBuilder();
126127
builder.copyCurrentStructure(parser);

src/main/java/org/opensearch/security/tools/SecurityAdmin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
import org.opensearch.common.collect.Tuple;
108108
import org.opensearch.common.settings.Settings;
109109
import org.opensearch.common.unit.TimeValue;
110+
import org.opensearch.common.xcontent.MediaType;
110111
import org.opensearch.common.xcontent.NamedXContentRegistry;
111112
import org.opensearch.common.xcontent.XContentBuilder;
112113
import org.opensearch.common.xcontent.XContentFactory;
@@ -937,11 +938,11 @@ private static boolean retrieveFile(final RestHighLevelClient restHighLevelClien
937938
return false;
938939
}
939940

940-
private static BytesReference readXContent(final String content, final XContentType xContentType) throws IOException {
941+
private static BytesReference readXContent(final String content, final MediaType mediaType) throws IOException {
941942
BytesReference retVal;
942943
XContentParser parser = null;
943944
try {
944-
parser = XContentFactory.xContent(xContentType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, content);
945+
parser = XContentFactory.xContent(mediaType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, content);
945946
parser.nextToken();
946947
final XContentBuilder builder = XContentFactory.jsonBuilder();
947948
builder.copyCurrentStructure(parser);

src/test/java/org/opensearch/security/auditlog/sink/KafkaSinkTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void after() {
5454
public void testKafka() throws Exception {
5555
String configYml = FileHelper.loadFile("auditlog/endpoints/sink/configuration_kafka.yml");
5656
configYml = configYml.replace("_RPLC_BOOTSTRAP_SERVERS_",embeddedKafka.getEmbeddedKafka().getBrokersAsString());
57-
Settings.Builder settingsBuilder = Settings.builder().loadFromSource(configYml, YamlXContent.yamlXContent.type());
57+
Settings.Builder settingsBuilder = Settings.builder().loadFromSource(configYml, YamlXContent.yamlXContent.mediaType());
5858
try(KafkaConsumer<Long, String> consumer = createConsumer()) {
5959
consumer.subscribe(Arrays.asList("compliance"));
6060

0 commit comments

Comments
 (0)