Skip to content

Commit

Permalink
Backport/backport 489 to 2.x (#496)
Browse files Browse the repository at this point in the history
* fix: handle String error deserialization for ErrorCause object (#301) (#476)

* fix: handle String error deserialization for ErrorCause object (#301)

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

* update CHANGELOG.md

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

---------

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

* fix: change int type to long (#489)

* fix: change int type to long

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

* update CHANGELOG.md

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

* fix: change totalDataSetSizeInBytes to Long too

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

* fix: skip removing opensearch-observability index in AfterTest cleanup

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

---------

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>

---------

Signed-off-by: Dominik Szczepanczyk <szczepanczyk.dominik@gmail.com>
  • Loading branch information
szczepanczykd authored May 23, 2023
1 parent 4294495 commit 5b59448
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix AwsSdk2TransportOptions.responseCompression ([#322](https://github.com/opensearch-project/opensearch-java/pull/322))
- Fix missing Highlight and SourceConfig in the MultisearchBody ([#442](https://github.com/opensearch-project/opensearch-java/pull/442))
- Fix parsing /_alias error response for not existing alias ([#476](https://github.com/opensearch-project/opensearch-java/pull/476))

- Fix StoryStats numeric value out of range of int ([#489](https://github.com/opensearch-project/opensearch-java/pull/489))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ public class StoreStats implements JsonpSerializable {
@Nullable
private final String size;

private final int sizeInBytes;
private final long sizeInBytes;

@Nullable
private final String reserved;

private final int reservedInBytes;
private final long reservedInBytes;

@Nullable
private final String totalDataSetSize;

@Nullable
private final Integer totalDataSetSizeInBytes;
private final Long totalDataSetSizeInBytes;

// ---------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -98,7 +98,7 @@ public final String size() {
/**
* Required - API name: {@code size_in_bytes}
*/
public final int sizeInBytes() {
public final long sizeInBytes() {
return this.sizeInBytes;
}

Expand All @@ -113,7 +113,7 @@ public final String reserved() {
/**
* Required - API name: {@code reserved_in_bytes}
*/
public final int reservedInBytes() {
public final long reservedInBytes() {
return this.reservedInBytes;
}

Expand All @@ -129,7 +129,7 @@ public final String totalDataSetSize() {
* API name: {@code total_data_set_size_in_bytes}
*/
@Nullable
public final Integer totalDataSetSizeInBytes() {
public final Long totalDataSetSizeInBytes() {
return this.totalDataSetSizeInBytes;
}

Expand Down Expand Up @@ -183,18 +183,18 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<S
@Nullable
private String size;

private Integer sizeInBytes;
private Long sizeInBytes;

@Nullable
private String reserved;

private Integer reservedInBytes;
private Long reservedInBytes;

@Nullable
private String totalDataSetSize;

@Nullable
private Integer totalDataSetSizeInBytes;
private Long totalDataSetSizeInBytes;

/**
* API name: {@code size}
Expand All @@ -207,7 +207,7 @@ public final Builder size(@Nullable String value) {
/**
* Required - API name: {@code size_in_bytes}
*/
public final Builder sizeInBytes(int value) {
public final Builder sizeInBytes(long value) {
this.sizeInBytes = value;
return this;
}
Expand All @@ -223,7 +223,7 @@ public final Builder reserved(@Nullable String value) {
/**
* Required - API name: {@code reserved_in_bytes}
*/
public final Builder reservedInBytes(int value) {
public final Builder reservedInBytes(long value) {
this.reservedInBytes = value;
return this;
}
Expand All @@ -239,7 +239,7 @@ public final Builder totalDataSetSize(@Nullable String value) {
/**
* API name: {@code total_data_set_size_in_bytes}
*/
public final Builder totalDataSetSizeInBytes(@Nullable Integer value) {
public final Builder totalDataSetSizeInBytes(@Nullable Long value) {
this.totalDataSetSizeInBytes = value;
return this;
}
Expand Down Expand Up @@ -268,11 +268,11 @@ public StoreStats build() {
protected static void setupStoreStatsDeserializer(ObjectDeserializer<StoreStats.Builder> op) {

op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size");
op.add(Builder::sizeInBytes, JsonpDeserializer.integerDeserializer(), "size_in_bytes");
op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes");
op.add(Builder::reserved, JsonpDeserializer.stringDeserializer(), "reserved");
op.add(Builder::reservedInBytes, JsonpDeserializer.integerDeserializer(), "reserved_in_bytes");
op.add(Builder::reservedInBytes, JsonpDeserializer.longDeserializer(), "reserved_in_bytes");
op.add(Builder::totalDataSetSize, JsonpDeserializer.stringDeserializer(), "total_data_set_size");
op.add(Builder::totalDataSetSizeInBytes, JsonpDeserializer.integerDeserializer(),
op.add(Builder::totalDataSetSizeInBytes, JsonpDeserializer.longDeserializer(),
"total_data_set_size_in_bytes");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.TreeSet;

public abstract class OpenSearchJavaClientTestCase extends OpenSearchRestTestCase implements OpenSearchTransportSupport {
private static final List<String> systemIndices = List.of(".opensearch-observability", ".opendistro_security");
private static OpenSearchClient javaClient;
private static OpenSearchClient adminJavaClient;

Expand Down Expand Up @@ -137,7 +138,7 @@ protected void wipeAllOSIndices() throws IOException {
.indices(r -> r.headers("index,creation.date").expandWildcards(ExpandWildcard.All));

for (IndicesRecord index : response.valueBody()) {
if (index.index() != null && !".opendistro_security".equals(index.index())) {
if (index.index() != null && !systemIndices.contains(index.index())) {
adminJavaClient().indices().delete(new DeleteIndexRequest.Builder().index(index.index()).build());
}
}
Expand Down

0 comments on commit 5b59448

Please sign in to comment.