TopicLengthTest.cpp
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/****************************************************************************
* COpyright (c) 2023 Open Systems Development B.V.
****************************************************************************/
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <string>
#include <memory>
#include "mqttclient.h"
using namespace osdev::components::mqtt;
using namespace osdev::components::log;
/****************************************************************************
* H E L P E R C L A S S E S
****************************************************************************/
/// @brief class to generate a cumulative topic..
class TopicTester
{
public:
TopicTester();
virtual ~TopicTester();
void RunTopicTester(int max_number_of_chars);
};
class Publisher
{
public:
Publisher();
virtual ~Publisher() {}
void connect(const std::string &hostname,
int portnumber = 1883,
const std::string &username = std::string(),
const std::string &password = std::string(),
const std::string &lwt_topic = std::string(),
const std::string &lwt_message = std::string()
);
void publish(const std::string &message_topic, const std::string &message_payload);
private:
osdev::components::mqtt::MqttClient m_mqtt_client;
};