Commit ced0d0ef authored by Ian Craggs's avatar Ian Craggs

Make all tests in test45.c work with MQTT 5

parent 167278c0
This diff is collapsed.
......@@ -416,11 +416,13 @@ typedef struct
enum MQTTReasonCodes reasonCode;
/** The MQTT properties on the ack, if any. */
MQTTProperties properties;
/** A numeric code identifying the MQTT client library error. */
int code;
/** Optional further text explaining the error. Can be NULL. */
const char *message;
} MQTTAsync_failureData5;
#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, SUCCESS, MQTTProperties_initializer, NULL}
#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, SUCCESS, MQTTProperties_initializer, 0, NULL}
/** The data returned on completion of a successful API call in the response callback onSuccess. */
typedef struct
......@@ -959,6 +961,10 @@ typedef struct
int len; /**< binary password length */
const void* data; /**< binary password data */
} binarypwd;
/*
* MQTT V5 clean start flag. Only clears state at the beginning of the session.
*/
int cleanstart;
/**
* MQTT V5 properties for connect
*/
......@@ -983,7 +989,7 @@ typedef struct
#define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 6, 60, 1, 10, NULL, NULL, NULL, 30, 0,\
NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 1, 60, {0, NULL}, NULL, NULL, NULL, NULL}
NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 1, 60, {0, NULL}, 0, NULL, NULL, NULL, NULL}
/**
* This function attempts to connect a previously-created client (see
......@@ -1179,9 +1185,6 @@ DLLExport int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char* const
DLLExport int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen, void* payload, int qos,
int retained, MQTTAsync_responseOptions* response);
DLLExport int MQTTAsync_send5(MQTTAsync handle, const char* destinationName, int payloadlen, void* payload, int qos,
int retained, MQTTProperties* props, MQTTAsync_responseOptions* response);
/**
* This function attempts to publish a message to a given topic (see also
......
......@@ -66,7 +66,7 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion,
if (MQTTVersion >= MQTTVERSION_5)
{
len += MQTTProperties_len(connectProperties);
if (client->will && willProperties)
if (client->will)
len += MQTTProperties_len(willProperties);
}
......
......@@ -289,8 +289,50 @@ ADD_TEST(
COMMAND test45 "--test_no" "1" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-2-connect-timeout
COMMAND test45 "--test_no" "2" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-3-multiple-client-objs-simultaneous-working
COMMAND test45 "--test_no" "3" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-4-send-receive-big-messages
COMMAND test45 "--test_no" "4" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-5-connack-return-codes
COMMAND test45 "--test_no" "5" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-6-ha-connections
COMMAND test45 "--test_no" "6" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-7-pending-tokens
COMMAND test45 "--test_no" "7" "--connection" ${MQTT_TEST_BROKER}
)
ADD_TEST(
NAME test45-8-incomplete-commands-requests
COMMAND test45 "--test_no" "8" "--connection" ${MQTT_TEST_BROKER}
)
SET_TESTS_PROPERTIES(
test45-1-basic-connect-subscribe-receive
test45-2-connect-timeout
test45-3-multiple-client-objs-simultaneous-working
test45-4-send-receive-big-messages
test45-5-connack-return-codes
test45-6-ha-connections
test45-7-pending-tokens
test45-8-incomplete-commands-requests
PROPERTIES TIMEOUT 540
)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment