use of com.ibm.cloud.cloudant.v1.model.GetUpInformationOptions in project cloudant-java-sdk by IBM.
the class GetUpInformationOptionsTest method testGetUpInformationOptions.
@Test
public void testGetUpInformationOptions() throws Throwable {
GetUpInformationOptions getUpInformationOptionsModel = new GetUpInformationOptions();
assertNotNull(getUpInformationOptionsModel);
}
use of com.ibm.cloud.cloudant.v1.model.GetUpInformationOptions in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetUpInformationWOptions.
@Test
public void testGetUpInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"seeds\": {\"mapKey\": \"anyValue\"}, \"status\": \"maintenance_mode\"}";
String getUpInformationPath = "/_up";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetUpInformationOptions model
GetUpInformationOptions getUpInformationOptionsModel = new GetUpInformationOptions();
// Invoke operation with valid options model (positive test)
Response<UpInformation> response = cloudantService.getUpInformation(getUpInformationOptionsModel).execute();
assertNotNull(response);
UpInformation 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, getUpInformationPath);
}
use of com.ibm.cloud.cloudant.v1.model.GetUpInformationOptions in project cloudant-java-sdk by IBM.
the class Cloudant method getUpInformation.
/**
* Retrieve information about whether the server is up.
*
* Confirms that the server is up, running, and ready to respond to requests. If `maintenance_mode` is `true` or
* `nolb`, the endpoint returns a 404 response.
*
* @param getUpInformationOptions the {@link GetUpInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link UpInformation}
*/
public ServiceCall<UpInformation> getUpInformation(GetUpInformationOptions getUpInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_up"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getUpInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<UpInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<UpInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations