use of org.opensearch.common.xcontent.ToXContentFragment in project OpenSearch by opensearch-project.
the class RestHighLevelClientTests method testInfo.
public void testInfo() throws IOException {
MainResponse testInfo = new MainResponse("nodeName", new MainResponse.Version("number", "buildType", "buildHash", "buildDate", true, "luceneVersion", "minimumWireCompatibilityVersion", "minimumIndexCompatibilityVersion"), "clusterName", "clusterUuid");
mockResponse((ToXContentFragment) (builder, params) -> {
// taken from the server side MainResponse
builder.field("name", testInfo.getNodeName());
builder.field("cluster_name", testInfo.getClusterName());
builder.field("cluster_uuid", testInfo.getClusterUuid());
builder.startObject("version").field("number", testInfo.getVersion().getNumber()).field("build_type", testInfo.getVersion().getBuildType()).field("build_hash", testInfo.getVersion().getBuildHash()).field("build_date", testInfo.getVersion().getBuildDate()).field("build_snapshot", testInfo.getVersion().isSnapshot()).field("lucene_version", testInfo.getVersion().getLuceneVersion()).field("minimum_wire_compatibility_version", testInfo.getVersion().getMinimumWireCompatibilityVersion()).field("minimum_index_compatibility_version", testInfo.getVersion().getMinimumIndexCompatibilityVersion()).endObject();
return builder;
});
MainResponse receivedInfo = restHighLevelClient.info(RequestOptions.DEFAULT);
assertEquals(testInfo, receivedInfo);
}
Aggregations