Search in sources :

Example 1 with GetVoiceModelOptions

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

the class CustomizationsIT method assertModelsEqual.

private void assertModelsEqual(VoiceModel a, VoiceModel b) {
    assertEquals(a.getCustomizationId(), b.getCustomizationId());
    GetVoiceModelOptions getOptionsA = new GetVoiceModelOptions.Builder().customizationId(a.getCustomizationId()).build();
    assertEquals((service.getVoiceModel(getOptionsA).execute()).getName(), b.getName());
    assertEquals((service.getVoiceModel(getOptionsA).execute()).getLanguage(), b.getLanguage());
}
Also used : GetVoiceModelOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions)

Example 2 with GetVoiceModelOptions

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

the class CustomizationsIT method testGetVoiceModelObject.

/**
 * Test get voice model.
 */
@Test
public void testGetVoiceModelObject() {
    model = createVoiceModel();
    GetVoiceModelOptions getOptions = new GetVoiceModelOptions.Builder().customizationId(model.getCustomizationId()).build();
    final VoiceModel model2 = service.getVoiceModel(getOptions).execute();
    assertNotNull(model2);
    assertModelsEqual(model, model2);
    assertNotNull(model2.getOwner());
    assertNotNull(model2.getCreated());
    assertNotNull(model2.getLastModified());
}
Also used : GetVoiceModelOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions) VoiceModel(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest) Test(org.junit.Test)

Example 3 with GetVoiceModelOptions

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

the class CustomizationsTest method testGetVoiceModel.

/**
 * Test get voice model.
 *
 * @throws InterruptedException the interrupted exception
 */
@Test
public void testGetVoiceModel() throws InterruptedException {
    // Test with customization ID
    server.enqueue(jsonResponse(voiceModelWords));
    GetVoiceModelOptions getOptions = new GetVoiceModelOptions.Builder().customizationId(CUSTOMIZATION_ID).build();
    VoiceModel result = service.getVoiceModel(getOptions).execute();
    RecordedRequest request = server.takeRequest();
    assertEquals(String.format(VOICE_MODEL_PATH, CUSTOMIZATION_ID), request.getPath());
    assertEquals("GET", request.getMethod());
    assertEquals(voiceModelWords, result);
    assertNotNull(voiceModelWords.getWords());
    assertEquals(voiceModelWords.getWords(), result.getWords());
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) GetVoiceModelOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions) VoiceModel(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Example 4 with GetVoiceModelOptions

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

the class TextToSpeech method getVoiceModel.

/**
 * Queries the contents of a custom voice model.
 *
 * Lists all information about the custom voice model with the specified `customization_id`. In addition to metadata
 * such as the name and description of the voice model, the output includes the words in the model and their
 * translations as defined in the model. To see just the metadata for a voice model, use the `GET /v1/customizations`
 * method. You must use credentials for the instance of the service that owns a model to list information about it.
 * **Note:** This method is currently a beta release.
 *
 * @param getVoiceModelOptions the {@link GetVoiceModelOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link VoiceModel}
 */
public ServiceCall<VoiceModel> getVoiceModel(GetVoiceModelOptions getVoiceModelOptions) {
    Validator.notNull(getVoiceModelOptions, "getVoiceModelOptions cannot be null");
    String[] pathSegments = { "v1/customizations" };
    String[] pathParameters = { getVoiceModelOptions.customizationId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(VoiceModel.class));
}
Also used : VoiceModel(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel) RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder)

Example 5 with GetVoiceModelOptions

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

the class CustomizationsIT method testGetVoiceModelString.

/**
 * Test get voice model.
 */
@Test
public void testGetVoiceModelString() {
    model = createVoiceModel();
    GetVoiceModelOptions getOptions = new GetVoiceModelOptions.Builder().customizationId(model.getCustomizationId()).build();
    final VoiceModel model2 = service.getVoiceModel(getOptions).execute();
    assertNotNull(model2);
    assertModelsEqual(model, model2);
    assertNotNull(model2.getOwner());
    assertNotNull(model2.getCreated());
    assertNotNull(model2.getLastModified());
}
Also used : GetVoiceModelOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions) VoiceModel(com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest) Test(org.junit.Test)

Aggregations

GetVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions)11 VoiceModel (com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceModel)10 Test (org.junit.Test)10 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)6 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)4 UpdateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.UpdateVoiceModelOptions)4 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)4 CreateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions)3 MockResponse (okhttp3.mockwebserver.MockResponse)2 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1 UnauthorizedException (com.ibm.watson.developer_cloud.service.exception.UnauthorizedException)1 DeleteVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteVoiceModelOptions)1 GetVoiceOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceOptions)1 Voice (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voice)1