Skip to content

Commit

Permalink
applied formatting with gradlew.bat
Browse files Browse the repository at this point in the history
Signed-off-by: oksanay <[email protected]>
  • Loading branch information
oksanay committed Apr 30, 2024
1 parent 3d98bfa commit 22f1e80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;

import javax.annotation.Nullable;

import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -46,8 +45,6 @@
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;

import jakarta.json.stream.JsonGenerator;

// typedef: _types.QueryCacheStats

@JsonpDeserializable
Expand Down Expand Up @@ -192,13 +189,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<QueryCacheStats> {
private Long cacheCount;
private Long cacheCount;

private Long cacheSize;
private Long cacheSize;

private Long evictions;
private Long evictions;

private Long hitCount;
private Long hitCount;

@Nullable
private String memorySize;
Expand Down Expand Up @@ -299,10 +296,10 @@ public QueryCacheStats build() {

protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer<QueryCacheStats.Builder> op) {

op.add(Builder::cacheCount, JsonpDeserializer.longDeserializer(), "cache_count");
op.add(Builder::cacheSize, JsonpDeserializer.longDeserializer(), "cache_size");
op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions");
op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count");
op.add(Builder::cacheCount, JsonpDeserializer.longDeserializer(), "cache_count");
op.add(Builder::cacheSize, JsonpDeserializer.longDeserializer(), "cache_size");
op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions");
op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count");
op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size");
op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes");
op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@

import static org.junit.Assert.assertEquals;

import jakarta.json.stream.JsonParser;
import java.io.StringReader;

import org.junit.Test;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;

import jakarta.json.stream.JsonParser;

public class QueryCacheStatsTest {

@Test
@Test
public void testLongSerailization() {
QueryCacheStats expected = new QueryCacheStats.Builder().cacheCount(8757938874l)
.cacheSize(8757938874l)
.evictions(8757938874l)
.hitCount(8757938874l)
.memorySizeInBytes(8757938874l)
.missCount(8757938874l)
.totalCount(8757938874l)
.build();

String jsonString = "{\"cache_count\": 8757938874, \"cache_size\": 8757938874, \"evictions\":" +
" 8757938874, \"hit_count\": 8757938874, \"memory_size_in_bytes\": 8757938874, \"miss_count\":" +
" 8757938874, \"total_count\": 8757938874}";
.cacheSize(8757938874l)
.evictions(8757938874l)
.hitCount(8757938874l)
.memorySizeInBytes(8757938874l)
.missCount(8757938874l)
.totalCount(8757938874l)
.build();

String jsonString = "{\"cache_count\": 8757938874, \"cache_size\": 8757938874, \"evictions\":"
+ " 8757938874, \"hit_count\": 8757938874, \"memory_size_in_bytes\": 8757938874, \"miss_count\":"
+ " 8757938874, \"total_count\": 8757938874}";

StringReader reader = new StringReader(jsonString);
JacksonJsonpMapper mapper = new JacksonJsonpMapper();
Expand All @@ -37,5 +35,5 @@ public void testLongSerailization() {
assertEquals(expected.totalCount(), actual.totalCount());
assertEquals(expected.cacheSize(), actual.cacheSize());
assertEquals(expected.evictions(), actual.evictions());
}
}
}

0 comments on commit 22f1e80

Please sign in to comment.