Search in sources :

Example 1 with NodesResponse

use of org.opensearch.client.opensearch.cat.NodesResponse in project opensearch-java by opensearch-project.

the class RequestTest method testCatRequest.

@Test
public void testCatRequest() throws IOException {
    // Cat requests should have the "format=json" added by the transport
    NodesResponse nodes = highLevelClient().cat().nodes(_0 -> _0);
    System.out.println(ModelTestCase.toJson(nodes, highLevelClient()._transport().jsonpMapper()));
    assertEquals(1, nodes.valueBody().size());
    assertEquals("*", nodes.valueBody().get(0).master());
}
Also used : NodesResponse(org.opensearch.client.opensearch.cat.NodesResponse) Test(org.junit.Test)

Example 2 with NodesResponse

use of org.opensearch.client.opensearch.cat.NodesResponse in project opensearch-java by opensearch-project.

the class SerializationTest method testArrayValueBody.

@Test
public void testArrayValueBody() {
    NodesResponse nr = NodesResponse.of(_0 -> _0.valueBody(_1 -> _1.bulkTotalOperations("1")).valueBody(_1 -> _1.bulkTotalOperations("2")));
    checkJsonRoundtrip(nr, "[{\"bulk.total_operations\":\"1\"},{\"bulk.total_operations\":\"2\"}]");
    assertEquals(2, nr.valueBody().size());
    assertEquals("1", nr.valueBody().get(0).bulkTotalOperations());
    assertEquals("2", nr.valueBody().get(1).bulkTotalOperations());
}
Also used : ClassGraph(io.github.classgraph.ClassGraph) JsonParser(jakarta.json.stream.JsonParser) JsonParsingException(jakarta.json.stream.JsonParsingException) ClassInfo(io.github.classgraph.ClassInfo) JsonValue(jakarta.json.JsonValue) JsonpDeserializable(org.opensearch.client.json.JsonpDeserializable) Test(org.junit.Test) JsonpUtils(org.opensearch.client.json.JsonpUtils) ClassInfoList(io.github.classgraph.ClassInfoList) Json(jakarta.json.Json) NodesResponse(org.opensearch.client.opensearch.cat.NodesResponse) StringReader(java.io.StringReader) JsonpDeserializer(org.opensearch.client.json.JsonpDeserializer) JsonpMapperBase(org.opensearch.client.json.JsonpMapperBase) GetSourceResponse(org.opensearch.client.opensearch.core.GetSourceResponse) ScanResult(io.github.classgraph.ScanResult) NodesResponse(org.opensearch.client.opensearch.cat.NodesResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 NodesResponse (org.opensearch.client.opensearch.cat.NodesResponse)2 ClassGraph (io.github.classgraph.ClassGraph)1 ClassInfo (io.github.classgraph.ClassInfo)1 ClassInfoList (io.github.classgraph.ClassInfoList)1 ScanResult (io.github.classgraph.ScanResult)1 Json (jakarta.json.Json)1 JsonValue (jakarta.json.JsonValue)1 JsonParser (jakarta.json.stream.JsonParser)1 JsonParsingException (jakarta.json.stream.JsonParsingException)1 StringReader (java.io.StringReader)1 JsonpDeserializable (org.opensearch.client.json.JsonpDeserializable)1 JsonpDeserializer (org.opensearch.client.json.JsonpDeserializer)1 JsonpMapperBase (org.opensearch.client.json.JsonpMapperBase)1 JsonpUtils (org.opensearch.client.json.JsonpUtils)1 GetSourceResponse (org.opensearch.client.opensearch.core.GetSourceResponse)1