use of com.ibm.watson.discovery.v1.model.Environment in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method getEnvironmentIsSuccessful.
// Environment tests
@Test
public void getEnvironmentIsSuccessful() throws InterruptedException {
server.enqueue(jsonResponse(envResp));
GetEnvironmentOptions getRequest = new GetEnvironmentOptions.Builder(environmentId).build();
Environment response = discoveryService.getEnvironment(getRequest).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(ENV1_PATH, request.getPath());
assertEquals(GET, request.getMethod());
assertEquals(envResp, response);
}
use of com.ibm.watson.discovery.v1.model.Environment in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method getEnvironmentFails1.
@Test(expected = IllegalArgumentException.class)
public void getEnvironmentFails1() {
GetEnvironmentOptions getRequest = new GetEnvironmentOptions.Builder().build();
@SuppressWarnings("unused") Environment response = discoveryService.getEnvironment(getRequest).execute();
}
use of com.ibm.watson.discovery.v1.model.Environment in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method createEnvironmentIsSuccessful.
@Test
@Ignore("Only 1 BYOD environment allowed per service instance, so we cannot create more")
public void createEnvironmentIsSuccessful() {
String environmentName = uniqueName + "-environment";
CreateEnvironmentOptions createOptions = new CreateEnvironmentOptions.Builder().name(environmentName).size(FREE).build();
Environment createResponse = createEnvironment(createOptions);
assertEquals(environmentName, createResponse.getName());
}
use of com.ibm.watson.discovery.v1.model.Environment 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);
}
use of com.ibm.watson.discovery.v1.model.Environment in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method updateEnvironmentIsSuccessful.
@Test
@Ignore("Only 1 BYOD environment allowed per service instance, so we cannot create more")
public void updateEnvironmentIsSuccessful() {
String environmentName = uniqueName + "-environment";
CreateEnvironmentOptions createOptions = new CreateEnvironmentOptions.Builder().name(environmentName).size(FREE).build();
Environment createResponse = createEnvironment(createOptions);
String randomDescription = UUID.randomUUID().toString() + " appbuilder tests";
UpdateEnvironmentOptions.Builder updateBuilder = new UpdateEnvironmentOptions.Builder(createResponse.getEnvironmentId()).name(environmentName);
updateBuilder.description(randomDescription);
Environment updateResponse = discovery.updateEnvironment(updateBuilder.build()).execute();
assertEquals(randomDescription, updateResponse.getDescription());
}
Aggregations