use of com.ibm.watson.text_to_speech.v1.model.DeleteSpeakerModelOptions in project java-sdk by watson-developer-cloud.
the class TextToSpeechIT method testGetSpeakerModel.
/**
* Test getSpeakerModel.
*/
@Test
public void testGetSpeakerModel() {
try {
CreateSpeakerModelOptions createSpeakerModelOptions = new CreateSpeakerModelOptions.Builder().speakerName("speakerName").audio(new File(RESOURCE + "numbers.wav")).build();
SpeakerModel speakerModel = service.createSpeakerModel(createSpeakerModelOptions).execute().getResult();
speakerId = speakerModel.getSpeakerId();
assertNotNull(speakerModel.getSpeakerId());
GetSpeakerModelOptions getSpeakerModelOptions = new GetSpeakerModelOptions.Builder().speakerId(speakerId).build();
SpeakerCustomModels speakerCustomModels = service.getSpeakerModel(getSpeakerModelOptions).execute().getResult();
assertNotNull(speakerCustomModels.getCustomizations());
} catch (Exception e) {
e.printStackTrace();
} finally {
DeleteSpeakerModelOptions deleteSpeakerModelOptions = new DeleteSpeakerModelOptions.Builder().speakerId(speakerId).build();
service.deleteSpeakerModel(deleteSpeakerModelOptions).execute().getResult();
}
}
use of com.ibm.watson.text_to_speech.v1.model.DeleteSpeakerModelOptions in project java-sdk by watson-developer-cloud.
the class TextToSpeechIT method testCreateSpeakerModel.
/**
* Test createSpeakerModel.
*/
@Test
public void testCreateSpeakerModel() {
try {
CreateSpeakerModelOptions createSpeakerModelOptions = new CreateSpeakerModelOptions.Builder().speakerName("speakerName").audio(new File(RESOURCE + "numbers.wav")).build();
SpeakerModel speakerModel = service.createSpeakerModel(createSpeakerModelOptions).execute().getResult();
speakerId = speakerModel.getSpeakerId();
assertNotNull(speakerModel.getSpeakerId());
} catch (Exception e) {
e.printStackTrace();
} finally {
DeleteSpeakerModelOptions deleteSpeakerModelOptions = new DeleteSpeakerModelOptions.Builder().speakerId(speakerId).build();
service.deleteSpeakerModel(deleteSpeakerModelOptions).execute().getResult();
}
}
use of com.ibm.watson.text_to_speech.v1.model.DeleteSpeakerModelOptions in project java-sdk by watson-developer-cloud.
the class TextToSpeechTest method testDeleteSpeakerModelWOptions.
// Test the deleteSpeakerModel operation with a valid options model parameter
@Test
public void testDeleteSpeakerModelWOptions() throws Throwable {
// Register a mock response
String mockResponseBody = "";
String deleteSpeakerModelPath = "/v1/speakers/testString";
server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody));
// Construct an instance of the DeleteSpeakerModelOptions model
DeleteSpeakerModelOptions deleteSpeakerModelOptionsModel = new DeleteSpeakerModelOptions.Builder().speakerId("testString").build();
// Invoke deleteSpeakerModel() with a valid options model and verify the result
Response<Void> response = textToSpeechService.deleteSpeakerModel(deleteSpeakerModelOptionsModel).execute();
assertNotNull(response);
Void responseObj = response.getResult();
assertNull(responseObj);
// Verify the contents of the request sent to the mock server
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "DELETE");
// Verify request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, deleteSpeakerModelPath);
// Verify that there is no query string
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
}
use of com.ibm.watson.text_to_speech.v1.model.DeleteSpeakerModelOptions in project java-sdk by watson-developer-cloud.
the class TextToSpeechIT method testListSpeakerModel.
/**
* Test listSpeakerModel.
*/
@Test
public void testListSpeakerModel() {
try {
CreateSpeakerModelOptions createSpeakerModelOptions = new CreateSpeakerModelOptions.Builder().speakerName("speakerName").audio(new File(RESOURCE + "numbers.wav")).build();
SpeakerModel speakerModel = service.createSpeakerModel(createSpeakerModelOptions).execute().getResult();
speakerId = speakerModel.getSpeakerId();
assertNotNull(speakerModel.getSpeakerId());
Speakers speakers = service.listSpeakerModels().execute().getResult();
assertNotNull(speakers.getSpeakers());
assertTrue(speakers.getSpeakers().size() > 0);
} catch (Exception e) {
e.printStackTrace();
} finally {
DeleteSpeakerModelOptions deleteSpeakerModelOptions = new DeleteSpeakerModelOptions.Builder().speakerId(speakerId).build();
service.deleteSpeakerModel(deleteSpeakerModelOptions).execute().getResult();
}
}
Aggregations