Search in sources :

Example 1 with DeleteEnvironmentOptions

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

the class DiscoveryServiceTest method deleteEnvironmentIsSuccessful.

// Deleted test for createEnvironment with null name as this does not fail in the current SDK
@Test
public void deleteEnvironmentIsSuccessful() throws InterruptedException {
    server.enqueue(jsonResponse(deleteEnvResp));
    DeleteEnvironmentOptions deleteRequest = new DeleteEnvironmentOptions.Builder(environmentId).build();
    discoveryService.deleteEnvironment(deleteRequest).execute();
    RecordedRequest request = server.takeRequest();
    assertEquals(ENV1_PATH, request.getPath());
    assertEquals(DELETE, request.getMethod());
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) DeleteEnvironmentOptions(com.ibm.watson.developer_cloud.discovery.v1.model.DeleteEnvironmentOptions) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Example 2 with DeleteEnvironmentOptions

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

the class DiscoveryServiceIT method deleteEnvironmentIsSuccessful.

@Test
@Ignore("Only 1 BYOD environment allowed per service instance, so do not delete it")
public void deleteEnvironmentIsSuccessful() {
    String environmentName = uniqueName + "-environment";
    CreateEnvironmentOptions createOptions = new CreateEnvironmentOptions.Builder().name(environmentName).size(FREE).build();
    Environment createResponse = createEnvironment(createOptions);
    DeleteEnvironmentOptions deleteOptions = new DeleteEnvironmentOptions.Builder(createResponse.getEnvironmentId()).build();
    deleteEnvironment(deleteOptions);
}
Also used : CreateEnvironmentOptions(com.ibm.watson.developer_cloud.discovery.v1.model.CreateEnvironmentOptions) Environment(com.ibm.watson.developer_cloud.discovery.v1.model.Environment) DeleteEnvironmentOptions(com.ibm.watson.developer_cloud.discovery.v1.model.DeleteEnvironmentOptions) Ignore(org.junit.Ignore) Test(org.junit.Test) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest)

Aggregations

DeleteEnvironmentOptions (com.ibm.watson.developer_cloud.discovery.v1.model.DeleteEnvironmentOptions)2 Test (org.junit.Test)2 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)1 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)1 CreateEnvironmentOptions (com.ibm.watson.developer_cloud.discovery.v1.model.CreateEnvironmentOptions)1 Environment (com.ibm.watson.developer_cloud.discovery.v1.model.Environment)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 Ignore (org.junit.Ignore)1