Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Jan 5, 2025
1 parent b9e9e58 commit 9daa8fa
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@

import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand Down Expand Up @@ -71,24 +73,24 @@ public class NodeInfoSearchPipelines
// ---------------------------------------------------------------------------------------------

private NodeInfoSearchPipelines(Builder builder) {
this.requestProcessors = ApiTypeHelper.unmodifiableRequired(builder.requestProcessors, this, "requestProcessors");
this.responseProcessors = ApiTypeHelper.unmodifiableRequired(builder.responseProcessors, this, "responseProcessors");
this.requestProcessors = ApiTypeHelper.unmodifiable(builder.requestProcessors);
this.responseProcessors = ApiTypeHelper.unmodifiable(builder.responseProcessors);
}

public static NodeInfoSearchPipelines of(Function<NodeInfoSearchPipelines.Builder, ObjectBuilder<NodeInfoSearchPipelines>> fn) {
return fn.apply(new Builder()).build();
}

/**
* Required - API name: {@code request_processors}
* API name: {@code request_processors}
*/
@Nonnull
public final List<NodeInfoIngestProcessor> requestProcessors() {
return this.requestProcessors;
}

/**
* Required - API name: {@code response_processors}
* API name: {@code response_processors}
*/
@Nonnull
public final List<NodeInfoIngestProcessor> responseProcessors() {
Expand All @@ -106,19 +108,23 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("request_processors");
generator.writeStartArray();
for (NodeInfoIngestProcessor item0 : this.requestProcessors) {
item0.serialize(generator, mapper);
if (ApiTypeHelper.isDefined(this.requestProcessors)) {
generator.writeKey("request_processors");
generator.writeStartArray();
for (NodeInfoIngestProcessor item0 : this.requestProcessors) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
generator.writeEnd();

generator.writeKey("response_processors");
generator.writeStartArray();
for (NodeInfoIngestProcessor item0 : this.responseProcessors) {
item0.serialize(generator, mapper);
if (ApiTypeHelper.isDefined(this.responseProcessors)) {
generator.writeKey("response_processors");
generator.writeStartArray();
for (NodeInfoIngestProcessor item0 : this.responseProcessors) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
generator.writeEnd();
}

// ---------------------------------------------------------------------------------------------
Expand All @@ -138,7 +144,9 @@ public static Builder builder() {
* Builder for {@link NodeInfoSearchPipelines}.
*/
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, NodeInfoSearchPipelines> {
@Nullable
private List<NodeInfoIngestProcessor> requestProcessors;
@Nullable
private List<NodeInfoIngestProcessor> responseProcessors;

public Builder() {}
Expand All @@ -160,7 +168,7 @@ public Builder copy() {
}

/**
* Required - API name: {@code request_processors}
* API name: {@code request_processors}
*
* <p>
* Adds all elements of <code>list</code> to <code>requestProcessors</code>.
Expand All @@ -173,7 +181,7 @@ public final Builder requestProcessors(List<NodeInfoIngestProcessor> list) {
}

/**
* Required - API name: {@code request_processors}
* API name: {@code request_processors}
*
* <p>
* Adds one or more values to <code>requestProcessors</code>.
Expand All @@ -186,7 +194,7 @@ public final Builder requestProcessors(NodeInfoIngestProcessor value, NodeInfoIn
}

/**
* Required - API name: {@code request_processors}
* API name: {@code request_processors}
*
* <p>
* Adds a value to <code>requestProcessors</code> using a builder lambda.
Expand All @@ -198,7 +206,7 @@ public final Builder requestProcessors(Function<NodeInfoIngestProcessor.Builder,
}

/**
* Required - API name: {@code response_processors}
* API name: {@code response_processors}
*
* <p>
* Adds all elements of <code>list</code> to <code>responseProcessors</code>.
Expand All @@ -211,7 +219,7 @@ public final Builder responseProcessors(List<NodeInfoIngestProcessor> list) {
}

/**
* Required - API name: {@code response_processors}
* API name: {@code response_processors}
*
* <p>
* Adds one or more values to <code>responseProcessors</code>.
Expand All @@ -224,7 +232,7 @@ public final Builder responseProcessors(NodeInfoIngestProcessor value, NodeInfoI
}

/**
* Required - API name: {@code response_processors}
* API name: {@code response_processors}
*
* <p>
* Adds a value to <code>responseProcessors</code> using a builder lambda.
Expand Down Expand Up @@ -275,8 +283,8 @@ protected static void setupNodeInfoSearchPipelinesDeserializer(ObjectDeserialize
@Override
public int hashCode() {
int result = 17;
result = 31 * result + this.requestProcessors.hashCode();
result = 31 * result + this.responseProcessors.hashCode();
result = 31 * result + Objects.hashCode(this.requestProcessors);
result = 31 * result + Objects.hashCode(this.responseProcessors);
return result;
}

Expand All @@ -285,6 +293,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
NodeInfoSearchPipelines other = (NodeInfoSearchPipelines) o;
return this.requestProcessors.equals(other.requestProcessors) && this.responseProcessors.equals(other.responseProcessors);
return Objects.equals(this.requestProcessors, other.requestProcessors)
&& Objects.equals(this.responseProcessors, other.responseProcessors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class NodeInfoSettingsNode implements PlainJsonSerializable, ToCopyableBu
// ---------------------------------------------------------------------------------------------

private NodeInfoSettingsNode(Builder builder) {
this.attr = ApiTypeHelper.unmodifiableRequired(builder.attr, this, "attr");
this.attr = ApiTypeHelper.unmodifiable(builder.attr);
this.maxLocalStorageNodes = builder.maxLocalStorageNodes;
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
}
Expand All @@ -84,7 +84,7 @@ public static NodeInfoSettingsNode of(Function<NodeInfoSettingsNode.Builder, Obj
}

/**
* Required - API name: {@code attr}
* API name: {@code attr}
*/
@Nonnull
public final Map<String, JsonData> attr() {
Expand Down Expand Up @@ -118,13 +118,15 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("attr");
generator.writeStartObject();
for (Map.Entry<String, JsonData> item0 : this.attr.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
if (ApiTypeHelper.isDefined(this.attr)) {
generator.writeKey("attr");
generator.writeStartObject();
for (Map.Entry<String, JsonData> item0 : this.attr.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
generator.writeEnd();

if (this.maxLocalStorageNodes != null) {
generator.writeKey("max_local_storage_nodes");
Expand Down Expand Up @@ -152,6 +154,7 @@ public static Builder builder() {
* Builder for {@link NodeInfoSettingsNode}.
*/
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, NodeInfoSettingsNode> {
@Nullable
private Map<String, JsonData> attr;
@Nullable
private String maxLocalStorageNodes;
Expand All @@ -178,7 +181,7 @@ public Builder copy() {
}

/**
* Required - API name: {@code attr}
* API name: {@code attr}
*
* <p>
* Adds all elements of <code>map</code> to <code>attr</code>.
Expand All @@ -191,7 +194,7 @@ public final Builder attr(Map<String, JsonData> map) {
}

/**
* Required - API name: {@code attr}
* API name: {@code attr}
*
* <p>
* Adds an entry to <code>attr</code>.
Expand Down Expand Up @@ -254,7 +257,7 @@ protected static void setupNodeInfoSettingsNodeDeserializer(ObjectDeserializer<N
@Override
public int hashCode() {
int result = 17;
result = 31 * result + this.attr.hashCode();
result = 31 * result + Objects.hashCode(this.attr);
result = 31 * result + Objects.hashCode(this.maxLocalStorageNodes);
result = 31 * result + this.name.hashCode();
return result;
Expand All @@ -265,7 +268,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
NodeInfoSettingsNode other = (NodeInfoSettingsNode) o;
return this.attr.equals(other.attr)
return Objects.equals(this.attr, other.attr)
&& Objects.equals(this.maxLocalStorageNodes, other.maxLocalStorageNodes)
&& this.name.equals(other.name);
}
Expand Down
Loading

0 comments on commit 9daa8fa

Please sign in to comment.