use of com.ibm.cloud.cloudant.v1.model.DbsInfoResult in project cloudant-java-sdk by IBM.
the class CloudantTest method testPostDbsInfoWOptions.
@Test
public void testPostDbsInfoWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "[{\"error\": \"error\", \"info\": {\"cluster\": {\"n\": 1, \"q\": 1, \"r\": 1, \"w\": 1}, \"committed_update_seq\": \"committedUpdateSeq\", \"compact_running\": true, \"compacted_seq\": \"compactedSeq\", \"db_name\": \"dbName\", \"disk_format_version\": 17, \"doc_count\": 0, \"doc_del_count\": 0, \"engine\": \"engine\", \"props\": {\"partitioned\": false}, \"sizes\": {\"active\": 6, \"external\": 8, \"file\": 4}, \"update_seq\": \"updateSeq\", \"uuid\": \"uuid\"}, \"key\": \"key\"}]";
String postDbsInfoPath = "/_dbs_info";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the PostDbsInfoOptions model
PostDbsInfoOptions postDbsInfoOptionsModel = new PostDbsInfoOptions.Builder().keys(new java.util.ArrayList<String>(java.util.Arrays.asList("testString"))).build();
// Invoke operation with valid options model (positive test)
Response<List<DbsInfoResult>> response = cloudantService.postDbsInfo(postDbsInfoOptionsModel).execute();
assertNotNull(response);
List<DbsInfoResult> responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "POST");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, postDbsInfoPath);
}
use of com.ibm.cloud.cloudant.v1.model.DbsInfoResult in project cloudant-java-sdk by IBM.
the class Cloudant method postDbsInfo.
/**
* Query information about multiple databases.
*
* This operation enables you to request information about multiple databases in a single request, instead of issuing
* multiple `GET /{db}` requests. It returns a list that contains an information object for each database specified in
* the request.
*
* @param postDbsInfoOptions the {@link PostDbsInfoOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link List}
*/
public ServiceCall<List<DbsInfoResult>> postDbsInfo(PostDbsInfoOptions postDbsInfoOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(postDbsInfoOptions, "postDbsInfoOptions cannot be null");
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_dbs_info"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "postDbsInfo");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.add("keys", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(postDbsInfoOptions.keys()));
builder.bodyJson(contentJson);
ResponseConverter<List<DbsInfoResult>> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<List<DbsInfoResult>>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.DbsInfoResult in project cloudant-java-sdk by IBM.
the class DbsInfoResultTest method testDbsInfoResult.
@Test
public void testDbsInfoResult() throws Throwable {
DbsInfoResult dbsInfoResultModel = new DbsInfoResult();
assertNull(dbsInfoResultModel.getError());
assertNull(dbsInfoResultModel.getInfo());
assertNull(dbsInfoResultModel.getKey());
}
Aggregations