From ebbae7f0da952455c66f914c64b8e9096c409d86 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 26 Jan 2014 17:12:15 +0100 Subject: [PATCH] added a first test suite --- .gitignore | 3 + .qmake.conf | 2 + Hive.pro | 5 +- libhive/devicemanager.cpp | 11 +-- libhive/devicemanager.h | 1 + server/jsonrpc/jsonrpcserver.cpp | 12 ++- server/jsonrpc/jsonrpcserver.h | 8 ++ server/main.cpp | 5 + server/ruleengine.cpp | 11 ++- server/ruleengine.h | 1 + server/server.pri | 21 +++++ server/server.pro | 26 +---- tests/auto/auto.pro | 17 ++++ tests/auto/mocktcpserver.cpp | 46 +++++++++ tests/auto/mocktcpserver.h | 37 ++++++++ tests/auto/testjsonrpc.cpp | 94 +++++++++++++++++++ .../devicepluginmockdevice.cpp | 80 ++++++++++++++++ .../mockdeviceplugin/devicepluginmockdevice.h | 26 +++++ .../devicepluginmockdevice.json | 1 + .../mockdeviceplugin/mockdeviceplugin.pro | 9 ++ tests/mocks/mocks.pro | 2 + tests/{ => scripts}/addconfigureddevice.sh | 0 tests/{ => scripts}/addrule.sh | 0 tests/{ => scripts}/executeaction.sh | 0 tests/{ => scripts}/getactiontypes.sh | 0 tests/{ => scripts}/getconfigureddevices.sh | 0 tests/{ => scripts}/getplugins.sh | 0 tests/{ => scripts}/getrules.sh | 0 tests/{ => scripts}/getsupporteddevices.sh | 0 tests/{ => scripts}/gettriggertypes.sh | 0 tests/{ => scripts}/introspect.sh | 0 tests/{ => scripts}/removerule.sh | 0 tests/{ => scripts}/setpluginconfig.sh | 0 tests/tests.pro | 4 + 34 files changed, 383 insertions(+), 39 deletions(-) create mode 100644 .gitignore create mode 100644 .qmake.conf create mode 100644 server/server.pri create mode 100644 tests/auto/auto.pro create mode 100644 tests/auto/mocktcpserver.cpp create mode 100644 tests/auto/mocktcpserver.h create mode 100644 tests/auto/testjsonrpc.cpp create mode 100644 tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp create mode 100644 tests/mocks/mockdeviceplugin/devicepluginmockdevice.h create mode 100644 tests/mocks/mockdeviceplugin/devicepluginmockdevice.json create mode 100644 tests/mocks/mockdeviceplugin/mockdeviceplugin.pro create mode 100644 tests/mocks/mocks.pro rename tests/{ => scripts}/addconfigureddevice.sh (100%) rename tests/{ => scripts}/addrule.sh (100%) rename tests/{ => scripts}/executeaction.sh (100%) rename tests/{ => scripts}/getactiontypes.sh (100%) rename tests/{ => scripts}/getconfigureddevices.sh (100%) rename tests/{ => scripts}/getplugins.sh (100%) rename tests/{ => scripts}/getrules.sh (100%) rename tests/{ => scripts}/getsupporteddevices.sh (100%) rename tests/{ => scripts}/gettriggertypes.sh (100%) rename tests/{ => scripts}/introspect.sh (100%) rename tests/{ => scripts}/removerule.sh (100%) rename tests/{ => scripts}/setpluginconfig.sh (100%) create mode 100644 tests/tests.pro diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..568d4ca0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pro.user +builddir +doc/html diff --git a/.qmake.conf b/.qmake.conf new file mode 100644 index 00000000..b303d719 --- /dev/null +++ b/.qmake.conf @@ -0,0 +1,2 @@ +top_srcdir=$$PWD +top_builddir=$$shadowed($$PWD) diff --git a/Hive.pro b/Hive.pro index eb637738..7c486705 100644 --- a/Hive.pro +++ b/Hive.pro @@ -1,10 +1,11 @@ TEMPLATE=subdirs -SUBDIRS += libhive server plugins +SUBDIRS += libhive server plugins tests server.depends = libhive plugins plugins.depends = libhive +tests.depends = libhive doc.depends = libhive server -doc.commands = cd ${PWD}; qdoc config.qdocconf +doc.commands = cd $$top_srcdir/doc; qdoc config.qdocconf QMAKE_EXTRA_TARGETS += doc diff --git a/libhive/devicemanager.cpp b/libhive/devicemanager.cpp index e770fa9d..f4352e4b 100644 --- a/libhive/devicemanager.cpp +++ b/libhive/devicemanager.cpp @@ -69,11 +69,6 @@ #include #include -Q_IMPORT_PLUGIN(DevicePluginElro) -Q_IMPORT_PLUGIN(DevicePluginIntertechno) -Q_IMPORT_PLUGIN(DevicePluginMeisterAnker) -Q_IMPORT_PLUGIN(DevicePluginWifiDetector) - /*! Constructs the DeviceManager with the given \a parent. There should only be one DeviceManager in the system created by \l{HiveCore}. Use \c HiveCore::instance()->deviceManager() instead to access the DeviceManager. */ @@ -84,8 +79,11 @@ DeviceManager::DeviceManager(QObject *parent) : m_pluginTimer.setInterval(15000); connect(&m_pluginTimer, &QTimer::timeout, this, &DeviceManager::timerEvent); + // Give hardware a chance to start up before loading plugins etc. QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "loadConfiguredDevices", Qt::QueuedConnection); + // Make sure this is always emitted after plugins and devices are loaded + QMetaObject::invokeMethod(this, "loaded", Qt::QueuedConnection); } /*! Returns all the \l{DevicePlugin}{DevicePlugins} loaded in the system. */ @@ -239,14 +237,13 @@ void DeviceManager::loadPlugins() m_devicePlugins.insert(pluginIface->pluginId(), pluginIface); connect(pluginIface, &DevicePlugin::emitTrigger, this, &DeviceManager::emitTrigger); } - } } void DeviceManager::loadConfiguredDevices() { QSettings settings; - qDebug() << "loading devices"; + qDebug() << "loading devices from" << settings.fileName(); foreach (const QString &idString, settings.childGroups()) { settings.beginGroup(idString); Device *device = new Device(settings.value("pluginid").toUuid(), QUuid(idString), settings.value("deviceClassId").toUuid(), this); diff --git a/libhive/devicemanager.h b/libhive/devicemanager.h index b0d490cb..65af97b4 100644 --- a/libhive/devicemanager.h +++ b/libhive/devicemanager.h @@ -49,6 +49,7 @@ public: DeviceClass findDeviceClass(const QUuid &deviceClassId) const; signals: + void loaded(); void emitTrigger(const Trigger &trigger); public slots: diff --git a/server/jsonrpc/jsonrpcserver.cpp b/server/jsonrpc/jsonrpcserver.cpp index 711ea5e4..e9f0404f 100644 --- a/server/jsonrpc/jsonrpcserver.cpp +++ b/server/jsonrpc/jsonrpcserver.cpp @@ -1,7 +1,11 @@ #include "jsonrpcserver.h" #include "jsontypes.h" +#ifdef TESTING_ENABLED +#include "mocktcpserver.h" +#else #include "tcpserver.h" +#endif #include "jsonhandler.h" #include "hivecore.h" @@ -21,9 +25,13 @@ JsonRPCServer::JsonRPCServer(QObject *parent): QObject(parent), +#ifdef TESTING_ENABLED + m_tcpServer(new MockTcpServer(this)) +#else m_tcpServer(new TcpServer(this)) +#endif { - connect(m_tcpServer, &TcpServer::jsonDataAvailable, this, &JsonRPCServer::processData); + connect(m_tcpServer, SIGNAL(jsonDataAvailable(int,QByteArray)), this, SLOT(processData(int,QByteArray))); m_tcpServer->startServer(); @@ -70,7 +78,7 @@ void JsonRPCServer::processData(int clientId, const QByteArray &jsonData) data.insert("types", JsonTypes::allTypes()); QVariantMap methods; foreach (JsonHandler *handler, m_handlers) { - qDebug() << "got handler" << handler->name() << handler->introspect(); +// qDebug() << "got handler" << handler->name() << handler->introspect(); methods.unite(handler->introspect()); } data.insert("methods", methods); diff --git a/server/jsonrpc/jsonrpcserver.h b/server/jsonrpc/jsonrpcserver.h index 823a6118..2696112b 100644 --- a/server/jsonrpc/jsonrpcserver.h +++ b/server/jsonrpc/jsonrpcserver.h @@ -9,7 +9,11 @@ #include #include +#ifdef TESTING_ENABLED +class MockTcpServer; +#else class TcpServer; +#endif class Device; class JsonHandler; @@ -32,7 +36,11 @@ private: void sendErrorResponse(int clientId, int commandId, const QString &error); private: +#ifdef TESTING_ENABLED + MockTcpServer *m_tcpServer; +#else TcpServer *m_tcpServer; +#endif QHash m_handlers; }; diff --git a/server/main.cpp b/server/main.cpp index 7171335a..e30f3aae 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -3,6 +3,11 @@ #include +Q_IMPORT_PLUGIN(DevicePluginElro) +Q_IMPORT_PLUGIN(DevicePluginIntertechno) +Q_IMPORT_PLUGIN(DevicePluginMeisterAnker) +Q_IMPORT_PLUGIN(DevicePluginWifiDetector) + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); diff --git a/server/ruleengine.cpp b/server/ruleengine.cpp index ea4e6255..e44270a8 100644 --- a/server/ruleengine.cpp +++ b/server/ruleengine.cpp @@ -42,8 +42,7 @@ #include #include #include - -QString rulesFileName = "hiveyourhome/rules"; +#include /*! Constructs the RuleEngine with the given \a parent. Although it wouldn't harm to have multiple RuleEngines, there is one instance available from \l{HiveCore}. This one should be used instead of creating multiple ones. @@ -51,7 +50,9 @@ QString rulesFileName = "hiveyourhome/rules"; RuleEngine::RuleEngine(QObject *parent) : QObject(parent) { - QSettings settings(rulesFileName); + m_settingsFile = QCoreApplication::instance()->organizationName() + "/rules"; + qDebug() << "laoding rules from" << m_settingsFile; + QSettings settings(m_settingsFile); foreach (const QString &idString, settings.childGroups()) { qDebug() << "found rule" << idString; @@ -160,7 +161,7 @@ RuleEngine::RuleError RuleEngine::addRule(const Trigger &trigger, const QList m_rules; }; diff --git a/server/server.pri b/server/server.pri new file mode 100644 index 00000000..6d9ce447 --- /dev/null +++ b/server/server.pri @@ -0,0 +1,21 @@ +SOURCES += $$top_srcdir/server/hivecore.cpp \ + $$top_srcdir/server/tcpserver.cpp \ + $$top_srcdir/server/ruleengine.cpp \ + $$top_srcdir/server/rule.cpp \ + $$top_srcdir/server/jsonrpc/jsonrpcserver.cpp \ + $$top_srcdir/server/jsonrpc/jsonhandler.cpp \ + $$top_srcdir/server/jsonrpc/devicehandler.cpp \ + $$top_srcdir/server/jsonrpc/jsontypes.cpp \ + $$top_srcdir/server/jsonrpc/ruleshandler.cpp \ + $$top_srcdir/server/jsonrpc/actionhandler.cpp + +HEADERS += $$top_srcdir/server/hivecore.h \ + $$top_srcdir/server/tcpserver.h \ + $$top_srcdir/server/ruleengine.h \ + $$top_srcdir/server/rule.h \ + $$top_srcdir/server/jsonrpc/jsonrpcserver.h \ + $$top_srcdir/server/jsonrpc/jsonhandler.h \ + $$top_srcdir/server/jsonrpc/devicehandler.h \ + $$top_srcdir/server/jsonrpc/jsontypes.h \ + $$top_srcdir/server/jsonrpc/ruleshandler.h \ + $$top_srcdir/server/jsonrpc/actionhandler.h diff --git a/server/server.pro b/server/server.pro index 9f0fb69e..833d8eec 100644 --- a/server/server.pro +++ b/server/server.pro @@ -9,30 +9,10 @@ INSTALLS += target QT += network CONFIG += c++11 -LIBS += -L../libhive/ -lhive +LIBS += -L$$top_builddir/libhive/ -lhive -SOURCES += main.cpp \ - hivecore.cpp \ - tcpserver.cpp \ - ruleengine.cpp \ - rule.cpp \ - jsonrpc/jsonrpcserver.cpp \ - jsonrpc/jsonhandler.cpp \ - jsonrpc/devicehandler.cpp \ - jsonrpc/jsontypes.cpp \ - jsonrpc/ruleshandler.cpp \ - jsonrpc/actionhandler.cpp - -HEADERS += hivecore.h \ - tcpserver.h \ - ruleengine.h \ - rule.h \ - jsonrpc/jsonrpcserver.h \ - jsonrpc/jsonhandler.h \ - jsonrpc/devicehandler.h \ - jsonrpc/jsontypes.h \ - jsonrpc/ruleshandler.h \ - jsonrpc/actionhandler.h +include(server.pri) +SOURCES += main.cpp # FIXME: Drop this and link them dynamically LIBS += -L../plugins/deviceplugins/elro/ -lhive_devicepluginelro diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro new file mode 100644 index 00000000..b7b32004 --- /dev/null +++ b/tests/auto/auto.pro @@ -0,0 +1,17 @@ +TARGET = hivetests +QT += testlib network +CONFIG += testcase +DEFINES += TESTING_ENABLED + +INCLUDEPATH += $$top_srcdir/server/ $$top_srcdir/server/jsonrpc $$top_srcdir/libhive $$top_srcdir/tests/auto/ +LIBS += -L$$top_builddir/libhive/ -lhive +QMAKE_LFLAGS += -Wl,--rpath=$$top_builddir/libhive + +include($$top_srcdir/server/server.pri) + +SOURCES += testjsonrpc.cpp \ + mocktcpserver.cpp + +HEADERS += mocktcpserver.h + +LIBS += -L../mocks/mockdeviceplugin/ -lhive_devicepluginmockdevice diff --git a/tests/auto/mocktcpserver.cpp b/tests/auto/mocktcpserver.cpp new file mode 100644 index 00000000..6f7c5b4a --- /dev/null +++ b/tests/auto/mocktcpserver.cpp @@ -0,0 +1,46 @@ +#include "mocktcpserver.h" + +QList MockTcpServer::s_allServers; + +MockTcpServer::MockTcpServer(QObject *parent): + QObject(parent) +{ + s_allServers.append(this); +} + +MockTcpServer::~MockTcpServer() +{ + s_allServers.removeAll(this); +} + +void MockTcpServer::sendResponse(int clientId, const QByteArray &data) +{ + emit outgoingData(clientId, data); +} + +QList MockTcpServer::servers() +{ + return s_allServers; +} + +void MockTcpServer::injectData(int clientId, const QByteArray &data) +{ + emit jsonDataAvailable(clientId, data); +} + +bool MockTcpServer::startServer() +{ + qDebug() << "should start server"; + return true; +} + +bool MockTcpServer::stopServer() +{ + qDebug() << "should stop server"; + return true; +} + +void MockTcpServer::sendToAll(QByteArray data) +{ + qDebug() << "should send to all clients:" << data; +} diff --git a/tests/auto/mocktcpserver.h b/tests/auto/mocktcpserver.h new file mode 100644 index 00000000..a53f7e0e --- /dev/null +++ b/tests/auto/mocktcpserver.h @@ -0,0 +1,37 @@ +#ifndef MOCKTCPSERVER_H +#define MOCKTCPSERVER_H + +#include +#include +#include + +class MockTcpServer : public QObject +{ + Q_OBJECT +public: + explicit MockTcpServer(QObject *parent = 0); + ~MockTcpServer(); + + void sendResponse(int clientId, const QByteArray &data); + +/************** Used for testing **************************/ + static QList servers(); + void injectData(int clientId, const QByteArray &data); +signals: + void outgoingData(int clientId, const QByteArray &data); +/************** Used for testing **************************/ + +signals: + void jsonDataAvailable(int clientId, const QByteArray &data); + +public slots: + bool startServer(); + bool stopServer(); + void sendToAll(QByteArray data); + +private: + static QList s_allServers; +}; + +#endif // TCPSERVER_H + diff --git a/tests/auto/testjsonrpc.cpp b/tests/auto/testjsonrpc.cpp new file mode 100644 index 00000000..ed00f103 --- /dev/null +++ b/tests/auto/testjsonrpc.cpp @@ -0,0 +1,94 @@ +#include "hivecore.h" +#include "devicemanager.h" +#include "mocktcpserver.h" + +#include +#include +//#include + +Q_IMPORT_PLUGIN(DevicePluginMockDevice) + +class TestJSONRPC: public QObject +{ + Q_OBJECT +private slots: + void initTestcase(); + void introspect(); + void getSupportedDevices(); + +private: + MockTcpServer *m_mockTcpServer; + int m_clientId; +}; + +void TestJSONRPC::initTestcase() +{ + QCoreApplication::instance()->setOrganizationName("hiveyourhome-test"); + qDebug() << "creating core"; + HiveCore::instance(); + qDebug() << "creating spy"; + + // Wait for the DeviceManager to signal that it has loaded plugins and everything + QSignalSpy spy(HiveCore::instance()->deviceManager(), SIGNAL(loaded())); + QVERIFY(spy.isValid()); + QVERIFY(spy.wait()); + + // If Hive should create more than one TcpServer at some point, this needs to be updated. + QCOMPARE(MockTcpServer::servers().count(), 1); + m_mockTcpServer = MockTcpServer::servers().first(); + m_clientId = 0; +} + +void TestJSONRPC::introspect() +{ + QSignalSpy spy(m_mockTcpServer, SIGNAL(outgoingData(int,QByteArray))); + QVERIFY(spy.isValid()); + + m_mockTcpServer->injectData(m_clientId, "{\"id\":42, \"method\":\"JSONRPC.Introspect\"}"); + + if (spy.count() == 0) { + spy.wait(); + } + + // Make sure we got exactly one response + QVERIFY(spy.count() == 1); + + // Make sure the introspect response goes to the correct clientId + QCOMPARE(spy.first().first().toInt(), m_clientId); + + // Make sure the response it a valid JSON string + QJsonParseError error; + QJsonDocument jsonDoc = QJsonDocument::fromJson(spy.first().last().toByteArray(), &error); + QCOMPARE(error.error, QJsonParseError::NoError); + + // Make sure the response's id is the same as our command + QCOMPARE(jsonDoc.toVariant().toMap().value("id").toInt(), 42); +} + +void TestJSONRPC::getSupportedDevices() +{ + QSignalSpy spy(m_mockTcpServer, SIGNAL(outgoingData(int,QByteArray))); + + m_mockTcpServer->injectData(m_clientId, "{\"id\":1, \"method\":\"Devices.GetSupportedDevices\"}"); + + if (spy.count() == 0) { + spy.wait(); + } + + // Make sure the response it a valid JSON string + QJsonParseError error; + QJsonDocument jsonDoc = QJsonDocument::fromJson(spy.first().last().toByteArray(), &error); + QCOMPARE(error.error, QJsonParseError::NoError); + + QVariant supportedDevices = jsonDoc.toVariant(); + + qDebug() << spy.first().last(); + + // Make sure there is exactly 1 supported device class with the name Mock Wifi Device + QCOMPARE(supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().count(), 1); + QString deviceName = supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().first().toMap().value("name").toString(); + QCOMPARE(deviceName, QString("Mock WiFi Device")); +} + +QTEST_MAIN(TestJSONRPC) +#include "testjsonrpc.moc" diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp new file mode 100644 index 00000000..e0e935ce --- /dev/null +++ b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp @@ -0,0 +1,80 @@ +#include "devicepluginmockdevice.h" + +#include "device.h" +#include "devicemanager.h" + +#include +#include + +QUuid pluginUuid = QUuid("2ce2ebc6-7dbb-4b89-ad67-6226aa955041"); +QUuid mockWifiDetectorId = QUuid("37279e41-a478-43fa-92b4-c889db578670"); +QUuid inRangeStateTypeId = QUuid("110deaf9-5615-4e08-942b-d5443a3bf965"); +QUuid inRangeTriggerTypeId = QUuid("7f77120e-b3d1-493f-936e-9d86d7489785"); + +DevicePluginMockDevice::DevicePluginMockDevice() +{ +} + +QList DevicePluginMockDevice::supportedDevices() const +{ + QList ret; + + DeviceClass deviceClassMockWifiDetector(pluginId(), mockWifiDetectorId); + deviceClassMockWifiDetector.setName("Mock WiFi Device"); + + QVariantList detectorParams; + QVariantMap macParam; + macParam.insert("name", "mac"); + macParam.insert("type", "string"); + detectorParams.append(macParam); + + deviceClassMockWifiDetector.setParams(detectorParams); + + QList detectorStates; + + StateType inRangeState(inRangeStateTypeId); + inRangeState.setName("inRange"); + inRangeState.setType(QVariant::Bool); + inRangeState.setDefaultValue(false); + detectorStates.append(inRangeState); + + deviceClassMockWifiDetector.setStates(detectorStates); + + QList detectorTriggers; + + QVariantList detectorTriggerParams; + QVariantMap paramInRange; + paramInRange.insert("name", "inRange"); + paramInRange.insert("type", "bool"); + detectorTriggerParams.append(paramInRange); + + TriggerType inRangeTrigger(inRangeTriggerTypeId); + inRangeTrigger.setName("inRange"); + inRangeTrigger.setParameters(detectorTriggerParams); + detectorTriggers.append(inRangeTrigger); + + deviceClassMockWifiDetector.setTriggers(detectorTriggers); + ret.append(deviceClassMockWifiDetector); + + return ret; +} + +DeviceManager::HardwareResources DevicePluginMockDevice::requiredHardware() const +{ + return DeviceManager::HardwareResourceTimer; +} + +QString DevicePluginMockDevice::pluginName() const +{ + return "WiFi Detector"; +} + +QUuid DevicePluginMockDevice::pluginId() const +{ + return pluginUuid; +} + +void DevicePluginMockDevice::hiveTimer() +{ +} + diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h new file mode 100644 index 00000000..8b1c0255 --- /dev/null +++ b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h @@ -0,0 +1,26 @@ +#ifndef DEVICEPLUGINMOCKDEVICE_H +#define DEVICEPLUGINMOCKDEVICE_H + +#include "deviceplugin.h" + +class DevicePluginMockDevice: public DevicePlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "org.hiveyourhome.DevicePlugin" FILE "devicepluginmockdevice.json") + Q_INTERFACES(DevicePlugin) + +public: + explicit DevicePluginMockDevice(); + + QList supportedDevices() const override; + DeviceManager::HardwareResources requiredHardware() const override; + + QString pluginName() const override; + QUuid pluginId() const override; + + void hiveTimer() override; + +}; + +#endif // DEVICEPLUGINMOCKDEVICE_H diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json @@ -0,0 +1 @@ +{} diff --git a/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro b/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro new file mode 100644 index 00000000..8fb5ccaf --- /dev/null +++ b/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro @@ -0,0 +1,9 @@ +include($$top_srcdir/plugins/plugins.pri) + +TARGET = $$qtLibraryTarget(hive_devicepluginmockdevice) + +SOURCES += \ + devicepluginmockdevice.cpp + +HEADERS += \ + devicepluginmockdevice.h diff --git a/tests/mocks/mocks.pro b/tests/mocks/mocks.pro new file mode 100644 index 00000000..733c0137 --- /dev/null +++ b/tests/mocks/mocks.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += mockdeviceplugin diff --git a/tests/addconfigureddevice.sh b/tests/scripts/addconfigureddevice.sh similarity index 100% rename from tests/addconfigureddevice.sh rename to tests/scripts/addconfigureddevice.sh diff --git a/tests/addrule.sh b/tests/scripts/addrule.sh similarity index 100% rename from tests/addrule.sh rename to tests/scripts/addrule.sh diff --git a/tests/executeaction.sh b/tests/scripts/executeaction.sh similarity index 100% rename from tests/executeaction.sh rename to tests/scripts/executeaction.sh diff --git a/tests/getactiontypes.sh b/tests/scripts/getactiontypes.sh similarity index 100% rename from tests/getactiontypes.sh rename to tests/scripts/getactiontypes.sh diff --git a/tests/getconfigureddevices.sh b/tests/scripts/getconfigureddevices.sh similarity index 100% rename from tests/getconfigureddevices.sh rename to tests/scripts/getconfigureddevices.sh diff --git a/tests/getplugins.sh b/tests/scripts/getplugins.sh similarity index 100% rename from tests/getplugins.sh rename to tests/scripts/getplugins.sh diff --git a/tests/getrules.sh b/tests/scripts/getrules.sh similarity index 100% rename from tests/getrules.sh rename to tests/scripts/getrules.sh diff --git a/tests/getsupporteddevices.sh b/tests/scripts/getsupporteddevices.sh similarity index 100% rename from tests/getsupporteddevices.sh rename to tests/scripts/getsupporteddevices.sh diff --git a/tests/gettriggertypes.sh b/tests/scripts/gettriggertypes.sh similarity index 100% rename from tests/gettriggertypes.sh rename to tests/scripts/gettriggertypes.sh diff --git a/tests/introspect.sh b/tests/scripts/introspect.sh similarity index 100% rename from tests/introspect.sh rename to tests/scripts/introspect.sh diff --git a/tests/removerule.sh b/tests/scripts/removerule.sh similarity index 100% rename from tests/removerule.sh rename to tests/scripts/removerule.sh diff --git a/tests/setpluginconfig.sh b/tests/scripts/setpluginconfig.sh similarity index 100% rename from tests/setpluginconfig.sh rename to tests/scripts/setpluginconfig.sh diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 00000000..958dd618 --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = mocks auto + +auto.depens = mocks