use of com.ibm.cloud.cloudant.v1.model.PostGeoCleanupOptions in project cloudant-java-sdk by IBM.
the class CloudantTest method testPostGeoCleanupWOptions.
@Test
public void testPostGeoCleanupWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"ok\": true}";
String postGeoCleanupPath = "/testString/_geo_cleanup";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(202).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the PostGeoCleanupOptions model
PostGeoCleanupOptions postGeoCleanupOptionsModel = new PostGeoCleanupOptions.Builder().db("testString").build();
// Invoke operation with valid options model (positive test)
Response<Ok> response = cloudantService.postGeoCleanup(postGeoCleanupOptionsModel).execute();
assertNotNull(response);
Ok 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, postGeoCleanupPath);
}
use of com.ibm.cloud.cloudant.v1.model.PostGeoCleanupOptions in project cloudant-java-sdk by IBM.
the class PostGeoCleanupOptionsTest method testPostGeoCleanupOptions.
@Test
public void testPostGeoCleanupOptions() throws Throwable {
PostGeoCleanupOptions postGeoCleanupOptionsModel = new PostGeoCleanupOptions.Builder().db("testString").build();
assertEquals(postGeoCleanupOptionsModel.db(), "testString");
}
use of com.ibm.cloud.cloudant.v1.model.PostGeoCleanupOptions in project cloudant-java-sdk by IBM.
the class Cloudant method postGeoCleanup.
/**
* Cleanup old geospatial indexes.
*
* Cleanup old geospatial indexes from disk that have been superseded by newer index builds.
*
* @param postGeoCleanupOptions the {@link PostGeoCleanupOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Ok}
*/
public ServiceCall<Ok> postGeoCleanup(PostGeoCleanupOptions postGeoCleanupOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(postGeoCleanupOptions, "postGeoCleanupOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", postGeoCleanupOptions.db());
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_geo_cleanup", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "postGeoCleanup");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<Ok> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Ok>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations