add mock device debugs
recheck rule tests
This commit is contained in:
parent
99cf429335
commit
ef874a8c42
@ -63,6 +63,7 @@ void HttpDaemon::incomingConnection(qintptr socket)
|
|||||||
|
|
||||||
void HttpDaemon::actionExecuted(const ActionTypeId &actionTypeId)
|
void HttpDaemon::actionExecuted(const ActionTypeId &actionTypeId)
|
||||||
{
|
{
|
||||||
|
qCDebug(dcMockDevice) << "Log actions executed" << actionTypeId.toString();
|
||||||
m_actionList.append(qMakePair<ActionTypeId, QDateTime>(actionTypeId, QDateTime::currentDateTime()));
|
m_actionList.append(qMakePair<ActionTypeId, QDateTime>(actionTypeId, QDateTime::currentDateTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,19 +82,24 @@ void HttpDaemon::readClient()
|
|||||||
QUrl url("http://foo.bar" + tokens[1]);
|
QUrl url("http://foo.bar" + tokens[1]);
|
||||||
QUrlQuery query(url);
|
QUrlQuery query(url);
|
||||||
if (url.path() == "/setstate") {
|
if (url.path() == "/setstate") {
|
||||||
|
qCDebug(dcMockDevice) << "Set state value" << query.queryItems().first().second;
|
||||||
emit setState(StateTypeId(query.queryItems().first().first), QVariant(query.queryItems().first().second));
|
emit setState(StateTypeId(query.queryItems().first().first), QVariant(query.queryItems().first().second));
|
||||||
} else if (url.path() == "/generateevent") {
|
} else if (url.path() == "/generateevent") {
|
||||||
emit triggerEvent(EventTypeId(query.queryItemValue("eventtypeid")));
|
emit triggerEvent(EventTypeId(query.queryItemValue("eventtypeid")));
|
||||||
} else if (url.path() == "/actionhistory") {
|
} else if (url.path() == "/actionhistory") {
|
||||||
|
qCDebug(dcMockDevice) << "Get action history called";
|
||||||
|
|
||||||
QTextStream os(socket);
|
QTextStream os(socket);
|
||||||
os.setAutoDetectUnicode(true);
|
os.setAutoDetectUnicode(true);
|
||||||
os << generateHeader();
|
os << generateHeader();
|
||||||
for (int i = 0; i < m_actionList.count(); ++i) {
|
for (int i = 0; i < m_actionList.count(); ++i) {
|
||||||
os << m_actionList.at(i).first.toString() << '\n';
|
os << m_actionList.at(i).first.toString() << '\n';
|
||||||
|
qCDebug(dcMockDevice) << " " << m_actionList.at(i).first.toString();
|
||||||
}
|
}
|
||||||
socket->close();
|
socket->close();
|
||||||
return;
|
return;
|
||||||
} else if (url.path() == "/clearactionhistory") {
|
} else if (url.path() == "/clearactionhistory") {
|
||||||
|
qCDebug(dcMockDevice) << "Clear action history";
|
||||||
m_actionList.clear();
|
m_actionList.clear();
|
||||||
}
|
}
|
||||||
if (tokens[0] == "GET") {
|
if (tokens[0] == "GET") {
|
||||||
|
|||||||
@ -818,6 +818,7 @@ void TestRules::executeRuleActions()
|
|||||||
cleanupMockHistory();
|
cleanupMockHistory();
|
||||||
|
|
||||||
// EXECUTE actions
|
// EXECUTE actions
|
||||||
|
qDebug() << "Execute rule actions";
|
||||||
QVariantMap executeParams;
|
QVariantMap executeParams;
|
||||||
executeParams.insert("ruleId", ruleId.toString());
|
executeParams.insert("ruleId", ruleId.toString());
|
||||||
response = injectAndWait("Rules.ExecuteActions", executeParams);
|
response = injectAndWait("Rules.ExecuteActions", executeParams);
|
||||||
@ -835,6 +836,7 @@ void TestRules::executeRuleActions()
|
|||||||
cleanupMockHistory();
|
cleanupMockHistory();
|
||||||
|
|
||||||
// EXECUTE exit actions
|
// EXECUTE exit actions
|
||||||
|
qDebug() << "Execute rule exit actions";
|
||||||
response = injectAndWait("Rules.ExecuteExitActions", executeParams);
|
response = injectAndWait("Rules.ExecuteExitActions", executeParams);
|
||||||
verifyRuleError(response, ruleError);
|
verifyRuleError(response, ruleError);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user