use of org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub in project smarthome by eclipse.
the class VoiceManagerTest method interpretSomethingWhenTheDefaultHliIsSetAndItIsARegisteredService.
@Test
public void interpretSomethingWhenTheDefaultHliIsSetAndItIsARegisteredService() throws IOException, InterpretationException {
stubConsole = new ConsoleStub();
hliStub = new HumanLanguageInterpreterStub();
registerService(hliStub);
Dictionary<String, Object> voiceConfig = new Hashtable<String, Object>();
voiceConfig.put("defaultHLI", hliStub.getId());
ConfigurationAdmin configAdmin = super.getService(ConfigurationAdmin.class);
String pid = "org.eclipse.smarthome.voice";
Configuration configuration = configAdmin.getConfiguration(pid);
configuration.update(voiceConfig);
String result = voiceManager.interpret("something", hliStub.getId());
assertThat(result, is("Interpreted text"));
}
use of org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub in project smarthome by eclipse.
the class VoiceManagerTest method verifyThatADialogIsNotStartedWhenAnyOfTheRequiredServiceIsNull.
@Test
public void verifyThatADialogIsNotStartedWhenAnyOfTheRequiredServiceIsNull() {
sttService = new STTServiceStub();
ksService = new KSServiceStub();
ttsService = null;
hliStub = new HumanLanguageInterpreterStub();
source = new AudioSourceStub();
exception.expect(IllegalStateException.class);
voiceManager.startDialog(ksService, sttService, ttsService, hliStub, source, sink, Locale.getDefault(), "word", null);
assertFalse(ksService.isWordSpotted());
}
use of org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub in project smarthome by eclipse.
the class VoiceManagerTest method getParameterOptionsForTheDefaultHli.
@Test
public void getParameterOptionsForTheDefaultHli() throws URISyntaxException {
hliStub = new HumanLanguageInterpreterStub();
registerService(hliStub);
boolean isHliStubInTheOptions = false;
Collection<ParameterOption> options = voiceManager.getParameterOptions(new URI("system:voice"), "defaultHLI", null);
assertNotNull(options);
for (ParameterOption option : options) {
String optionValue = option.getValue();
String optionLabel = option.getLabel();
String hliStubId = hliStub.getId();
String hliLabel = hliStub.getLabel(null);
if (optionValue.equals(hliStubId) && optionLabel.equals(hliLabel)) {
isHliStubInTheOptions = true;
}
}
assertTrue(isHliStubInTheOptions);
}
use of org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub 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);
}
use of org.eclipse.smarthome.core.voice.internal.HumanLanguageInterpreterStub in project smarthome by eclipse.
the class VoiceManagerTest method interpretSomethingWithGivenHliIdWhenTheHliIsARegisteredService.
@Test
public void interpretSomethingWithGivenHliIdWhenTheHliIsARegisteredService() throws InterpretationException {
stubConsole = new ConsoleStub();
hliStub = new HumanLanguageInterpreterStub();
registerService(hliStub);
String result = voiceManager.interpret("something", hliStub.getId());
assertThat(result, is("Interpreted text"));
}
Aggregations