Search in sources :

Example 6 with DeleteClassifierOptions

use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.DeleteClassifierOptions in project java-sdk by watson-developer-cloud.

the class VisualRecognitionIT method testDeleteAllClassifiers.

/**
 * Delete all the visual classifiers.
 */
@Test
@Ignore
public void testDeleteAllClassifiers() {
    List<Classifier> classifiers = service.listClassifiers(null).execute().getClassifiers();
    for (Classifier classifier : classifiers) {
        if (!classifier.getClassifierId().equals(classifierId)) {
            DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder(classifier.getClassifierId()).build();
            service.deleteClassifier(deleteOptions).execute();
        }
    }
}
Also used : DeleteClassifierOptions(com.ibm.watson.developer_cloud.visual_recognition.v3.model.DeleteClassifierOptions) Classifier(com.ibm.watson.developer_cloud.visual_recognition.v3.model.Classifier) Ignore(org.junit.Ignore) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest) Test(org.junit.Test)

Example 7 with DeleteClassifierOptions

use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.DeleteClassifierOptions in project java-sdk by watson-developer-cloud.

the class VisualRecognitionTest method testDeleteClassifier.

/**
 * Test delete classifier.
 *
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws InterruptedException the interrupted exception
 */
@Test
public void testDeleteClassifier() throws IOException, InterruptedException {
    server.enqueue(new MockResponse().setBody(""));
    String class1 = "class1";
    DeleteClassifierOptions options = new DeleteClassifierOptions.Builder(class1).build();
    service.deleteClassifier(options).execute();
    // first request
    RecordedRequest request = server.takeRequest();
    String path = String.format(PATH_CLASSIFIER + "?" + VERSION_DATE + "=2016-05-20&api_key=" + API_KEY, class1);
    assertEquals(path, request.getPath());
    assertEquals("DELETE", request.getMethod());
}
Also used : DeleteClassifierOptions(com.ibm.watson.developer_cloud.visual_recognition.v3.model.DeleteClassifierOptions) RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)4 DeleteClassifierOptions (com.ibm.watson.developer_cloud.visual_recognition.v3.model.DeleteClassifierOptions)4 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)3 DeleteClassifierOptions (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.DeleteClassifierOptions)3 Classifier (com.ibm.watson.developer_cloud.visual_recognition.v3.model.Classifier)3 Ignore (org.junit.Ignore)3 CreateClassifierOptions (com.ibm.watson.developer_cloud.visual_recognition.v3.model.CreateClassifierOptions)2 GetClassifierOptions (com.ibm.watson.developer_cloud.visual_recognition.v3.model.GetClassifierOptions)2 File (java.io.File)2 Classifier (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.Classifier)1 ClassifiedImages (com.ibm.watson.developer_cloud.visual_recognition.v3.model.ClassifiedImages)1 ClassifyOptions (com.ibm.watson.developer_cloud.visual_recognition.v3.model.ClassifyOptions)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1