use of com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryTest method testDeleteAllTrainingDataWOptions.
// Test the deleteAllTrainingData operation with a valid options model parameter
@Test
public void testDeleteAllTrainingDataWOptions() throws Throwable {
// Register a mock response
String mockResponseBody = "";
String deleteAllTrainingDataPath = "/v1/environments/testString/collections/testString/training_data";
server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody));
// Construct an instance of the DeleteAllTrainingDataOptions model
DeleteAllTrainingDataOptions deleteAllTrainingDataOptionsModel = new DeleteAllTrainingDataOptions.Builder().environmentId("testString").collectionId("testString").build();
// Invoke deleteAllTrainingData() with a valid options model and verify the result
Response<Void> response = discoveryService.deleteAllTrainingData(deleteAllTrainingDataOptionsModel).execute();
assertNotNull(response);
Void responseObj = response.getResult();
assertNull(responseObj);
// Verify the contents of the request sent to the mock server
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "DELETE");
// Verify request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, deleteAllTrainingDataPath);
// Verify query params
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNotNull(query);
assertEquals(query.get("version"), "testString");
}
use of com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method deleteAllCollectionTrainingDataIsSuccessful.
@Test
public void deleteAllCollectionTrainingDataIsSuccessful() throws InterruptedException {
MockResponse desiredResponse = new MockResponse().setResponseCode(204);
server.enqueue(desiredResponse);
DeleteAllTrainingDataOptions deleteRequest = new DeleteAllTrainingDataOptions.Builder(environmentId, collectionId).build();
discoveryService.deleteAllTrainingData(deleteRequest).execute();
RecordedRequest request = server.takeRequest();
assertEquals(TRAINING1_PATH, request.getPath());
assertEquals(DELETE, request.getMethod());
}
use of com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method deleteAllCollectionTrainingDataIsSuccessful.
/**
* Delete all collection training data is successful.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void deleteAllCollectionTrainingDataIsSuccessful() throws InterruptedException {
MockResponse desiredResponse = new MockResponse().setResponseCode(204);
server.enqueue(desiredResponse);
DeleteAllTrainingDataOptions deleteRequest = new DeleteAllTrainingDataOptions.Builder(environmentId, collectionId).build();
discoveryService.deleteAllTrainingData(deleteRequest).execute().getResult();
RecordedRequest request = server.takeRequest();
assertEquals(TRAINING1_PATH, request.getPath());
assertEquals(DELETE, request.getMethod());
}
Aggregations