From a7ba40e888eaffac1d3f47da20943f06ba9a9a5e Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sun, 7 Aug 2022 14:05:04 +0200 Subject: [PATCH] Convert test_retained_removed to native test client --- FlashMQTests/tst_maintests.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/FlashMQTests/tst_maintests.cpp b/FlashMQTests/tst_maintests.cpp index df79696..9a23bf4 100644 --- a/FlashMQTests/tst_maintests.cpp +++ b/FlashMQTests/tst_maintests.cpp @@ -491,23 +491,31 @@ void MainTests::test_retained_changed() void MainTests::test_retained_removed() { - TwoClientTestContext testContext; + FlashMQTestClient sender; + FlashMQTestClient receiver; - QByteArray payload = "We are testing"; - QString topic = "retaintopic"; + sender.start(); + receiver.start(); - testContext.connectSender(); - testContext.publish(topic, payload, true); + std::string payload = "We are testing"; + std::string topic = "retaintopic"; - payload = ""; + sender.connectClient(ProtocolVersion::Mqtt311); - testContext.publish(topic, payload, true); + Publish pub1(topic, payload, 0); + pub1.retain = true; + sender.publish(pub1); - testContext.connectReceiver(); - testContext.subscribeReceiver(topic); - testContext.waitReceiverReceived(0); + pub1.payload = ""; + + sender.publish(pub1); + + receiver.connectClient(ProtocolVersion::Mqtt311); + receiver.subscribe(topic, 0); + usleep(100000); + receiver.waitForMessageCount(0); - QVERIFY2(testContext.receivedMessages.empty(), "We erased the retained message. We shouldn't have received any."); + QVERIFY2(receiver.receivedPublishes.empty(), "We erased the retained message. We shouldn't have received any."); } /** -- libgit2 0.21.4