use of org.eclipse.smarthome.core.voice.internal.ConsoleStub 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.ConsoleStub 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"));
}
use of org.eclipse.smarthome.core.voice.internal.ConsoleStub in project smarthome by eclipse.
the class VoiceManagerTest method interpretSomethingWithGivenHliIdEhenTheHliIsNotARegisteredService.
@Test
public void interpretSomethingWithGivenHliIdEhenTheHliIsNotARegisteredService() throws InterpretationException {
stubConsole = new ConsoleStub();
hliStub = new HumanLanguageInterpreterStub();
String result;
exception.expect(InterpretationException.class);
result = voiceManager.interpret("something", hliStub.getId());
assertNull(result);
}
use of org.eclipse.smarthome.core.voice.internal.ConsoleStub in project smarthome by eclipse.
the class VoiceConsoleCommandExtensionTest method setup.
@Before
public void setup() {
voiceManager = getService(VoiceManager.class, VoiceManagerImpl.class);
assertNotNull(voiceManager);
extensionService = getService(ConsoleCommandExtension.class, VoiceConsoleCommandExtension.class);
assertNotNull(extensionService);
sink = new SinkStub();
source = new AudioSourceStub();
audioManager = new AudioManagerStub();
console = new ConsoleStub();
registerService(audioManager);
registerService(voiceManager);
}
Aggregations