use of com.ibm.cloud.cloudant.v1.model.GeoIndexInformation in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetGeoIndexInformationWOptions.
@Test
public void testGetGeoIndexInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"geo_index\": {\"data_size\": 0, \"disk_size\": 0, \"doc_count\": 0}, \"name\": \"name\"}";
String getGeoIndexInformationPath = "/testString/_design/testString/_geo_info/testString";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetGeoIndexInformationOptions model
GetGeoIndexInformationOptions getGeoIndexInformationOptionsModel = new GetGeoIndexInformationOptions.Builder().db("testString").ddoc("testString").index("testString").build();
// Invoke operation with valid options model (positive test)
Response<GeoIndexInformation> response = cloudantService.getGeoIndexInformation(getGeoIndexInformationOptionsModel).execute();
assertNotNull(response);
GeoIndexInformation 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, getGeoIndexInformationPath);
}
use of com.ibm.cloud.cloudant.v1.model.GeoIndexInformation in project cloudant-java-sdk by IBM.
the class Cloudant method getGeoIndexInformation.
/**
* Retrieve information about a geospatial index.
*
* @param getGeoIndexInformationOptions the {@link GetGeoIndexInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link GeoIndexInformation}
*/
public ServiceCall<GeoIndexInformation> getGeoIndexInformation(GetGeoIndexInformationOptions getGeoIndexInformationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getGeoIndexInformationOptions, "getGeoIndexInformationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", getGeoIndexInformationOptions.db());
pathParamsMap.put("ddoc", getGeoIndexInformationOptions.ddoc());
pathParamsMap.put("index", getGeoIndexInformationOptions.index());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_design/{ddoc}/_geo_info/{index}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getGeoIndexInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<GeoIndexInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<GeoIndexInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.GeoIndexInformation in project cloudant-java-sdk by IBM.
the class GeoIndexInformationTest method testGeoIndexInformation.
@Test
public void testGeoIndexInformation() throws Throwable {
GeoIndexInformation geoIndexInformationModel = new GeoIndexInformation();
assertNull(geoIndexInformationModel.getGeoIndex());
assertNull(geoIndexInformationModel.getName());
}
Aggregations