Skip to content

Commit

Permalink
[Backport 2.x] Increment version to 2.7.0-SNAPSHOT and update usage o…
Browse files Browse the repository at this point in the history
…f XContentFactory.xContent (opensearch-project#2451)

* Update usage of XContentFactory.xContent (opensearch-project#2433)

* Switch from XContentType to MediaType

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
(cherry picked from commit bae002b)

* Increment version to 2.7.0.0

Signed-off-by: Craig Perkins <[email protected]>

* Update bwcVersion

Signed-off-by: Craig Perkins <[email protected]>

* Update bwc_version in ci.yml

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Co-authored-by: Craig Perkins <[email protected]>
Co-authored-by: Ryan Liang <[email protected]>
  • Loading branch information
3 people authored Feb 24, 2023
1 parent ce207b8 commit eb8c59d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- run: |
echo "Running backwards compatibility tests ..."
security_plugin_version_no_snapshot=$(./gradlew properties -q | grep -E '^version:' | awk '{print $2}' | sed 's/-SNAPSHOT//g')
bwc_version=2.4.0
bwc_version=2.6.0
cp -r build/ ./bwc-test/
mkdir ./bwc-test/src/test/resources/security_plugin_version_no_snapshot
cp build/distributions/opensearch-security-${security_plugin_version_no_snapshot}.zip ./bwc-test/src/test/resources/${security_plugin_version_no_snapshot}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugin_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Plugin Install
on: [push, pull_request, workflow_dispatch]

env:
OPENSEARCH_VERSION: 2.6.0
OPENSEARCH_VERSION: 2.7.0
PLUGIN_NAME: opensearch-security

jobs:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.opensearch.gradle.test.RestIntegTestTask

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")

Expand Down
8 changes: 4 additions & 4 deletions bwc-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ext {

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.6.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT")
opensearch_group = "org.opensearch"
}
repositories {
Expand All @@ -73,16 +73,16 @@ dependencies {
testImplementation "org.opensearch.test:framework:${opensearch_version}"
}

String bwcVersion = "2.4.0.0";
String bwcVersion = "2.6.0.0";
String baseName = "securityBwcCluster"
String bwcFilePath = "src/test/resources/"
String projectVersion = "2.6.0.0"
String projectVersion = "2.7.0.0"

2.times {i ->
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = ["2.4.0","2.6.0"]
versions = ["2.6.0","2.7.0"]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.opensearch.action.support.WriteRequest.RefreshPolicy;
import org.opensearch.client.Client;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.xcontent.MediaType;
import org.opensearch.common.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down Expand Up @@ -116,11 +117,11 @@ public static String createEmptySdcYaml(CType cType, int configVersion) throws E
return DefaultObjectMapper.YAML_MAPPER.writeValueAsString(createEmptySdc(cType, configVersion));
}

public static BytesReference readXContent(final Reader reader, final XContentType xContentType) throws IOException {
public static BytesReference readXContent(final Reader reader, final MediaType mediaType) throws IOException {
BytesReference retVal;
XContentParser parser = null;
try {
parser = XContentFactory.xContent(xContentType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, reader);
parser = XContentFactory.xContent(mediaType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, reader);
parser.nextToken();
final XContentBuilder builder = XContentFactory.jsonBuilder();
builder.copyCurrentStructure(parser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.xcontent.MediaType;
import org.opensearch.common.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down Expand Up @@ -937,11 +938,11 @@ private static boolean retrieveFile(final RestHighLevelClient restHighLevelClien
return false;
}

private static BytesReference readXContent(final String content, final XContentType xContentType) throws IOException {
private static BytesReference readXContent(final String content, final MediaType mediaType) throws IOException {
BytesReference retVal;
XContentParser parser = null;
try {
parser = XContentFactory.xContent(xContentType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, content);
parser = XContentFactory.xContent(mediaType).createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, content);
parser.nextToken();
final XContentBuilder builder = XContentFactory.jsonBuilder();
builder.copyCurrentStructure(parser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void after() {
public void testKafka() throws Exception {
String configYml = FileHelper.loadFile("auditlog/endpoints/sink/configuration_kafka.yml");
configYml = configYml.replace("_RPLC_BOOTSTRAP_SERVERS_",embeddedKafka.getEmbeddedKafka().getBrokersAsString());
Settings.Builder settingsBuilder = Settings.builder().loadFromSource(configYml, YamlXContent.yamlXContent.type());
Settings.Builder settingsBuilder = Settings.builder().loadFromSource(configYml, YamlXContent.yamlXContent.mediaType());
try(KafkaConsumer<Long, String> consumer = createConsumer()) {
consumer.subscribe(Arrays.asList("compliance"));

Expand Down

0 comments on commit eb8c59d

Please sign in to comment.