Search in sources :

Example 1 with TTSServiceStub

use of org.eclipse.smarthome.core.voice.internal.TTSServiceStub in project smarthome by eclipse.

the class VoiceManagerTest method setUp.

@Before
public void setUp() throws IOException {
    voiceManager = getService(VoiceManager.class, VoiceManagerImpl.class);
    assertNotNull(voiceManager);
    BundleContext context = bundleContext;
    ttsService = new TTSServiceStub(context);
    sink = new SinkStub();
    voice = new VoiceStub();
    source = new AudioSourceStub();
    registerService(sink);
    registerService(voice);
    Dictionary<String, Object> voiceConfig = new Hashtable<String, Object>();
    voiceConfig.put(CONFIG_DEFAULT_TTS, ttsService.getId());
    ConfigurationAdmin configAdmin = super.getService(ConfigurationAdmin.class);
    Configuration configuration = configAdmin.getConfiguration(PID);
    configuration.update(voiceConfig);
    audioManager = new AudioManagerStub();
    registerService(audioManager);
}
Also used : VoiceManagerImpl(org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl) Configuration(org.osgi.service.cm.Configuration) TTSServiceStub(org.eclipse.smarthome.core.voice.internal.TTSServiceStub) AudioSourceStub(org.eclipse.smarthome.core.voice.internal.AudioSourceStub) Hashtable(java.util.Hashtable) SinkStub(org.eclipse.smarthome.core.voice.internal.SinkStub) VoiceStub(org.eclipse.smarthome.core.voice.internal.VoiceStub) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) AudioManagerStub(org.eclipse.smarthome.core.voice.internal.AudioManagerStub) VoiceManager(org.eclipse.smarthome.core.voice.VoiceManager) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Example 2 with TTSServiceStub

use of org.eclipse.smarthome.core.voice.internal.TTSServiceStub in project smarthome by eclipse.

the class VoiceManagerTest method getParameterOptionsForTheDefaultVoice.

@Test
public void getParameterOptionsForTheDefaultVoice() throws URISyntaxException {
    BundleContext context = bundleContext;
    ttsService = new TTSServiceStub(context);
    registerService(ttsService);
    boolean isVoiceStubInTheOptions = false;
    Collection<ParameterOption> options = voiceManager.getParameterOptions(new URI("system:voice"), "defaultVoice", null);
    assertNotNull(options);
    for (ParameterOption option : options) {
        String optionValue = option.getValue();
        String optionLabel = option.getLabel();
        String voiceStubId = voice.getUID();
        String voiceLabel = voice.getLabel();
        if (optionValue.equals(voiceStubId) && optionLabel.equals(voiceLabel + " - " + voice.getLocale().getDisplayName())) {
            isVoiceStubInTheOptions = true;
        }
    }
    assertTrue(isVoiceStubInTheOptions);
}
Also used : TTSServiceStub(org.eclipse.smarthome.core.voice.internal.TTSServiceStub) ParameterOption(org.eclipse.smarthome.config.core.ParameterOption) URI(java.net.URI) BundleContext(org.osgi.framework.BundleContext) JavaOSGiTest(org.eclipse.smarthome.test.java.JavaOSGiTest) Test(org.junit.Test)

Example 3 with TTSServiceStub

use of org.eclipse.smarthome.core.voice.internal.TTSServiceStub in project smarthome by eclipse.

the class InterpretCommandTest method setUp.

@Before
public void setUp() throws IOException, InterruptedException {
    ttsService = new TTSServiceStub();
    hliStub = new HumanLanguageInterpreterStub();
    voice = new VoiceStub();
    registerService(voice);
    registerService(hliStub);
    registerService(ttsService);
    Dictionary<String, Object> config = new Hashtable<String, Object>();
    config.put(CONFIG_DEFAULT_TTS, ttsService.getId());
    config.put(CONFIG_DEFAULT_HLI, hliStub.getId());
    config.put(CONFIG_DEFAULT_VOICE, voice.getUID());
    ConfigurationAdmin configAdmin = super.getService(ConfigurationAdmin.class);
    String pid = "org.eclipse.smarthome.voice";
    Configuration configuration = configAdmin.getConfiguration(pid);
    configuration.update(config);
}
Also used : VoiceStub(org.eclipse.smarthome.core.voice.internal.VoiceStub) Configuration(org.osgi.service.cm.Configuration) TTSServiceStub(org.eclipse.smarthome.core.voice.internal.TTSServiceStub) Hashtable(java.util.Hashtable) HumanLanguageInterpreterStub(org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) Before(org.junit.Before)

Example 4 with TTSServiceStub

use of org.eclipse.smarthome.core.voice.internal.TTSServiceStub in project smarthome by eclipse.

the class SayCommandTest method setUp.

@Before
public void setUp() {
    sink = new SinkStub();
    voice = new VoiceStub();
    BundleContext context = bundleContext;
    ttsService = new TTSServiceStub(context);
    registerService(sink);
    registerService(voice);
}
Also used : SinkStub(org.eclipse.smarthome.core.voice.internal.SinkStub) VoiceStub(org.eclipse.smarthome.core.voice.internal.VoiceStub) TTSServiceStub(org.eclipse.smarthome.core.voice.internal.TTSServiceStub) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Example 5 with TTSServiceStub

use of org.eclipse.smarthome.core.voice.internal.TTSServiceStub in project smarthome by eclipse.

the class VoiceManagerTest method getParameterOptionsForTheDefaultTts.

@Test
public void getParameterOptionsForTheDefaultTts() throws URISyntaxException {
    ttsService = new TTSServiceStub();
    registerService(ttsService);
    boolean isTTSStubInTheOptions = false;
    Collection<ParameterOption> options = voiceManager.getParameterOptions(new URI("system:voice"), "defaultTTS", null);
    assertNotNull(options);
    for (ParameterOption option : options) {
        String optionValue = option.getValue();
        String optionLabel = option.getLabel();
        String ttsStubId = ttsService.getId();
        String ttsLabel = ttsService.getLabel(null);
        if (optionValue.equals(ttsStubId) && optionLabel.equals(ttsLabel)) {
            isTTSStubInTheOptions = true;
        }
    }
    assertTrue(isTTSStubInTheOptions);
}
Also used : TTSServiceStub(org.eclipse.smarthome.core.voice.internal.TTSServiceStub) ParameterOption(org.eclipse.smarthome.config.core.ParameterOption) URI(java.net.URI) JavaOSGiTest(org.eclipse.smarthome.test.java.JavaOSGiTest) Test(org.junit.Test)

Aggregations

TTSServiceStub (org.eclipse.smarthome.core.voice.internal.TTSServiceStub)9 JavaOSGiTest (org.eclipse.smarthome.test.java.JavaOSGiTest)5 Test (org.junit.Test)5 AudioSourceStub (org.eclipse.smarthome.core.voice.internal.AudioSourceStub)4 HumanLanguageInterpreterStub (org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub)4 VoiceStub (org.eclipse.smarthome.core.voice.internal.VoiceStub)4 Before (org.junit.Before)4 BundleContext (org.osgi.framework.BundleContext)4 Hashtable (java.util.Hashtable)3 KSServiceStub (org.eclipse.smarthome.core.voice.internal.KSServiceStub)3 STTServiceStub (org.eclipse.smarthome.core.voice.internal.STTServiceStub)3 SinkStub (org.eclipse.smarthome.core.voice.internal.SinkStub)3 Configuration (org.osgi.service.cm.Configuration)3 ConfigurationAdmin (org.osgi.service.cm.ConfigurationAdmin)3 URI (java.net.URI)2 ParameterOption (org.eclipse.smarthome.config.core.ParameterOption)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 VoiceManager (org.eclipse.smarthome.core.voice.VoiceManager)1 AudioManagerStub (org.eclipse.smarthome.core.voice.internal.AudioManagerStub)1