use of com.ibm.watson.text_to_speech.v1.model.DeleteCustomModelOptions in project java-sdk by watson-developer-cloud.
the class TextToSpeechIT method testDeleteCustomPrompts.
/**
* Test deleteCustomPrompts.
*/
@Test
public void testDeleteCustomPrompts() {
try {
CreateCustomModelOptions createCustomModelOptions = new CreateCustomModelOptions.Builder().description("testdescription").name("testname").language(CreateCustomModelOptions.Language.EN_US).build();
CustomModel customModel = service.createCustomModel(createCustomModelOptions).execute().getResult();
customizationId = customModel.getCustomizationId();
PromptMetadata promptMetadata = new PromptMetadata.Builder().promptText("promptText").build();
File file = new File(RESOURCE + "numbers.wav");
AddCustomPromptOptions addCustomPromptOptions = new AddCustomPromptOptions.Builder().customizationId(customizationId).promptId("testId").metadata(promptMetadata).file(file).build();
Prompt prompt = service.addCustomPrompt(addCustomPromptOptions).execute().getResult();
assertNotNull(prompt.getStatus());
DeleteCustomPromptOptions deleteCustomPromptOptions = new DeleteCustomPromptOptions.Builder().customizationId(customizationId).promptId(prompt.getPromptId()).build();
service.deleteCustomPrompt(deleteCustomPromptOptions).execute().getResult();
} catch (Exception e) {
e.printStackTrace();
} finally {
DeleteCustomModelOptions deleteCustomModelOptions = new DeleteCustomModelOptions.Builder().customizationId(customizationId).build();
service.deleteCustomModel(deleteCustomModelOptions).execute().getResult();
}
}
Aggregations