use of com.ibm.cloud.cloudant.v1.model.GetMembershipInformationOptions in project cloudant-java-sdk by IBM.
the class Cloudant method getMembershipInformation.
/**
* Retrieve cluster membership information.
*
* Displays the nodes that are part of the cluster as `cluster_nodes`. The field, `all_nodes`, displays all nodes this
* node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a
* cluster.
*
* @param getMembershipInformationOptions the {@link GetMembershipInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link MembershipInformation}
*/
public ServiceCall<MembershipInformation> getMembershipInformation(GetMembershipInformationOptions getMembershipInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_membership"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getMembershipInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<MembershipInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<MembershipInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.GetMembershipInformationOptions in project cloudant-java-sdk by IBM.
the class GetMembershipInformationOptionsTest method testGetMembershipInformationOptions.
@Test
public void testGetMembershipInformationOptions() throws Throwable {
GetMembershipInformationOptions getMembershipInformationOptionsModel = new GetMembershipInformationOptions();
assertNotNull(getMembershipInformationOptionsModel);
}
use of com.ibm.cloud.cloudant.v1.model.GetMembershipInformationOptions in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetMembershipInformationWOptions.
@Test
public void testGetMembershipInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"all_nodes\": [\"allNodes\"], \"cluster_nodes\": [\"clusterNodes\"]}";
String getMembershipInformationPath = "/_membership";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetMembershipInformationOptions model
GetMembershipInformationOptions getMembershipInformationOptionsModel = new GetMembershipInformationOptions();
// Invoke operation with valid options model (positive test)
Response<MembershipInformation> response = cloudantService.getMembershipInformation(getMembershipInformationOptionsModel).execute();
assertNotNull(response);
MembershipInformation responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "GET");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, getMembershipInformationPath);
}
Aggregations