Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Refactored audio and voice support #1882

Merged
merged 3 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bundles/core/org.eclipse.smarthome.core.voice.test/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.smarthome.core.voice"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions bundles/core/org.eclipse.smarthome.core.voice.test/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.smarthome.core.voice.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse SmartHome Core Voice Tests
Bundle-SymbolicName: org.eclipse.smarthome.core.voice.test
Bundle-Version: 0.9.0.qualifier
Bundle-Vendor: Eclipse.org/SmartHome
Fragment-Host: org.eclipse.smarthome.core.voice
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.smarthome.core.voice,
org.hamcrest.core,
org.junit;version="4.0.0"
Bundle-ClassPath: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/test/java/
output.. = target/test-classes/
bin.includes = META-INF/,\
.,\
about.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@

<parent>
<groupId>org.eclipse.smarthome.bundles</groupId>
<artifactId>io</artifactId>
<artifactId>core</artifactId>
<version>0.9.0-SNAPSHOT</version>
</parent>

<properties>
<bundle.symbolicName>org.eclipse.smarthome.io.audio</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.io.audio</bundle.namespace>
<bundle.symbolicName>org.eclipse.smarthome.core.voice.test</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.core.voice.test</bundle.namespace>
</properties>

<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.smarthome.io</groupId>
<artifactId>org.eclipse.smarthome.io.audio</artifactId>
<name>Eclipse SmartHome Audio I/O</name>
<packaging>eclipse-plugin</packaging>
<artifactId>org.eclipse.smarthome.core.voice.test</artifactId>

<name>Eclipse SmartHome Core Voice Test</name>

<packaging>eclipse-test-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright (c) 2014-2016 by the respective copyright holders.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.core.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test general purpose STT exception
*
* @author Kelly Davis - Initial contribution and API
*/
public class STTExceptionTest {

/**
* Test STTException() constructor
*/
@Test
public void testConstructor0() {
STTException ttsException = new STTException();
Assert.assertNotNull("STTException() constructor failed", ttsException);
}

/**
* Test STTException(String message, Throwable cause) constructor
*/
@Test
public void testConstructor1() {
STTException ttsException = new STTException("Message", new Throwable());
Assert.assertNotNull("STTException(String, Throwable) constructor failed", ttsException);
}

/**
* Test STTException(String message) constructor
*/
@Test
public void testConstructor2() {
STTException ttsException = new STTException("Message");
Assert.assertNotNull("STTException(String) constructor failed", ttsException);
}

/**
* Test STTException(Throwable cause) constructor
*/
@Test
public void testConstructor3() {
STTException ttsException = new STTException(new Throwable());
Assert.assertNotNull("STTException(Throwable) constructor failed", ttsException);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2014-2016 by the respective copyright holders.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.core.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test SpeechRecognitionErrorEvent event
*
* @author Kelly Davis - Initial contribution and API
*/
public class SpeechRecognitionErrorEventTest {

/**
* Test SpeechRecognitionErrorEvent(String) constructor
*/
@Test
public void testConstructor() {
SpeechRecognitionErrorEvent sRE = new SpeechRecognitionErrorEvent("Message");
Assert.assertNotNull("SpeechRecognitionErrorEvent(String) constructor failed", sRE);
}

/**
* Test SpeechRecognitionErrorEvent.getMessage() method
*/
@Test
public void getMessageTest() {
SpeechRecognitionErrorEvent sRE = new SpeechRecognitionErrorEvent("Message");
Assert.assertEquals("SpeechRecognitionErrorEvent.getMessage() method failed", "Message", sRE.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright (c) 2014-2016 by the respective copyright holders.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.core.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test SpeechRecognitionEvent event
*
* @author Kelly Davis - Initial contribution and API
*/
public class SpeechRecognitionEventTest {

/**
* Test SpeechRecognitionEvent(String, float) constructor
*/
@Test
public void testConstructor() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5f);
Assert.assertNotNull("SpeechRecognitionEvent(String, float) constructor failed", sRE);
}

/**
* Test SpeechRecognitionEvent.getTranscript() method
*/
@Test
public void getTranscriptTest() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5f);
Assert.assertEquals("SpeechRecognitionEvent.getTranscript() method failed", "Message", sRE.getTranscript());
}

/**
* Test SpeechRecognitionEvent.getConfidence() method
*/
@Test
public void getConfidenceTest() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5f);
Assert.assertEquals("SpeechRecognitionEvent.getConfidence() method failed", (double) 0.5f,
(double) sRE.getConfidence(), (double) 0.001f);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright (c) 2014-2016 by the respective copyright holders.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.core.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test general purpose TTS exception
*
* @author Kelly Davis - Initial contribution and API
*/
public class TTSExceptionTest {

/**
* Test TTSException() constructor
*/
@Test
public void testConstructor0() {
TTSException ttsException = new TTSException();
Assert.assertNotNull("TTSException() constructor failed", ttsException);
}

/**
* Test TTSException(String message, Throwable cause) constructor
*/
@Test
public void testConstructor1() {
TTSException ttsException = new TTSException("Message", new Throwable());
Assert.assertNotNull("TTSException(String, Throwable) constructor failed", ttsException);
}

/**
* Test TTSException(String message) constructor
*/
@Test
public void testConstructor2() {
TTSException ttsException = new TTSException("Message");
Assert.assertNotNull("TTSException(String) constructor failed", ttsException);
}

/**
* Test TTSException(Throwable cause) constructor
*/
@Test
public void testConstructor3() {
TTSException ttsException = new TTSException(new Throwable());
Assert.assertNotNull("TTSException(Throwable) constructor failed", ttsException);
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.smarthome.io.voice</name>
<name>org.eclipse.smarthome.core.voice</name>
<comment></comment>
<projects>
</projects>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Mon Oct 11 21:08:09 CEST 2010
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse SmartHome Voice I/O Bundle
Bundle-SymbolicName: org.eclipse.smarthome.io.voice
Bundle-Name: Eclipse SmartHome Core Voice
Bundle-SymbolicName: org.eclipse.smarthome.core.voice
Bundle-Version: 0.9.0.qualifier
Bundle-Vendor: Eclipse.org/SmartHome
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .
Import-Package: org.apache.commons.collections,
Import-Package: org.apache.commons.collections.map,
org.apache.commons.io,
org.apache.commons.lang,
org.eclipse.smarthome.core.audio,
org.eclipse.smarthome.core.common.registry,
org.eclipse.smarthome.core.events,
org.eclipse.smarthome.core.i18n,
org.eclipse.smarthome.core.items,
org.eclipse.smarthome.core.items.events,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.types,
org.eclipse.smarthome.io.console,
org.eclipse.smarthome.io.console.extensions,
org.eclipse.smarthome.io.voice.tts,
org.osgi.framework,
org.slf4j
Export-Package: org.eclipse.smarthome.io.voice.text,
org.eclipse.smarthome.io.voice.tts
Export-Package: org.eclipse.smarthome.core.voice,
org.eclipse.smarthome.core.voice.text
Service-Component: OSGI-INF/*.xml
Bundle-Activator: org.eclipse.smarthome.io.voice.internal.VoiceActivator
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
http://www.eclipse.org/legal/epl-v10.html

-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.smarthome.io.voice.text.stdinterpreter">
<implementation class="org.eclipse.smarthome.io.voice.internal.text.StandardHumanLanguageInterpreter"/>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.smarthome.core.voice.text.stdinterpreter">
<implementation class="org.eclipse.smarthome.core.voice.internal.text.StandardInterpreter"/>
<service>
<provide interface="org.eclipse.smarthome.io.voice.text.HumanLanguageInterpreter"/>
<provide interface="org.eclipse.smarthome.core.voice.text.HumanLanguageInterpreter"/>
</service>
<reference bind="setItemRegistry" cardinality="1..1" interface="org.eclipse.smarthome.core.items.ItemRegistry" name="ItemRegistry" policy="static" unbind="unsetItemRegistry"/>
<reference bind="setEventPublisher" cardinality="1..1" interface="org.eclipse.smarthome.core.events.EventPublisher" name="EventPublisher" policy="static" unbind="unsetEventPublisher"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
http://www.eclipse.org/legal/epl-v10.html

-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.smarthome.io.voice.extensions.say">
<implementation class="org.eclipse.smarthome.io.voice.internal.extensions.SayConsoleCommandExtension"/>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.smarthome.core.voice.extensions">
<implementation class="org.eclipse.smarthome.core.voice.internal.VoiceConsoleCommandExtension"/>
<service>
<provide interface="org.eclipse.smarthome.io.console.extensions.ConsoleCommandExtension"/>
</service>
<reference bind="setItemRegistry" cardinality="1..1" interface="org.eclipse.smarthome.core.items.ItemRegistry" name="ItemRegistry" policy="static" unbind="unsetItemRegistry"/>
<reference bind="setVoiceManager" cardinality="1..1" interface="org.eclipse.smarthome.core.voice.VoiceManager" name="VoiceManager" policy="static" unbind="unsetVoiceManager"/>
</scr:component>
Loading