use of com.ibm.cloud.cloudant.v1.model.SearchInfoResult in project cloudant-java-sdk by IBM.
the class Cloudant method getSearchInfo.
/**
* Retrieve information about a search index.
*
* Retrieve search index metadata information, such as the size of the index on disk.
*
* @param getSearchInfoOptions the {@link GetSearchInfoOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link SearchInfoResult}
*/
public ServiceCall<SearchInfoResult> getSearchInfo(GetSearchInfoOptions getSearchInfoOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getSearchInfoOptions, "getSearchInfoOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", getSearchInfoOptions.db());
pathParamsMap.put("ddoc", getSearchInfoOptions.ddoc());
pathParamsMap.put("index", getSearchInfoOptions.index());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_design/{ddoc}/_search_info/{index}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getSearchInfo");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<SearchInfoResult> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<SearchInfoResult>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.SearchInfoResult in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetSearchInfoWOptions.
@Test
public void testGetSearchInfoWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"name\": \"name\", \"search_index\": {\"committed_seq\": 12, \"disk_size\": 0, \"doc_count\": 0, \"doc_del_count\": 0, \"pending_seq\": 10}}";
String getSearchInfoPath = "/testString/_design/testString/_search_info/testString";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetSearchInfoOptions model
GetSearchInfoOptions getSearchInfoOptionsModel = new GetSearchInfoOptions.Builder().db("testString").ddoc("testString").index("testString").build();
// Invoke operation with valid options model (positive test)
Response<SearchInfoResult> response = cloudantService.getSearchInfo(getSearchInfoOptionsModel).execute();
assertNotNull(response);
SearchInfoResult 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, getSearchInfoPath);
}
use of com.ibm.cloud.cloudant.v1.model.SearchInfoResult in project cloudant-java-sdk by IBM.
the class SearchInfoResultTest method testSearchInfoResult.
@Test
public void testSearchInfoResult() throws Throwable {
SearchInfoResult searchInfoResultModel = new SearchInfoResult();
assertNull(searchInfoResultModel.getName());
assertNull(searchInfoResultModel.getSearchIndex());
}
Aggregations