diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java index f5f0c682d..541f6048b 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java @@ -30,6 +30,7 @@ import org.opensearch.client.opensearch.cluster.HealthResponse; import org.opensearch.client.opensearch.cluster.PutClusterSettingsRequest; import org.opensearch.client.opensearch.cluster.PutClusterSettingsResponse; +import org.opensearch.client.opensearch.cluster.health.ClusterHealthLevel; import org.opensearch.client.opensearch.cluster.health.IndexHealthStats; import org.opensearch.client.opensearch.cluster.health.ShardHealthStats; import org.opensearch.cluster.routing.allocation.decider.EnableAllocationDecider; @@ -201,7 +202,7 @@ public void testClusterHealthYellowIndicesLevel() throws IOException { } HealthRequest request = new HealthRequest.Builder().index(firstIndex, secondIndex) .timeout(t -> t.time("5s")) - .level(Level.Indices) + .level(ClusterHealthLevel.Indices) .build(); HealthResponse response = openSearchClient.cluster().health(request); assertYellowShards(response); @@ -228,7 +229,7 @@ public void testClusterHealthYellowSpecificIndex() throws IOException { OpenSearchClient openSearchClient = javaClient(); createIndex("index", Settings.EMPTY); createIndex("index2", Settings.EMPTY); - HealthRequest request = new HealthRequest.Builder().index("index").timeout(t -> t.time("5s")).level(Level.Shards).build(); + HealthRequest request = new HealthRequest.Builder().index("index").timeout(t -> t.time("5s")).level(ClusterHealthLevel.Shards).build(); HealthResponse response = openSearchClient.cluster().health(request); assertNotNull(response); @@ -290,7 +291,7 @@ public void testClusterHealthNotFoundIndex() throws IOException { createIndex("index", Settings.EMPTY); HealthRequest request = new HealthRequest.Builder().index("notexisted-index") .timeout(t -> t.time("5s")) - .level(Level.Indices) + .level(ClusterHealthLevel.Indices) .build(); try { HealthResponse response = openSearchClient.cluster().health(request); @@ -310,7 +311,9 @@ public void testClusterStats() throws IOException { ClusterStatsResponse response = openSearchClient.cluster().stats(request); assertNotNull(response); assertNotNull(response.clusterName()); - assertNotEquals(response.nodes().count().total(), 0); - assertNotEquals(response.indices().count(), 0); + assertNotEquals(0, response.nodes().count().total()); + Long indexCount = response.indices().count(); + assertNotNull(indexCount); + assertNotEquals(0, (long) indexCount); } }