use of com.ibm.cloud.cloudant.v1.model.DesignDocumentInformation in project cloudant-java-sdk by IBM.
the class DesignDocumentInformationTest method testDesignDocumentInformation.
@Test
public void testDesignDocumentInformation() throws Throwable {
DesignDocumentInformation designDocumentInformationModel = new DesignDocumentInformation();
assertNull(designDocumentInformationModel.getName());
assertNull(designDocumentInformationModel.getViewIndex());
}
use of com.ibm.cloud.cloudant.v1.model.DesignDocumentInformation in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetDesignDocumentInformationWOptions.
@Test
public void testGetDesignDocumentInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"name\": \"name\", \"view_index\": {\"compact_running\": true, \"language\": \"language\", \"signature\": \"signature\", \"sizes\": {\"active\": 6, \"external\": 8, \"file\": 4}, \"updater_running\": true, \"waiting_clients\": 0, \"waiting_commit\": false}}";
String getDesignDocumentInformationPath = "/testString/_design/testString/_info";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetDesignDocumentInformationOptions model
GetDesignDocumentInformationOptions getDesignDocumentInformationOptionsModel = new GetDesignDocumentInformationOptions.Builder().db("testString").ddoc("testString").build();
// Invoke operation with valid options model (positive test)
Response<DesignDocumentInformation> response = cloudantService.getDesignDocumentInformation(getDesignDocumentInformationOptionsModel).execute();
assertNotNull(response);
DesignDocumentInformation 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, getDesignDocumentInformationPath);
}
use of com.ibm.cloud.cloudant.v1.model.DesignDocumentInformation in project cloudant-java-sdk by IBM.
the class Cloudant method getDesignDocumentInformation.
/**
* Retrieve information about a design document.
*
* Retrieves information about the specified design document, including the index, index size, and current status of
* the design document and associated index information.
*
* @param getDesignDocumentInformationOptions the {@link GetDesignDocumentInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link DesignDocumentInformation}
*/
public ServiceCall<DesignDocumentInformation> getDesignDocumentInformation(GetDesignDocumentInformationOptions getDesignDocumentInformationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getDesignDocumentInformationOptions, "getDesignDocumentInformationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", getDesignDocumentInformationOptions.db());
pathParamsMap.put("ddoc", getDesignDocumentInformationOptions.ddoc());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_design/{ddoc}/_info", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getDesignDocumentInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<DesignDocumentInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<DesignDocumentInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations