aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qcoapclient/tst_qcoapclient.cpp103
-rw-r--r--tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp20
-rw-r--r--tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp34
-rw-r--r--tests/auto/qcoapmessage/tst_qcoapmessage.cpp12
-rw-r--r--tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp20
-rw-r--r--tests/auto/qcoapreply/tst_qcoapreply.cpp18
-rw-r--r--tests/auto/qcoaprequest/tst_qcoaprequest.cpp8
7 files changed, 113 insertions, 102 deletions
diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp
index 04db9f4..3e5eac0 100644
--- a/tests/auto/qcoapclient/tst_qcoapclient.cpp
+++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp
@@ -228,16 +228,23 @@ void tst_QCoapClient::methods_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QtCoap::Method>("method");
- QTest::newRow("get") << QUrl(testServerResource()) << QtCoap::Get;
- QTest::newRow("get_no_port")
- << QUrl("coap://" + testServerHost() + "/test") << QtCoap::Get;
- QTest::newRow("get_no_scheme_no_port") << QUrl(testServerHost() + "/test") << QtCoap::Get;
- QTest::newRow("post") << QUrl(testServerResource()) << QtCoap::Post;
- QTest::newRow("post_no_scheme_no_port") << QUrl(testServerHost() + "/test") << QtCoap::Post;
- QTest::newRow("put") << QUrl(testServerResource()) << QtCoap::Put;
- QTest::newRow("put_no_scheme_no_port") << QUrl(testServerHost() + "/test") << QtCoap::Put;
- QTest::newRow("delete") << QUrl(testServerResource()) << QtCoap::Delete;
- QTest::newRow("delete_no_scheme_no_port") << QUrl(testServerHost() + "/test") << QtCoap::Delete;
+ QTest::newRow("get") << QUrl(testServerResource()) << QtCoap::Method::Get;
+ QTest::newRow("get_no_port") << QUrl("coap://" + testServerHost() + "/test")
+ << QtCoap::Method::Get;
+ QTest::newRow("get_no_scheme_no_port") << QUrl(testServerHost() + "/test")
+ << QtCoap::Method::Get;
+ QTest::newRow("post") << QUrl(testServerResource())
+ << QtCoap::Method::Post;
+ QTest::newRow("post_no_scheme_no_port") << QUrl(testServerHost() + "/test")
+ << QtCoap::Method::Post;
+ QTest::newRow("put") << QUrl(testServerResource())
+ << QtCoap::Method::Put;
+ QTest::newRow("put_no_scheme_no_port") << QUrl(testServerHost() + "/test")
+ << QtCoap::Method::Put;
+ QTest::newRow("delete") << QUrl(testServerResource())
+ << QtCoap::Method::Delete;
+ QTest::newRow("delete_no_scheme_no_port") << QUrl(testServerHost() + "/test")
+ << QtCoap::Method::Delete;
}
void tst_QCoapClient::methods()
@@ -275,16 +282,16 @@ void tst_QCoapClient::methods()
replyData = reply->readAll();
if (qstrncmp(QTest::currentDataTag(), "get", 3) == 0) {
QVERIFY(!replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Content);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Content);
} else if (qstrncmp(QTest::currentDataTag(), "post", 4) == 0) {
QVERIFY(replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Created);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Created);
} else if (qstrncmp(QTest::currentDataTag(), "put", 3) == 0) {
QVERIFY(replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Changed);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Changed);
} else if (qstrncmp(QTest::currentDataTag(), "delete", 6) == 0) {
QVERIFY(replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Deleted);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Deleted);
} else {
QString error = QLatin1Literal("Unrecognized method '") + QTest::currentDataTag() + "'";
QFAIL(qPrintable(error));
@@ -305,7 +312,7 @@ void tst_QCoapClient::separateMethod()
QByteArray replyData = reply->readAll();
QVERIFY(!replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Content);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Content);
}
void tst_QCoapClient::removeReply()
@@ -386,10 +393,10 @@ void tst_QCoapClient::requestWithQIODevice()
if (qstrcmp(QTest::currentDataTag(), "post") == 0) {
QVERIFY(replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Created);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Created);
} else if (qstrcmp(QTest::currentDataTag(), "put") == 0) {
QVERIFY(replyData.isEmpty());
- QCOMPARE(reply->responseCode(), QtCoap::Changed);
+ QCOMPARE(reply->responseCode(), QtCoap::ResponseCode::Changed);
}
}
@@ -425,10 +432,10 @@ void tst_QCoapClient::multipleRequests()
QByteArray replyData3 = replyGet3->readAll();
QByteArray replyData4 = replyGet4->readAll();
- QCOMPARE(replyGet1->responseCode(), QtCoap::Content);
- QCOMPARE(replyGet2->responseCode(), QtCoap::Content);
- QCOMPARE(replyGet3->responseCode(), QtCoap::Content);
- QCOMPARE(replyGet4->responseCode(), QtCoap::Content);
+ QCOMPARE(replyGet1->responseCode(), QtCoap::ResponseCode::Content);
+ QCOMPARE(replyGet2->responseCode(), QtCoap::ResponseCode::Content);
+ QCOMPARE(replyGet3->responseCode(), QtCoap::ResponseCode::Content);
+ QCOMPARE(replyGet4->responseCode(), QtCoap::ResponseCode::Content);
QVERIFY(replyData1 != replyData2);
QVERIFY(replyData1 != replyData3);
@@ -454,7 +461,8 @@ void tst_QCoapClient::socketError()
QTRY_COMPARE_WITH_TIMEOUT(spySocketError.count(), 1, 10000);
QTRY_COMPARE_WITH_TIMEOUT(spyClientError.count(), 1, 1000);
- QCOMPARE(spyClientError.first().at(1), QtCoap::AddressInUseError);
+ QCOMPARE(qvariant_cast<QtCoap::Error>(spyClientError.first().at(1)),
+ QtCoap::Error::AddressInUse);
#else
QSKIP("Not an internal build, skipping this test");
#endif
@@ -483,7 +491,8 @@ void tst_QCoapClient::timeout()
QElapsedTimer timeoutTimer;
timeoutTimer.start();
- QScopedPointer<QCoapReply> reply(client.get(QCoapRequest(url, QCoapMessage::Confirmable)));
+ QScopedPointer<QCoapReply> reply(
+ client.get(QCoapRequest(url, QCoapMessage::MessageType::Confirmable)));
QSignalSpy spyClientError(&client, &QCoapClient::error);
QSignalSpy spyReplyError(reply.data(), &QCoapReply::error);
QSignalSpy spyReplyAborted(reply.data(), &QCoapReply::aborted);
@@ -506,7 +515,8 @@ void tst_QCoapClient::timeout()
QVERIFY2(elapsedTime > 0.9 * client.protocol()->maxTransmitWait() - 20 * transmissions,
qPrintable(errorMessage));
- QCOMPARE(spyReplyError.first().at(1), QtCoap::TimeOutError);
+ QCOMPARE(qvariant_cast<QtCoap::Error>(spyReplyError.first().at(1)),
+ QtCoap::Error::TimeOut);
QCOMPARE(spyReplyFinished.count(), 1);
QCOMPARE(spyReplyAborted.count(), 0);
QCOMPARE(spyClientError.count(), 1);
@@ -563,27 +573,27 @@ void tst_QCoapClient::blockwiseReply_data()
QTest::newRow("get_large")
<< QUrl(testServerUrl() + "/large")
- << QCoapMessage::NonConfirmable
+ << QCoapMessage::MessageType::NonConfirmable
<< data;
QTest::newRow("get_large_separate")
<< QUrl(testServerUrl() + "/large-separate")
- << QCoapMessage::NonConfirmable
+ << QCoapMessage::MessageType::NonConfirmable
<< data;
QTest::newRow("get_large_confirmable")
<< QUrl(testServerUrl() + "/large")
- << QCoapMessage::Confirmable
+ << QCoapMessage::MessageType::Confirmable
<< data;
QTest::newRow("get_large_separate_confirmable")
<< QUrl(testServerUrl() + "/large-separate")
- << QCoapMessage::Confirmable
+ << QCoapMessage::MessageType::Confirmable
<< data;
QTest::newRow("get_large_16bits")
<< QUrl(testServerUrl() + "/large")
- << QCoapMessage::NonConfirmable
+ << QCoapMessage::MessageType::NonConfirmable
<< data;
QTest::newRow("get_large_16bits_confirmable")
<< QUrl(testServerUrl() + "/large")
- << QCoapMessage::Confirmable
+ << QCoapMessage::MessageType::Confirmable
<< data;
}
@@ -625,14 +635,14 @@ void tst_QCoapClient::blockwiseRequest_data()
data.append(alphabet);
QTest::newRow("large_post_empty_reply") << QUrl(testServerUrl() + "/query")
- << QCoapMessage::NonConfirmable
+ << QCoapMessage::MessageType::NonConfirmable
<< data
- << QtCoap::MethodNotAllowed
+ << QtCoap::ResponseCode::MethodNotAllowed
<< QByteArray();
QTest::newRow("large_post_large_reply") << QUrl(testServerUrl() + "/large-post")
- << QCoapMessage::NonConfirmable
+ << QCoapMessage::MessageType::NonConfirmable
<< data
- << QtCoap::Changed
+ << QtCoap::ResponseCode::Changed
<< data.toUpper();
}
@@ -688,7 +698,7 @@ void tst_QCoapClient::discover()
const auto discoverUrl = QUrl(url.toString() + "/.well-known/core");
QCOMPARE(resourcesReply->url(), QCoapRequest::adjustedUrl(discoverUrl, false));
QCOMPARE(resourcesReply->resources().length(), resourceNumber);
- QCOMPARE(resourcesReply->request().method(), QtCoap::Get);
+ QCOMPARE(resourcesReply->request().method(), QtCoap::Method::Get);
//! TODO Test discovery content too
}
@@ -701,39 +711,39 @@ void tst_QCoapClient::observe_data()
QTest::newRow("observe")
<< QUrl(testServerUrl() + "/obs")
- << QCoapMessage::NonConfirmable;
+ << QCoapMessage::MessageType::NonConfirmable;
QTest::newRow("observe_no_scheme_no_port")
<< QUrl(testServerHost() + "/obs")
- << QCoapMessage::NonConfirmable;
+ << QCoapMessage::MessageType::NonConfirmable;
QTest::newRow("observe_confirmable")
<< QUrl(testServerUrl() + "/obs")
- << QCoapMessage::Confirmable;
+ << QCoapMessage::MessageType::Confirmable;
QTest::newRow("observe_receive")
<< QUrl(testServerUrl() + "/obs-non")
- << QCoapMessage::NonConfirmable;
+ << QCoapMessage::MessageType::NonConfirmable;
QTest::newRow("observe_receive_confirmable")
<< QUrl(testServerUrl() + "/obs-non")
- << QCoapMessage::Confirmable;
+ << QCoapMessage::MessageType::Confirmable;
QTest::newRow("observe_large")
<< QUrl(testServerUrl() + "/obs-large")
- << QCoapMessage::NonConfirmable;
+ << QCoapMessage::MessageType::NonConfirmable;
QTest::newRow("observe_large_confirmable")
<< QUrl(testServerUrl() + "/obs-large")
- << QCoapMessage::Confirmable;
+ << QCoapMessage::MessageType::Confirmable;
QTest::newRow("observe_pumping")
<< QUrl(testServerUrl() + "/obs-pumping")
- << QCoapMessage::NonConfirmable;
+ << QCoapMessage::MessageType::NonConfirmable;
QTest::newRow("observe_pumping_confirmable")
<< QUrl(testServerUrl() + "/obs-pumping")
- << QCoapMessage::Confirmable;
+ << QCoapMessage::MessageType::Confirmable;
}
void tst_QCoapClient::observe()
@@ -753,7 +763,7 @@ void tst_QCoapClient::observe()
QTRY_COMPARE_WITH_TIMEOUT(spyReplyNotified.count(), 3, 30000);
client.cancelObserve(reply.data());
QCOMPARE(reply->url(), QCoapRequest::adjustedUrl(url, false));
- QCOMPARE(reply->request().method(), QtCoap::Get);
+ QCOMPARE(reply->request().method(), QtCoap::Method::Get);
QVERIFY2(!spyReplyNotified.wait(7000), "'Notify' signal received after cancelling observe");
QCOMPARE(spyReplyFinished.count(), 1);
@@ -769,7 +779,8 @@ void tst_QCoapClient::observe()
void tst_QCoapClient::confirmableMulticast()
{
QCoapClient client;
- const auto reply = client.get(QCoapRequest("224.0.1.187", QCoapMessage::Confirmable));
+ const auto reply = client.get(QCoapRequest("224.0.1.187",
+ QCoapMessage::MessageType::Confirmable));
QVERIFY2(!reply, "Confirmable multicast request didn't fail as expected.");
}
diff --git a/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp b/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp
index 58bd51b..da2531b 100644
--- a/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp
+++ b/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp
@@ -72,8 +72,8 @@ void tst_QCoapInternalReply::parseReplyPdu_data()
QList<QByteArray> bigOptionValueReply({QByteArray("abcdefghijklmnopqrstuvwxyz")});
QTest::newRow("reply_with_options_and_payload")
- << QtCoap::Content
- << QCoapMessage::NonConfirmable
+ << QtCoap::ResponseCode::Content
+ << QCoapMessage::MessageType::NonConfirmable
<< quint16(64463)
<< QByteArray("4647f09b")
<< quint8(4)
@@ -86,8 +86,8 @@ void tst_QCoapInternalReply::parseReplyPdu_data()
"3962";
QTest::newRow("reply_with_payload")
- << QtCoap::Content
- << QCoapMessage::NonConfirmable
+ << QtCoap::ResponseCode::Content
+ << QCoapMessage::MessageType::NonConfirmable
<< quint16(64463)
<< QByteArray("4647f09b")
<< quint8(4)
@@ -99,8 +99,8 @@ void tst_QCoapInternalReply::parseReplyPdu_data()
"474554290a4d49443a2035363430300a546f6b656e3a203436343766303962";
QTest::newRow("reply_with_options")
- << QtCoap::Content
- << QCoapMessage::NonConfirmable
+ << QtCoap::ResponseCode::Content
+ << QCoapMessage::MessageType::NonConfirmable
<< quint16(64463)
<< QByteArray("4647f09b")
<< quint8(4)
@@ -111,8 +111,8 @@ void tst_QCoapInternalReply::parseReplyPdu_data()
<< "5445fbcf4647f09bc0211e";
QTest::newRow("reply_only")
- << QtCoap::Content
- << QCoapMessage::NonConfirmable
+ << QtCoap::ResponseCode::Content
+ << QCoapMessage::MessageType::NonConfirmable
<< quint16(64463)
<< QByteArray("4647f09b")
<< quint8(4)
@@ -123,8 +123,8 @@ void tst_QCoapInternalReply::parseReplyPdu_data()
<< "5445fbcf4647f09b";
QTest::newRow("reply_with_big_option")
- << QtCoap::Content
- << QCoapMessage::NonConfirmable
+ << QtCoap::ResponseCode::Content
+ << QCoapMessage::MessageType::NonConfirmable
<< quint16(64463)
<< QByteArray("4647f09b")
<< quint8(4)
diff --git a/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp b/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp
index f6d4160..6a61eb1 100644
--- a/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp
+++ b/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp
@@ -71,8 +71,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_with_option_and_payload")
<< QUrl("coap://10.20.30.40:5683/test")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09bb474657374ff"
@@ -80,8 +80,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_domain")
<< QUrl("coap://domain.com:5683/test")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09b3a646f6d61696e2e636f6d8474657374ff"
@@ -89,8 +89,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_ipv6")
<< QUrl("coap://[::ffff:ac11:3]:5683/test")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09bb474657374ff"
@@ -98,8 +98,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_without_payload")
<< QUrl("coap://10.20.30.40:5683/test")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09bb474657374"
@@ -107,8 +107,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_without_option")
<< QUrl("coap://10.20.30.40:5683/")
- << QtCoap::Put
- << QCoapRequest::Confirmable
+ << QtCoap::Method::Put
+ << QCoapRequest::MessageType::Confirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "4403dc504647f09bff"
@@ -116,8 +116,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_only")
<< QUrl("coap://10.20.30.40:5683/")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09b"
@@ -125,8 +125,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_with_multiple_options")
<< QUrl("coap://10.20.30.40:5683/test/oui")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09bb474657374036f7569"
@@ -134,8 +134,8 @@ void tst_QCoapInternalRequest::requestToFrame_data()
QTest::newRow("request_with_big_option_number")
<< QUrl("coap://10.20.30.40:5683/test")
- << QtCoap::Get
- << QCoapRequest::NonConfirmable
+ << QtCoap::Method::Get
+ << QCoapRequest::MessageType::NonConfirmable
<< quint16(56400)
<< QByteArray::fromHex("4647f09b")
<< "5401dc504647f09bb474657374dd240d6162636465666768696a6b6c6d6e6f70"
@@ -218,7 +218,7 @@ void tst_QCoapInternalRequest::parseUri()
QFETCH(QUrl, proxyUri);
QFETCH(QVector<QCoapOption>, options);
- QCoapRequest request(uri, QCoapMessage::NonConfirmable, proxyUri);
+ QCoapRequest request(uri, QCoapMessage::MessageType::NonConfirmable, proxyUri);
QCoapInternalRequest internalRequest(request);
for (QCoapOption opt : options)
diff --git a/tests/auto/qcoapmessage/tst_qcoapmessage.cpp b/tests/auto/qcoapmessage/tst_qcoapmessage.cpp
index b071645..8801ed0 100644
--- a/tests/auto/qcoapmessage/tst_qcoapmessage.cpp
+++ b/tests/auto/qcoapmessage/tst_qcoapmessage.cpp
@@ -59,7 +59,7 @@ void tst_QCoapMessage::copyAndDetach()
a.setMessageId(3);
a.setPayload("payload");
a.setToken("token");
- a.setType(QCoapMessage::Acknowledgment);
+ a.setType(QCoapMessage::MessageType::Acknowledgment);
a.setVersion(5);
// Test the copy
@@ -67,7 +67,7 @@ void tst_QCoapMessage::copyAndDetach()
QVERIFY2(b.messageId() == 3, "Message not copied correctly");
QVERIFY2(b.payload() == "payload", "Message not copied correctly");
QVERIFY2(b.token() == "token", "Message not copied correctly");
- QVERIFY2(b.type() == QCoapMessage::Acknowledgment, "Message not copied correctly");
+ QVERIFY2(b.type() == QCoapMessage::MessageType::Acknowledgment, "Message not copied correctly");
QVERIFY2(b.version() == 5, "Message not copied correctly");
// Detach
@@ -80,10 +80,10 @@ void tst_QCoapMessage::setMessageType_data()
{
QTest::addColumn<QCoapMessage::MessageType>("type");
- QTest::newRow("acknowledgment") << QCoapMessage::Acknowledgment;
- QTest::newRow("confirmable") << QCoapMessage::Confirmable;
- QTest::newRow("non-confirmable") << QCoapMessage::NonConfirmable;
- QTest::newRow("reset") << QCoapMessage::Reset;
+ QTest::newRow("acknowledgment") << QCoapMessage::MessageType::Acknowledgment;
+ QTest::newRow("confirmable") << QCoapMessage::MessageType::Confirmable;
+ QTest::newRow("non-confirmable") << QCoapMessage::MessageType::NonConfirmable;
+ QTest::newRow("reset") << QCoapMessage::MessageType::Reset;
}
void tst_QCoapMessage::setMessageType()
diff --git a/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp b/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
index 898466d..6ce5a87 100644
--- a/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
+++ b/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
@@ -68,7 +68,7 @@ class QCoapQUdpConnectionForTest : public QCoapQUdpConnection
Q_OBJECT
public:
QCoapQUdpConnectionForTest(QObject *parent = nullptr) :
- QCoapQUdpConnection(QtCoap::NoSec, parent)
+ QCoapQUdpConnection(QtCoap::SecurityMode::NoSec, parent)
{}
void bindSocketForTest() { d_func()->bindSocket(); }
@@ -93,14 +93,14 @@ void tst_QCoapQUdpConnection::connectToHost()
QSignalSpy spyConnectionBound(&connection, SIGNAL(bound()));
QSignalSpy spySocketStateChanged(socket , SIGNAL(stateChanged(QAbstractSocket::SocketState)));
- QCOMPARE(connection.state(), QCoapQUdpConnection::Unconnected);
+ QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Unconnected);
// This will trigger connection.bind()
connection.sendRequest(QByteArray(), QString(), 0);
QTRY_COMPARE(spySocketStateChanged.count(), 1);
QTRY_COMPARE(spyConnectionBound.count(), 1);
- QCOMPARE(connection.state(), QCoapQUdpConnection::Bound);
+ QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Bound);
#else
QSKIP("Not an internal build, skipping this test");
#endif
@@ -115,15 +115,15 @@ void tst_QCoapQUdpConnection::reconnect()
QSignalSpy connectionBoundSpy(&connection, SIGNAL(bound()));
connection.sendRequest(QByteArray(), QString(), 0);
QTRY_COMPARE(connectionBoundSpy.count(), 1);
- QCOMPARE(connection.state(), QCoapQUdpConnection::Bound);
+ QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Bound);
connection.disconnect();
- QCOMPARE(connection.state(), QCoapQUdpConnection::Unconnected);
+ QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Unconnected);
// Make sure that we are able to connect again
connection.sendRequest(QByteArray(), QString(), 0);
QTRY_COMPARE(connectionBoundSpy.count(), 2);
- QCOMPARE(connection.state(), QCoapQUdpConnection::Bound);
+ QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Bound);
#else
QSKIP("Not an internal build, skipping this test");
#endif
@@ -144,7 +144,7 @@ void tst_QCoapQUdpConnection::sendRequest_data()
<< testServerHost()
<< "/test"
<< quint16(QtCoap::DefaultPort)
- << QtCoap::Get
+ << QtCoap::Method::Get
<< "5445"
<< "61626364c0211eff547970653a203120284e4f4e290a436f64653a2031202847"
"4554290a4d49443a2032343830360a546f6b656e3a203631363236333634";
@@ -154,7 +154,7 @@ void tst_QCoapQUdpConnection::sendRequest_data()
<< testServerHost()
<< "/test"
<< quint16(QtCoap::DefaultPort)
- << QtCoap::Put
+ << QtCoap::Method::Put
<< "5444"
<< "61626364";
@@ -163,7 +163,7 @@ void tst_QCoapQUdpConnection::sendRequest_data()
<< testServerHost()
<< "/test"
<< quint16(QtCoap::DefaultPort)
- << QtCoap::Post
+ << QtCoap::Method::Post
<< "5441"
<< "61626364896c6f636174696f6e31096c6f636174696f6e32096c6f636174696f"
"6e33";
@@ -173,7 +173,7 @@ void tst_QCoapQUdpConnection::sendRequest_data()
<< testServerHost()
<< "/test"
<< quint16(QtCoap::DefaultPort)
- << QtCoap::Delete
+ << QtCoap::Method::Delete
<< "5442"
<< "61626364";
}
diff --git a/tests/auto/qcoapreply/tst_qcoapreply.cpp b/tests/auto/qcoapreply/tst_qcoapreply.cpp
index 05b5889..d9a7562 100644
--- a/tests/auto/qcoapreply/tst_qcoapreply.cpp
+++ b/tests/auto/qcoapreply/tst_qcoapreply.cpp
@@ -65,20 +65,20 @@ void tst_QCoapReply::updateReply_data()
QTest::newRow("success")
<< QByteArray("Some data")
- << QtCoap::Content
- << QtCoap::NoError;
+ << QtCoap::ResponseCode::Content
+ << QtCoap::Error::Ok;
QTest::newRow("content error")
<< QByteArray("Error")
- << QtCoap::BadRequest
- << QtCoap::NoError;
+ << QtCoap::ResponseCode::BadRequest
+ << QtCoap::Error::Ok;
QTest::newRow("finished error")
<< QByteArray("Error")
- << QtCoap::Content
- << QtCoap::BadRequestError;
+ << QtCoap::ResponseCode::Content
+ << QtCoap::Error::BadRequest;
QTest::newRow("content & finished errors")
<< QByteArray("2Errors")
- << QtCoap::BadGateway
- << QtCoap::BadRequestError;
+ << QtCoap::ResponseCode::BadGateway
+ << QtCoap::Error::BadRequest;
}
void tst_QCoapReply::updateReply()
@@ -111,7 +111,7 @@ void tst_QCoapReply::updateReply()
QCOMPARE(spyReplyFinished.count(), 1);
QCOMPARE(spyReplyNotified.count(), 0);
QCOMPARE(spyReplyAborted.count(), 0);
- if (error != QtCoap::NoError || QtCoap::isError(responseCode)) {
+ if (error != QtCoap::Error::Ok || QtCoap::isError(responseCode)) {
QVERIFY(spyReplyError.count() > 0);
QCOMPARE(reply.isSuccessful(), false);
} else {
diff --git a/tests/auto/qcoaprequest/tst_qcoaprequest.cpp b/tests/auto/qcoaprequest/tst_qcoaprequest.cpp
index 4513bb9..9f66b98 100644
--- a/tests/auto/qcoaprequest/tst_qcoaprequest.cpp
+++ b/tests/auto/qcoaprequest/tst_qcoaprequest.cpp
@@ -160,9 +160,9 @@ void tst_QCoapRequest::copyAndDetach()
a.setMessageId(3);
a.setPayload("payload");
a.setToken("token");
- a.setType(QCoapMessage::Acknowledgment);
+ a.setType(QCoapMessage::MessageType::Acknowledgment);
a.setVersion(5);
- a.setMethod(QtCoap::Delete);
+ a.setMethod(QtCoap::Method::Delete);
QUrl testUrl("coap://url:500/resource");
a.setUrl(testUrl);
QUrl testProxyUrl("test://proxyurl");
@@ -173,12 +173,12 @@ void tst_QCoapRequest::copyAndDetach()
QVERIFY2(b.messageId() == 3, "Message not copied correctly");
QVERIFY2(b.payload() == "payload", "Message not copied correctly");
QVERIFY2(b.token() == "token", "Message not copied correctly");
- QVERIFY2(b.type() == QCoapMessage::Acknowledgment, "Message not copied correctly");
+ QVERIFY2(b.type() == QCoapMessage::MessageType::Acknowledgment, "Message not copied correctly");
QVERIFY2(b.version() == 5, "Message not copied correctly");
// Test the QCoapRequest copy
QCoapRequest c(a);
- QVERIFY2(c.method() == QtCoap::Delete, "Request not copied correctly");
+ QVERIFY2(c.method() == QtCoap::Method::Delete, "Request not copied correctly");
QVERIFY2(c.url() == testUrl, "Request not copied correctly");
QVERIFY2(c.proxyUrl() == testProxyUrl, "Request not copied correctly");