mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
add further tests (#533)
* migrate audio tests * migrate automation.core and automation.event tests Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit is contained in:
parent
981a447e99
commit
d775bf7a29
@ -23,5 +23,10 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,2 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
@ -5,6 +5,11 @@ Fragment-Host: org.openhab.core.audio
|
||||
|
||||
-runrequires: bnd.identity;id='org.openhab.core.audio.tests'
|
||||
|
||||
# If we would like to use a storage at all, we will use the "volatile" storage.
|
||||
-runblacklist: \
|
||||
bnd.identity;id='org.openhab.core.storage.json',\
|
||||
bnd.identity;id='org.openhab.core.storage.mapdb'
|
||||
|
||||
#
|
||||
# done
|
||||
#
|
||||
@ -13,6 +18,8 @@ Fragment-Host: org.openhab.core.audio
|
||||
ch.qos.logback.core;version='[1.2.0,1.2.1)',\
|
||||
com.google.gson;version='[2.7.0,2.7.1)',\
|
||||
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.7.9,1.7.10)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.7.9,1.7.10)',\
|
||||
org.apache.commons.io;version='[2.2.0,2.2.1)',\
|
||||
org.apache.commons.lang;version='[2.6.0,2.6.1)',\
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
@ -20,6 +27,7 @@ Fragment-Host: org.openhab.core.audio
|
||||
org.apache.xbean.bundleutils;version='[4.6.0,4.6.1)',\
|
||||
org.apache.xbean.finder;version='[4.6.0,4.6.1)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.eclipse.jetty.client;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.http;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.io;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.security;version='[9.4.11,9.4.12)',\
|
||||
@ -27,29 +35,26 @@ Fragment-Host: org.openhab.core.audio
|
||||
org.eclipse.jetty.servlet;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.util;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.xml;version='[9.4.11,9.4.12)',\
|
||||
org.mockito.mockito-core;version='[2.13.0,2.13.1)',\
|
||||
org.objectweb.asm;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.commons;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.tree;version='[6.1.1,6.1.2)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.openhab.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio.tests;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.config.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.console;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.http;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.test;version='[2.5.0,2.5.1)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.2,1.8.3)',\
|
||||
org.ops4j.pax.web.pax-web-api;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-jetty;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-runtime;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-spi;version='[7.2.3,7.2.4)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
|
||||
osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
|
||||
slf4j.api;version='[1.7.21,1.7.22)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.2,1.0.3)',\
|
||||
tec.uom.se;version='[1.0.8,1.0.9)',\
|
||||
org.openhab.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.config.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.console;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.http;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio.tests;version='[2.5.0,2.5.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.7.9,1.7.10)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.7.9,1.7.10)',\
|
||||
org.eclipse.jetty.client;version='[9.4.11,9.4.12)',\
|
||||
org.mockito.mockito-core;version='[2.13.0,2.13.1)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.openhab.core.test;version='[2.5.0,2.5.1)',\
|
||||
osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
|
||||
osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)'
|
||||
tec.uom.se;version='[1.0.8,1.0.9)'
|
@ -20,7 +20,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.smarthome.config.core.ConfigConstants;
|
||||
import org.eclipse.smarthome.core.audio.AudioException;
|
||||
import org.eclipse.smarthome.core.audio.AudioFormat;
|
||||
import org.eclipse.smarthome.core.audio.AudioSource;
|
||||
@ -28,6 +27,7 @@ import org.eclipse.smarthome.core.audio.AudioStream;
|
||||
import org.eclipse.smarthome.core.audio.FileAudioStream;
|
||||
import org.eclipse.smarthome.core.audio.URLAudioStream;
|
||||
import org.eclipse.smarthome.core.audio.internal.fake.AudioSinkFake;
|
||||
import org.eclipse.smarthome.core.audio.internal.utils.BundledSoundFileHandler;
|
||||
import org.eclipse.smarthome.core.i18n.LocaleProvider;
|
||||
import org.eclipse.smarthome.io.console.Console;
|
||||
import org.junit.After;
|
||||
@ -43,6 +43,8 @@ import org.junit.Test;
|
||||
*/
|
||||
public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
private BundledSoundFileHandler fileHandler;
|
||||
|
||||
private AudioConsoleCommandExtension audioConsoleCommandExtension;
|
||||
|
||||
private AudioManagerImpl audioManager;
|
||||
@ -51,14 +53,6 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
private final byte[] testByteArray = new byte[] { 0, 1, 2 };
|
||||
|
||||
private static final String CONFIGURATION_DIRECTORY_NAME = "configuration";
|
||||
|
||||
protected static final String MP3_FILE_NAME = "mp3AudioFile.mp3";
|
||||
protected static final String MP3_FILE_PATH = CONFIGURATION_DIRECTORY_NAME + "/sounds/" + MP3_FILE_NAME;
|
||||
|
||||
protected static final String WAV_FILE_NAME = "wavAudioFile.wav";
|
||||
protected static final String WAV_FILE_PATH = CONFIGURATION_DIRECTORY_NAME + "/sounds/" + WAV_FILE_NAME;
|
||||
|
||||
private String consoleOutput;
|
||||
private final Console consoleMock = new Console() {
|
||||
|
||||
@ -80,7 +74,8 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
private final int testTimeout = 1;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
public void setUp() throws IOException {
|
||||
fileHandler = new BundledSoundFileHandler();
|
||||
audioManager = new AudioManagerImpl();
|
||||
audioSink = new AudioSinkFake();
|
||||
audioManager.addAudioSink(audioSink);
|
||||
@ -91,13 +86,11 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
LocaleProvider localeProvider = mock(LocaleProvider.class);
|
||||
when(localeProvider.getLocale()).thenReturn(Locale.getDefault());
|
||||
audioConsoleCommandExtension.setLocaleProvider(localeProvider);
|
||||
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, CONFIGURATION_DIRECTORY_NAME);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, ConfigConstants.DEFAULT_CONFIG_FOLDER);
|
||||
fileHandler.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -108,9 +101,9 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
@Test
|
||||
public void audioConsolePlaysFile() throws AudioException, IOException {
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, WAV_FILE_NAME };
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, fileHandler.wavFileName() };
|
||||
audioConsoleCommandExtension.execute(args, consoleMock);
|
||||
|
||||
assertThat(audioSink.audioFormat.isCompatible(audioStream.getFormat()), is(true));
|
||||
@ -119,9 +112,10 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
@Test
|
||||
public void audioConsolePlaysFileForASpecifiedSink() throws AudioException, IOException {
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(), WAV_FILE_NAME };
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(),
|
||||
fileHandler.wavFileName() };
|
||||
audioConsoleCommandExtension.execute(args, consoleMock);
|
||||
|
||||
assertThat(audioSink.audioFormat.isCompatible(audioStream.getFormat()), is(true));
|
||||
@ -130,10 +124,10 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
@Test
|
||||
public void audioConsolePlaysFileForASpecifiedSinkWithASpecifiedVolume() throws AudioException, IOException {
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(), WAV_FILE_NAME,
|
||||
"25" };
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(),
|
||||
fileHandler.wavFileName(), "25" };
|
||||
audioConsoleCommandExtension.execute(args, consoleMock);
|
||||
|
||||
assertThat(audioSink.audioFormat.isCompatible(audioStream.getFormat()), is(true));
|
||||
@ -142,8 +136,8 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
|
||||
@Test
|
||||
public void audioConsolePlaysFileForASpecifiedSinkWithAnInvalidVolume() {
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(), WAV_FILE_NAME,
|
||||
"invalid" };
|
||||
String[] args = new String[] { AudioConsoleCommandExtension.SUBCMD_PLAY, audioSink.getId(),
|
||||
fileHandler.wavFileName(), "invalid" };
|
||||
audioConsoleCommandExtension.execute(args, consoleMock);
|
||||
|
||||
waitForAssert(() -> assertThat("The given volume was invalid", consoleOutput, nullValue()));
|
||||
|
@ -25,7 +25,6 @@ import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import org.eclipse.smarthome.config.core.ConfigConstants;
|
||||
import org.eclipse.smarthome.config.core.ParameterOption;
|
||||
import org.eclipse.smarthome.core.audio.AudioException;
|
||||
import org.eclipse.smarthome.core.audio.AudioFormat;
|
||||
@ -35,6 +34,7 @@ import org.eclipse.smarthome.core.audio.ByteArrayAudioStream;
|
||||
import org.eclipse.smarthome.core.audio.FileAudioStream;
|
||||
import org.eclipse.smarthome.core.audio.UnsupportedAudioStreamException;
|
||||
import org.eclipse.smarthome.core.audio.internal.fake.AudioSinkFake;
|
||||
import org.eclipse.smarthome.core.audio.internal.utils.BundledSoundFileHandler;
|
||||
import org.eclipse.smarthome.core.library.types.PercentType;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@ -50,21 +50,16 @@ import org.junit.Test;
|
||||
*/
|
||||
public class AudioManagerTest {
|
||||
|
||||
private BundledSoundFileHandler fileHandler;
|
||||
|
||||
private AudioManagerImpl audioManager;
|
||||
|
||||
private AudioSinkFake audioSink;
|
||||
private AudioSource audioSource;
|
||||
|
||||
private static final String CONFIGURATION_DIRECTORY_NAME = "configuration";
|
||||
|
||||
private static final String MP3_FILE_NAME = "mp3AudioFile.mp3";
|
||||
private static final String MP3_FILE_PATH = CONFIGURATION_DIRECTORY_NAME + "/sounds/" + MP3_FILE_NAME;
|
||||
|
||||
private static final String WAV_FILE_NAME = "wavAudioFile.wav";
|
||||
private static final String WAV_FILE_PATH = CONFIGURATION_DIRECTORY_NAME + "/sounds/" + WAV_FILE_NAME;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
public void setup() throws IOException {
|
||||
fileHandler = new BundledSoundFileHandler();
|
||||
audioManager = new AudioManagerImpl();
|
||||
audioSink = new AudioSinkFake();
|
||||
|
||||
@ -72,12 +67,11 @@ public class AudioManagerTest {
|
||||
when(audioSource.getId()).thenReturn("audioSourceId");
|
||||
when(audioSource.getLabel(any(Locale.class))).thenReturn("audioSourceLabel");
|
||||
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, CONFIGURATION_DIRECTORY_NAME);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, ConfigConstants.DEFAULT_CONFIG_FOLDER);
|
||||
public void tearDown() throws IOException {
|
||||
fileHandler.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -104,7 +98,7 @@ public class AudioManagerTest {
|
||||
@Test
|
||||
public void audioManagerPlaysStreamFromWavAudioFiles() throws AudioException {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
|
||||
audioManager.play(audioStream, audioSink.getId());
|
||||
|
||||
@ -114,7 +108,7 @@ public class AudioManagerTest {
|
||||
@Test
|
||||
public void audioManagerPlaysStreamFromMp3AudioFiles() throws AudioException {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
AudioStream audioStream = new FileAudioStream(new File(MP3_FILE_PATH));
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.mp3FilePath()));
|
||||
|
||||
audioManager.play(audioStream, audioSink.getId());
|
||||
|
||||
@ -124,8 +118,8 @@ public class AudioManagerTest {
|
||||
@Test
|
||||
public void audioManagerPlaysWavAudioFiles() throws AudioException, IOException {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
audioManager.playFile(WAV_FILE_NAME, audioSink.getId());
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
audioManager.playFile(fileHandler.wavFileName(), audioSink.getId());
|
||||
|
||||
assertThat(audioSink.audioFormat.isCompatible(audioStream.getFormat()), is(true));
|
||||
audioStream.close();
|
||||
@ -134,8 +128,8 @@ public class AudioManagerTest {
|
||||
@Test
|
||||
public void audioManagerPlaysMp3AudioFiles() throws AudioException, IOException {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
AudioStream audioStream = new FileAudioStream(new File(MP3_FILE_PATH));
|
||||
audioManager.playFile(MP3_FILE_NAME, audioSink.getId());
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.mp3FilePath()));
|
||||
audioManager.playFile(fileHandler.mp3FileName(), audioSink.getId());
|
||||
|
||||
assertThat(audioSink.audioFormat.isCompatible(audioStream.getFormat()), is(true));
|
||||
audioStream.close();
|
||||
@ -143,7 +137,7 @@ public class AudioManagerTest {
|
||||
|
||||
@Test
|
||||
public void fileIsNotProcessedIfThereIsNoRegisteredSink() throws AudioException {
|
||||
File file = new File(MP3_FILE_PATH);
|
||||
File file = new File(fileHandler.mp3FilePath());
|
||||
|
||||
audioManager.playFile(file.getName(), audioSink.getId());
|
||||
|
||||
@ -155,7 +149,7 @@ public class AudioManagerTest {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
audioSink.isUnsupportedAudioFormatExceptionExpected = true;
|
||||
try {
|
||||
audioManager.playFile(MP3_FILE_NAME, audioSink.getId());
|
||||
audioManager.playFile(fileHandler.mp3FileName(), audioSink.getId());
|
||||
} catch (UnsupportedAudioStreamException e) {
|
||||
fail("An exception " + e + " was thrown, while trying to process a stream");
|
||||
}
|
||||
@ -166,7 +160,7 @@ public class AudioManagerTest {
|
||||
audioManager.addAudioSink(audioSink);
|
||||
audioSink.isUnsupportedAudioStreamExceptionExpected = true;
|
||||
try {
|
||||
audioManager.playFile(MP3_FILE_NAME, audioSink.getId());
|
||||
audioManager.playFile(fileHandler.mp3FileName(), audioSink.getId());
|
||||
} catch (UnsupportedAudioStreamException e) {
|
||||
fail("An exception " + e + " was thrown, while trying to process a stream");
|
||||
}
|
||||
|
@ -20,12 +20,10 @@ import java.io.File;
|
||||
import org.eclipse.jetty.client.api.ContentResponse;
|
||||
import org.eclipse.jetty.client.api.Request;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.smarthome.config.core.ConfigConstants;
|
||||
import org.eclipse.smarthome.core.audio.AudioFormat;
|
||||
import org.eclipse.smarthome.core.audio.AudioStream;
|
||||
import org.eclipse.smarthome.core.audio.FileAudioStream;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.eclipse.smarthome.core.audio.internal.utils.BundledSoundFileHandler;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -40,23 +38,8 @@ public class AudioServletTest extends AbstractAudioServeltTest {
|
||||
private final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg";
|
||||
private final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg";
|
||||
|
||||
private static final String CONFIGURATION_DIRECTORY_NAME = "configuration";
|
||||
|
||||
private static final String WAV_FILE_NAME = "wavAudioFile.wav";
|
||||
private static final String WAV_FILE_PATH = CONFIGURATION_DIRECTORY_NAME + "/sounds/" + WAV_FILE_NAME;
|
||||
|
||||
private final byte[] testByteArray = new byte[] { 0, 1, 2 };
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, CONFIGURATION_DIRECTORY_NAME);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, ConfigConstants.DEFAULT_CONFIG_FOLDER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void audioServletProcessesByteArrayStream() throws Exception {
|
||||
AudioStream audioStream = getByteArrayAudioStream(testByteArray, AudioFormat.CONTAINER_NONE,
|
||||
@ -72,12 +55,15 @@ public class AudioServletTest extends AbstractAudioServeltTest {
|
||||
|
||||
@Test
|
||||
public void audioServletProcessesStreamFromWavFile() throws Exception {
|
||||
AudioStream audioStream = new FileAudioStream(new File(WAV_FILE_PATH));
|
||||
try (BundledSoundFileHandler fileHandler = new BundledSoundFileHandler()) {
|
||||
AudioStream audioStream = new FileAudioStream(new File(fileHandler.wavFilePath()));
|
||||
|
||||
ContentResponse response = getHttpResponse(audioStream);
|
||||
ContentResponse response = getHttpResponse(audioStream);
|
||||
|
||||
assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200));
|
||||
assertThat("The response media type was not as expected", response.getMediaType(), is(MEDIA_TYPE_AUDIO_WAV));
|
||||
assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200));
|
||||
assertThat("The response media type was not as expected", response.getMediaType(),
|
||||
is(MEDIA_TYPE_AUDIO_WAV));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Copyright (c) 2014,2019 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* See the NOTICE file(s) distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.core.audio.internal.utils;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.smarthome.config.core.ConfigConstants;
|
||||
import org.eclipse.smarthome.core.audio.internal.AudioManagerTest;
|
||||
|
||||
/**
|
||||
* Helper class to handle bundled resources.
|
||||
*
|
||||
* @author Markus Rathgeb - Initial contribution
|
||||
*/
|
||||
public class BundledSoundFileHandler implements Closeable {
|
||||
|
||||
private static final String MP3_FILE_NAME = "mp3AudioFile.mp3";
|
||||
private static final String WAV_FILE_NAME = "wavAudioFile.wav";
|
||||
|
||||
private static void copy(final String resourcePath, final String filePath) throws IOException {
|
||||
try (InputStream is = AudioManagerTest.class.getResourceAsStream(resourcePath)) {
|
||||
byte[] buffer = new byte[is.available()];
|
||||
is.read(buffer);
|
||||
|
||||
new File(filePath).getParentFile().mkdirs();
|
||||
try (OutputStream outStream = new FileOutputStream(filePath)) {
|
||||
outStream.write(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Path tmpdir;
|
||||
private final String mp3FilePath;
|
||||
private final String wavFilePath;
|
||||
|
||||
public BundledSoundFileHandler() throws IOException {
|
||||
tmpdir = Files.createTempDirectory(null);
|
||||
|
||||
final Path configdir = tmpdir.resolve("configdir");
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, configdir.toString());
|
||||
|
||||
mp3FilePath = configdir.resolve("sounds/" + MP3_FILE_NAME).toString();
|
||||
copy("/configuration/sounds/mp3AudioFile.mp3", mp3FilePath);
|
||||
wavFilePath = configdir.resolve("sounds/" + WAV_FILE_NAME).toString();
|
||||
copy("/configuration/sounds/wavAudioFile.wav", wavFilePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
System.setProperty(ConfigConstants.CONFIG_DIR_PROG_ARGUMENT, ConfigConstants.DEFAULT_CONFIG_FOLDER);
|
||||
|
||||
if (tmpdir != null) {
|
||||
try {
|
||||
Files.walk(tmpdir).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String mp3FileName() {
|
||||
return MP3_FILE_NAME;
|
||||
}
|
||||
|
||||
public String mp3FilePath() {
|
||||
return mp3FilePath;
|
||||
}
|
||||
|
||||
public String wavFileName() {
|
||||
return WAV_FILE_NAME;
|
||||
}
|
||||
|
||||
public String wavFilePath() {
|
||||
return wavFilePath;
|
||||
}
|
||||
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -1,95 +0,0 @@
|
||||
-include: ../itest-common.bndrun
|
||||
|
||||
Bundle-SymbolicName: ${project.artifactId}
|
||||
Fragment-Host: org.openhab.core.automation.core
|
||||
|
||||
-runrequires: bnd.identity;id='org.openhab.core.automation.core.tests'
|
||||
|
||||
#
|
||||
# done
|
||||
#
|
||||
-runbundles: \
|
||||
ch.qos.logback.classic;version='[1.2.0,1.2.1)',\
|
||||
ch.qos.logback.core;version='[1.2.0,1.2.1)',\
|
||||
com.google.gson;version='[2.7.0,2.7.1)',\
|
||||
com.google.guava;version='[15.0.0,15.0.1)',\
|
||||
com.google.inject;version='[3.0.0,3.0.1)',\
|
||||
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
|
||||
joda-time;version='[2.9.2,2.9.3)',\
|
||||
log4j;version='[1.2.17,1.2.18)',\
|
||||
org.antlr.runtime;version='[3.2.0,3.2.1)',\
|
||||
org.apache.commons.collections;version='[3.2.1,3.2.2)',\
|
||||
org.apache.commons.exec;version='[1.1.0,1.1.1)',\
|
||||
org.apache.commons.io;version='[2.2.0,2.2.1)',\
|
||||
org.apache.commons.lang;version='[2.6.0,2.6.1)',\
|
||||
org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.apache.servicemix.bundles.commons-codec;version='[1.3.0,1.3.1)',\
|
||||
org.apache.servicemix.bundles.commons-httpclient;version='[3.1.0,3.1.1)',\
|
||||
org.apache.xbean.bundleutils;version='[4.6.0,4.6.1)',\
|
||||
org.apache.xbean.finder;version='[4.6.0,4.6.1)',\
|
||||
org.eclipse.emf.common;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.emf.ecore;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.emf.ecore.xmi;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.equinox.common;version='[3.8.0,3.8.1)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.eclipse.jetty.client;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.http;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.io;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.proxy;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.security;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.server;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.servlet;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.util;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.api;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.client;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.common;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.xml;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.xtend.lib;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtend.lib.macro;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.common.types;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.util;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.xbase;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.xbase.lib;version='[2.14.0,2.14.1)',\
|
||||
org.glassfish.hk2.external.aopalliance-repackaged;version='[2.4.0,2.4.1)',\
|
||||
org.glassfish.hk2.external.javax.inject;version='[2.4.0,2.4.1)',\
|
||||
org.objectweb.asm;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.commons;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.tree;version='[6.1.1,6.1.2)',\
|
||||
org.openhab.core.compat1x;version='[2.5.0,2.5.1)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.2,1.8.3)',\
|
||||
org.ops4j.pax.web.pax-web-api;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-jetty;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-runtime;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-spi;version='[7.2.3,7.2.4)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
slf4j.api;version='[1.7.21,1.7.22)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.2,1.0.3)',\
|
||||
tec.uom.se;version='[1.0.8,1.0.9)',\
|
||||
osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
|
||||
osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
|
||||
org.openhab.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.compat1x.tests;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.config.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.console;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.http;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.net;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.item;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.persistence;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.script;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.script.runtime;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.sitemap;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.persistence;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.scheduler;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.thing;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.transform;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.ui;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.voice;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.persistence.runtime;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.rule;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.thing;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.storage.json;version='[2.5.0,2.5.1)'
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -1 +0,0 @@
|
||||
/test-classes/
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.core.automation.event.tests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,4 +0,0 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -1,19 +0,0 @@
|
||||
This content is produced and maintained by the Eclipse SmartHome project.
|
||||
|
||||
* Project home: https://eclipse.org/smarthome/
|
||||
|
||||
== Declared Project Licenses
|
||||
|
||||
This program and the accompanying materials are made available under the terms
|
||||
of the Eclipse Public License 2.0 which is available at
|
||||
https://www.eclipse.org/legal/epl-2.0/.
|
||||
|
||||
== Source Code
|
||||
|
||||
https://github.com/eclipse/smarthome
|
||||
|
||||
== Copyright Holders
|
||||
|
||||
See the NOTICE file distributed with the source code at
|
||||
https://github.com/eclipse/smarthome/blob/master/NOTICE
|
||||
for detailed information regarding copyright ownership.
|
@ -1,95 +0,0 @@
|
||||
-include: ../itest-common.bndrun
|
||||
|
||||
Bundle-SymbolicName: ${project.artifactId}
|
||||
Fragment-Host: org.openhab.core.automation.event
|
||||
|
||||
-runrequires: bnd.identity;id='org.openhab.core.automation.event.tests'
|
||||
|
||||
#
|
||||
# done
|
||||
#
|
||||
-runbundles: \
|
||||
ch.qos.logback.classic;version='[1.2.0,1.2.1)',\
|
||||
ch.qos.logback.core;version='[1.2.0,1.2.1)',\
|
||||
com.google.gson;version='[2.7.0,2.7.1)',\
|
||||
com.google.guava;version='[15.0.0,15.0.1)',\
|
||||
com.google.inject;version='[3.0.0,3.0.1)',\
|
||||
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
|
||||
joda-time;version='[2.9.2,2.9.3)',\
|
||||
log4j;version='[1.2.17,1.2.18)',\
|
||||
org.antlr.runtime;version='[3.2.0,3.2.1)',\
|
||||
org.apache.commons.collections;version='[3.2.1,3.2.2)',\
|
||||
org.apache.commons.exec;version='[1.1.0,1.1.1)',\
|
||||
org.apache.commons.io;version='[2.2.0,2.2.1)',\
|
||||
org.apache.commons.lang;version='[2.6.0,2.6.1)',\
|
||||
org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.apache.servicemix.bundles.commons-codec;version='[1.3.0,1.3.1)',\
|
||||
org.apache.servicemix.bundles.commons-httpclient;version='[3.1.0,3.1.1)',\
|
||||
org.apache.xbean.bundleutils;version='[4.6.0,4.6.1)',\
|
||||
org.apache.xbean.finder;version='[4.6.0,4.6.1)',\
|
||||
org.eclipse.emf.common;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.emf.ecore;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.emf.ecore.xmi;version='[2.12.0,2.12.1)',\
|
||||
org.eclipse.equinox.common;version='[3.8.0,3.8.1)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.eclipse.jetty.client;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.http;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.io;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.proxy;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.security;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.server;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.servlet;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.util;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.api;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.client;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.websocket.common;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.xml;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.xtend.lib;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtend.lib.macro;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.common.types;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.util;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.xbase;version='[2.14.0,2.14.1)',\
|
||||
org.eclipse.xtext.xbase.lib;version='[2.14.0,2.14.1)',\
|
||||
org.glassfish.hk2.external.aopalliance-repackaged;version='[2.4.0,2.4.1)',\
|
||||
org.glassfish.hk2.external.javax.inject;version='[2.4.0,2.4.1)',\
|
||||
org.objectweb.asm;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.commons;version='[6.1.1,6.1.2)',\
|
||||
org.objectweb.asm.tree;version='[6.1.1,6.1.2)',\
|
||||
org.openhab.core.compat1x;version='[2.5.0,2.5.1)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.2,1.8.3)',\
|
||||
org.ops4j.pax.web.pax-web-api;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-jetty;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-runtime;version='[7.2.3,7.2.4)',\
|
||||
org.ops4j.pax.web.pax-web-spi;version='[7.2.3,7.2.4)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
slf4j.api;version='[1.7.21,1.7.22)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.2,1.0.3)',\
|
||||
tec.uom.se;version='[1.0.8,1.0.9)',\
|
||||
osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
|
||||
osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
|
||||
org.openhab.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.audio;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.compat1x.tests;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.config.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.console;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.http;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.net;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.item;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.persistence;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.script;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.script.runtime;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.sitemap;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.persistence;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.scheduler;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.thing;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.transform;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.ui;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.voice;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.persistence.runtime;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.rule;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.model.thing;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.storage.json;version='[2.5.0,2.5.1)'
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.openhab.core.itests</groupId>
|
||||
<artifactId>org.openhab.core.reactor.itests</artifactId>
|
||||
<version>2.5.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.core.automation.event.tests</artifactId>
|
||||
|
||||
<name>openHAB Core :: Integration Tests :: Automation Event Tests</name>
|
||||
|
||||
</project>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.core.automation.core.tests</name>
|
||||
<name>org.openhab.core.automation.tests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
@ -1,2 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
45
itests/org.openhab.core.automation.tests/itest.bndrun
Normal file
45
itests/org.openhab.core.automation.tests/itest.bndrun
Normal file
@ -0,0 +1,45 @@
|
||||
-include: ../itest-common.bndrun
|
||||
|
||||
Bundle-SymbolicName: ${project.artifactId}
|
||||
Fragment-Host: org.openhab.core.automation
|
||||
|
||||
-runrequires: bnd.identity;id='org.openhab.core.automation.tests'
|
||||
|
||||
# If we would like to use a storage at all, we will use the "volatile" storage.
|
||||
-runblacklist: \
|
||||
bnd.identity;id='org.openhab.core.storage.json',\
|
||||
bnd.identity;id='org.openhab.core.storage.mapdb'
|
||||
|
||||
#
|
||||
# done
|
||||
#
|
||||
-runbundles: \
|
||||
ch.qos.logback.classic;version='[1.2.0,1.2.1)',\
|
||||
ch.qos.logback.core;version='[1.2.0,1.2.1)',\
|
||||
com.google.gson;version='[2.7.0,2.7.1)',\
|
||||
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
|
||||
org.apache.commons.collections;version='[3.2.1,3.2.2)',\
|
||||
org.apache.commons.io;version='[2.2.0,2.2.1)',\
|
||||
org.apache.commons.lang;version='[2.6.0,2.6.1)',\
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.eclipse.jetty.http;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.io;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.security;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.server;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.servlet;version='[9.4.11,9.4.12)',\
|
||||
org.eclipse.jetty.util;version='[9.4.11,9.4.12)',\
|
||||
org.openhab.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.automation;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.automation.tests;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.config.core;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.io.console;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.test;version='[2.5.0,2.5.1)',\
|
||||
org.openhab.core.thing;version='[2.5.0,2.5.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
|
||||
osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
|
||||
slf4j.api;version='[1.7.21,1.7.22)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.2,1.0.3)',\
|
||||
tec.uom.se;version='[1.0.8,1.0.9)'
|
@ -9,8 +9,8 @@
|
||||
<version>2.5.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.core.automation.core.tests</artifactId>
|
||||
<artifactId>org.openhab.core.automation.tests</artifactId>
|
||||
|
||||
<name>openHAB Core :: Integration Tests :: Automation Core Tests</name>
|
||||
<name>openHAB Core :: Integration Tests :: Automation Tests</name>
|
||||
|
||||
</project>
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.event;
|
||||
package org.openhab.core.automation.event;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
@ -28,18 +28,6 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.smarthome.automation.Action;
|
||||
import org.eclipse.smarthome.automation.Rule;
|
||||
import org.eclipse.smarthome.automation.RuleManager;
|
||||
import org.eclipse.smarthome.automation.RuleRegistry;
|
||||
import org.eclipse.smarthome.automation.RuleStatus;
|
||||
import org.eclipse.smarthome.automation.Trigger;
|
||||
import org.eclipse.smarthome.automation.core.util.ModuleBuilder;
|
||||
import org.eclipse.smarthome.automation.core.util.RuleBuilder;
|
||||
import org.eclipse.smarthome.automation.events.RuleAddedEvent;
|
||||
import org.eclipse.smarthome.automation.events.RuleRemovedEvent;
|
||||
import org.eclipse.smarthome.automation.events.RuleStatusInfoEvent;
|
||||
import org.eclipse.smarthome.automation.events.RuleUpdatedEvent;
|
||||
import org.eclipse.smarthome.config.core.Configuration;
|
||||
import org.eclipse.smarthome.core.common.registry.ProviderChangeListener;
|
||||
import org.eclipse.smarthome.core.events.Event;
|
||||
@ -58,6 +46,18 @@ import org.eclipse.smarthome.test.java.JavaOSGiTest;
|
||||
import org.eclipse.smarthome.test.storage.VolatileStorageService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.openhab.core.automation.Action;
|
||||
import org.openhab.core.automation.Rule;
|
||||
import org.openhab.core.automation.RuleManager;
|
||||
import org.openhab.core.automation.RuleRegistry;
|
||||
import org.openhab.core.automation.RuleStatus;
|
||||
import org.openhab.core.automation.Trigger;
|
||||
import org.openhab.core.automation.events.RuleAddedEvent;
|
||||
import org.openhab.core.automation.events.RuleRemovedEvent;
|
||||
import org.openhab.core.automation.events.RuleStatusInfoEvent;
|
||||
import org.openhab.core.automation.events.RuleUpdatedEvent;
|
||||
import org.openhab.core.automation.util.ModuleBuilder;
|
||||
import org.openhab.core.automation.util.RuleBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
@ -18,12 +18,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.smarthome.automation.Module;
|
||||
import org.eclipse.smarthome.automation.core.util.ModuleBuilder;
|
||||
import org.eclipse.smarthome.automation.core.util.ReferenceResolver;
|
||||
import org.eclipse.smarthome.config.core.Configuration;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.openhab.core.automation.Module;
|
||||
import org.openhab.core.automation.util.ModuleBuilder;
|
||||
import org.openhab.core.automation.util.ReferenceResolver;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@ -20,15 +20,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.smarthome.automation.Action;
|
||||
import org.eclipse.smarthome.automation.Condition;
|
||||
import org.eclipse.smarthome.automation.Rule;
|
||||
import org.eclipse.smarthome.automation.RuleManager;
|
||||
import org.eclipse.smarthome.automation.RuleRegistry;
|
||||
import org.eclipse.smarthome.automation.Trigger;
|
||||
import org.eclipse.smarthome.automation.core.util.ModuleBuilder;
|
||||
import org.eclipse.smarthome.automation.core.util.RuleBuilder;
|
||||
import org.eclipse.smarthome.automation.type.ModuleTypeProvider;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter.Type;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder;
|
||||
@ -40,6 +31,15 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.openhab.core.automation.Action;
|
||||
import org.openhab.core.automation.Condition;
|
||||
import org.openhab.core.automation.Rule;
|
||||
import org.openhab.core.automation.RuleManager;
|
||||
import org.openhab.core.automation.RuleRegistry;
|
||||
import org.openhab.core.automation.Trigger;
|
||||
import org.openhab.core.automation.type.ModuleTypeProvider;
|
||||
import org.openhab.core.automation.util.ModuleBuilder;
|
||||
import org.openhab.core.automation.util.RuleBuilder;
|
||||
|
||||
/**
|
||||
* Test adding, retrieving and updating rules from the RuleEngineImpl
|
@ -10,11 +10,11 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import org.eclipse.smarthome.automation.RulePredicates;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.openhab.core.automation.RulePredicates;
|
||||
|
||||
/**
|
||||
* Testing the prefix functionality.
|
@ -10,9 +10,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import static org.eclipse.smarthome.automation.RulePredicates.*;
|
||||
import static org.openhab.core.automation.RulePredicates.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@ -20,12 +20,12 @@ import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.smarthome.automation.Rule;
|
||||
import org.eclipse.smarthome.automation.RuleRegistry;
|
||||
import org.eclipse.smarthome.test.java.JavaOSGiTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.openhab.core.automation.Rule;
|
||||
import org.openhab.core.automation.RuleRegistry;
|
||||
|
||||
/**
|
||||
* Testing the {@link Predicate}s for {@link RuleImpl}s.
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.smarthome.automation.core.internal;
|
||||
package org.openhab.core.automation.internal;
|
||||
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
@ -24,14 +24,14 @@ import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.smarthome.automation.type.ActionType;
|
||||
import org.eclipse.smarthome.automation.type.ConditionType;
|
||||
import org.eclipse.smarthome.automation.type.Input;
|
||||
import org.eclipse.smarthome.automation.type.ModuleType;
|
||||
import org.eclipse.smarthome.automation.type.ModuleTypeProvider;
|
||||
import org.eclipse.smarthome.automation.type.Output;
|
||||
import org.eclipse.smarthome.automation.type.TriggerType;
|
||||
import org.eclipse.smarthome.core.common.registry.ProviderChangeListener;
|
||||
import org.openhab.core.automation.type.ActionType;
|
||||
import org.openhab.core.automation.type.ConditionType;
|
||||
import org.openhab.core.automation.type.Input;
|
||||
import org.openhab.core.automation.type.ModuleType;
|
||||
import org.openhab.core.automation.type.ModuleTypeProvider;
|
||||
import org.openhab.core.automation.type.Output;
|
||||
import org.openhab.core.automation.type.TriggerType;
|
||||
|
||||
/**
|
||||
* ModuleTypeManagerMockup is a ModuleTypeManager which returns mockup module types for the following predefined module
|
@ -18,14 +18,13 @@
|
||||
|
||||
<modules>
|
||||
<module>org.openhab.core.tests</module>
|
||||
<!-- <module>org.openhab.core.audio.tests</module> -->
|
||||
<module>org.openhab.core.audio.tests</module>
|
||||
<module>org.openhab.core.auth.oauth2client.tests</module>
|
||||
<!-- <module>org.openhab.core.automation.core.tests</module> -->
|
||||
<module>org.openhab.core.automation.tests</module>
|
||||
<!-- <module>org.openhab.core.automation.module.core.tests</module> -->
|
||||
<!-- <module>org.openhab.core.automation.module.timer.tests</module> -->
|
||||
<!-- <module>org.openhab.core.automation.module.script.defaultscope.tests</module> -->
|
||||
<!-- <module>org.openhab.core.automation.module.script.tests</module> -->
|
||||
<!-- <module>org.openhab.core.automation.event.tests</module> -->
|
||||
<!-- <module>org.openhab.core.automation.integration.tests</module> -->
|
||||
<!-- <module>org.openhab.core.binding.xml.tests</module> -->
|
||||
<module>org.openhab.core.compat1x.tests</module>
|
||||
|
Loading…
Reference in New Issue
Block a user