Not implementing this function causes a lot if Invalid Socket
Specified in the tests.
Also fixed a problem with broker_connection.h where
DefaultVersionTestData did not evaluate to version(0)
if MQTT_TEST_PROTOCOL was defined.
Fixes: QTBUG-137305
Pick-to: 6.10
Change-Id: I4b825196548a3f5bf07c3bb4203a0b46033004ba
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Since we could only have one subscription for each topic it was
not possible to return a new subscription when a subscription
request comes in on a topic that is scheduled for destruction.
We solve this by switching to a QMultiHash for the active
subscriptions, allowing more then one subscription for a
given topic. However, at most one of these subscriptions
are not present in the list of subscriptions scheduled to
be unsubscribed
This patch also changes multiple unsubscribes to the
same topic. Earlier all would return true, and
m_pendingUnsubscriptions would be updated for all
requests.
The new behavior is that only the first unsubscribe
is acted upon. Furthere requests will return false.
Fixes: QTBUG-135653
Pick-to: 6.8 6.9 6.10
Change-Id: I5a79efb68b3191e185325a89cc2042c773bb5c12
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Currently installation is detected by looking for 'mqtt.conf' files,
which are set during provisioning in install-mosquitto-mqtt.sh
and install-mosquitto.ps1. However, this only reflects installation on
the build machine and not on test node. Therefore, add a way to disable
it on WOA also when cross compiled despite of existence of
'mqtt.conf' files on build node.
This is just barely a band aid patch as handling should be really done
during provisioning by Set-EnvironmentVariable, which than could be
read directly by test node as {{.Env.XXX}. However, it would also require the test to detect the setting during runtime and not during compile time.
Note the native arm64 windows setup has no mosquitto installation,
therefore this patch does not change anything for current native windows
arm setup, it only overrides setup for cross compilation node.
Task-number: COIN-1211
Change-Id: Ie6e84b6b04da48c1df284a388022f31ba1eea93e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For at least one platform run the twelve combinations of:
Transport: [Tcp,Ssl,Ws,Wss]
Protocol: [3.1, 3.1.1, 5.0]
This happens if the following defines are present:
MQTT_TEST_BROKER
MQTT_TEST_TYPE
MQTT_TEST_PROTOCOL
If these are not defined, the old test behavior is kept
The logic is that we are replacing the type of VersionClient
to homegrown logic that replaces connectToHost with the
correct function:
connectToHost
connectToHostEncrypted,
connectToHostWebSocket
connectToHostWebSocketEncrypted
For this to work it is important that the VersionClient
macro is used everywhere.
Also, DefaultVersionTestData has been changed to
return version(0) if MQTT_TEST_PROTOCOL is defined,
we will now run one protocol at the time instead.
This is Change Request 2 of 2 wrt testing.
Task-number: QTBUG-129171
Change-Id: I4f68d7c2ea226a1107f009c80f87f8b749d9f120
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
We want to use the VersionClient macro to iterate over
version,connectiontype. To do this (in a later patch)
it is necessary that VersionClient is used everywhere.
This is change request 1 of 2 wrt mqtt tests.
Task-number: QTBUG-129171
Change-Id: Ica2f97bc2fd130cc49191d7381d49e88e8dc4a0c
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
This allows us to build manual tests together with Qt by specifying
QT_BUILD_MANUAL_TESTS and QT_BUILD_TESTS. A benefit of doing this, is
that the manual tests show up as debuggable targets with IDEs such as
Visual Studio Code, while keeping full code navigation capabilities into
the Qt code.
Pick-to: 6.8
Change-Id: Idd309c06fb2586fd634386951a3345aa40bc093a
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: If63837f32f9f5e852292c20e449877e6a6fecc89
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
A topic can have multiple '+' wildcards, but isValid was searching for
the wrong wildcard at the second instance.
Pick-to: 6.6 6.5 6.2
Change-Id: I83e3fa258ef01b26388c0e6fd8c17a0a140ab75a
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
The matching check for topic filters did not take into account that a
mixture of wildcards is valid. While # is only allowed a single time,
using + is valid in multiple occasions and can also me mixed with other
wildcards.
Fixes: QTBUG-104478
Pick-to: 6.6 6.5 6.2
Change-Id: I04129d5fbbb21c95115a15d74c6787804a8d0b10
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
The example is not documented and it is also missing from the
examples-manifest.xml file. However, it can be still useful
for debugging or for performing small tests, so move it to
the tests/manual folder.
The qmake project files are kept for the examples because the
CI builds the examples with CMake and qmake. Now that this has
been moved to tests/manual, the .pro files can be removed.
Change-Id: Id69c3c6896d98b543ff5bd493592d06a27746496
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
As we are now processing the arguments with
cmake_parse_arguments(PARSE_ARGV, we don't need to pass the escape
characters anymore.
Task-number: QTBUG-99238
Change-Id: I8dbdad71e6a5b40e944c55c35dd4c772af6b5665
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
When iterating through the list of active subscriptions to emit the
messageReceived signal, the handler can add further subscriptions, which
renders the iterator to be invalid. Instead store the subscriptions in a
list, which are supposed to receive the signal and only act upon these.
Fixes: QTBUG-106203
Pick-to: 6.4 6.2 5.15
Change-Id: I790a6081c332e82da8e53b15df8ad8494f35cc46
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Ieb49171212fd72c685ba27cb39aaec9cbaf3a701
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Each sub item in the filter tree needs to be directly compared. Using
startsWith causes invalid elements to be marked as matching.
Fixes: QTBUG-92817
Pick-to: 6.4 6.2 5.15
Change-Id: I439d9325b58fd0aa57fb4ead8db48edb4188ebee
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I40135f08b4e89e8e034ec764ffed3273fc60646a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Ie4309963c8e17d4e7dad602f61a660246d5e23cb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
No Local subscription allow for filtering on the server side.
If a client subscribes and publishes a message on the same topic,
it will not be routed back.
Fixes: QTBUG-100862
Change-Id: I363361d0267aba740d07483c04ce0d4c30b5e14c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.
Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ib00e7ecb09111745f3f9165b40fd1d9ae606e75a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Setting the QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS variable
in the project ensures we ported away from old API calls.
Task-number: QTBUG-86815
Change-Id: I589f0192370a932ac10088656eaee1e35a41ea73
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also, remove optional dependency to websockets, which is not
part of Qt 6.0 and fix compile error against unsigned comparison.
Switch default test configuration to not launch TLS brokers.
Latest COIN updates causes paho to fail in the SSL setup.
Task-number: QTBUG-88189
Change-Id: I9d31f9e54801d269122878ab4cf7541512fdbe98
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
And use an updated coin instruction file.
Change-Id: I852d38febe9ecaa86c516b7f4a0451d0f80d8011
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Some test servers might have different configurations.
For instance, mosquitto broker provides a different
default value for topic aliases.
Change-Id: I00bc9c6b27d06358a352f9c0adb04e4044666aac
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
mosquitto MQTT5 support seems to wait longer to send
will messages.
Change-Id: I2c13609e228319ce8fefc5e79d4f99bbfe0b061b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
In certain scenarios, a user wants to manually handle the keepAlive.
Introduce autoKeepAlive as a property. If set to false, then the user
needs to handle the keepAlive by invoking requestPing.
The default for this property is true and keeps the current behavior.
Task-number: QTBUG-76782
Change-Id: I073874e6bdacf3c8d128c20431606affe1d9eeb1
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
A will message is allowed to be empty. Hence, check whether a will topic
exists to identify incorporating the last will to the connect message.
Task-number: QTBUG-76783
Change-Id: Ifb7f5467e8e7e70c6d9c050b36a35df2419f4171
Reviewed-by: hjk <hjk@qt.io>
For MQTT 5 the fake server did not send any property information. Hence,
the client (potentially) read among the buffer.
Change-Id: I58c7d1b4a1f15a0803c04495c82537f648c8a642
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Change-Id: If08d050a92db812e95a668d141d8774e56f9516e
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Previous approach to use application wide configurations can break
behavior. Also using a peerName is not sufficient in some cases. Hence,
introduce QMqttClient::connectToHostEncrypted with QSslConfiguration as
an argument, which should fulfill all needs.
[ChangeLog][QMqttClient] Added secure connection with QSslConfiguration
Task-number: QTBUG-73378
Change-Id: I3b91d2c7c02a3affd5dc67a7b486ebe78f4e1cc2
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>