use of com.ibm.watson.developer_cloud.discovery.v1.model.GetConfigurationOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method getConfigurationIsSuccessful.
@Test
public void getConfigurationIsSuccessful() {
Configuration createResponse = createTestConfig();
GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse.getConfigurationId()).build();
Configuration getResponse = discovery.getConfiguration(getOptions).execute();
assertEquals(createResponse.getName(), getResponse.getName());
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.GetConfigurationOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceTest method getConfigurationIsSuccessful.
@Test
public void getConfigurationIsSuccessful() throws InterruptedException {
server.enqueue(jsonResponse(getConfResp));
GetConfigurationOptions getRequest = new GetConfigurationOptions.Builder(environmentId, configurationId).build();
Configuration response = discoveryService.getConfiguration(getRequest).execute();
RecordedRequest request = server.takeRequest();
assertEquals(CONF2_PATH, request.getPath());
assertEquals(GET, request.getMethod());
assertEquals(getConfResp, response);
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.GetConfigurationOptions in project java-sdk by watson-developer-cloud.
the class Discovery method getConfiguration.
/**
* Get configuration details.
*
* @param getConfigurationOptions the {@link GetConfigurationOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Configuration}
*/
public ServiceCall<Configuration> getConfiguration(GetConfigurationOptions getConfigurationOptions) {
Validator.notNull(getConfigurationOptions, "getConfigurationOptions cannot be null");
String[] pathSegments = { "v1/environments", "configurations" };
String[] pathParameters = { getConfigurationOptions.environmentId(), getConfigurationOptions.configurationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
builder.query(VERSION, versionDate);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Configuration.class));
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.GetConfigurationOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method issueNumber518.
@Test
public void issueNumber518() {
String[] operations = new String[] { Operation.MOVE, Operation.COPY, Operation.MERGE, Operation.REMOVE, Operation.REMOVE_NULLS };
String uniqueConfigName = uniqueName + "-config";
CreateConfigurationOptions.Builder createBuilder = new CreateConfigurationOptions.Builder(environmentId);
Configuration configuration = getTestConfiguration(DISCOVERY2_TEST_CONFIG_FILE);
configuration.setName(uniqueConfigName);
createBuilder.configuration(configuration);
Configuration createResponse = createConfiguration(createBuilder.build());
GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse.getConfigurationId()).build();
Configuration getResponse = discovery.getConfiguration(getOptions).execute();
// verify getResponse deserializes the operations appropriately
for (NormalizationOperation normalization : getResponse.getNormalizations()) {
String operation = normalization.getOperation();
assertEquals(true, Arrays.asList(operations).contains(operation));
}
}
use of com.ibm.watson.developer_cloud.discovery.v1.model.GetConfigurationOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method issueNumber517.
// Tests for reported issues
@Test
public void issueNumber517() {
String uniqueConfigName = uniqueName + "-config";
CreateConfigurationOptions.Builder createBuilder = new CreateConfigurationOptions.Builder(environmentId);
Configuration configuration = getTestConfiguration(DISCOVERY1_TEST_CONFIG_FILE);
configuration.setName(uniqueConfigName);
createBuilder.configuration(configuration);
Configuration createResponse = createConfiguration(createBuilder.build());
GetConfigurationOptions getOptions = new GetConfigurationOptions.Builder(environmentId, createResponse.getConfigurationId()).build();
Configuration getResponse = discovery.getConfiguration(getOptions).execute();
// returned config should have some json data
assertEquals(1, getResponse.getConversions().getJsonNormalizations().size());
}
Aggregations