1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-15 00:32:06 +01:00
Commit graph

5221 commits

Author SHA1 Message Date
Florian Schmaus
c322ce8046
Merge pull request #601 from guusdk/sint_muc-guarantee-order
[sint] Refactor test to ensure stanza order
2024-06-27 19:21:37 +00:00
Guus der Kinderen
0c9d521084 [sint] Refactor test to ensure stanza order
The test that's modified in this commit asserts that upon MUC join, stanzas are received in a particular order.

The previous implementation depended on several event listeners (one for presence, one for messages) that did not always fire in the same order in which the corresponding stanzas arrived. This made the approach unsuitable to reliably test the order in which stanzas arrive.

This commit stops using Smack's MUC API when trying to collect the order in which stanzas arrive. Instead, it joins a chatroom and listens for its stanzas using basic stanza handling. As this uses exactly one stanza listener, that's guaranteed to be invoked in order of stanza arrival, any synchronicity issue in the previous implementation no longer applies.
2024-06-27 20:30:37 +02:00
Florian Schmaus
47d4cbe094 Merge branch '4.4' 2024-06-27 17:10:29 +02:00
Florian Schmaus
ba02a868f6 [caps] Use DataForm.getFormType() when sorting 2024-06-27 17:09:40 +02:00
Guus der Kinderen
a1e85d644f [caps] Additional test that asserts CAPS dataform ordering
XEP-0115 defines that any dataforms in the disco#info stanza is
ordered prior to the computation of the verification string. This
commit adds a test that verifies that this is done by Smack.

See SMACK-944.
2024-06-27 17:09:40 +02:00
Guus der Kinderen
95adfb3cdf [caps] Ensure dataforms are ordered prior to ver calculation
Fixes SMACK-944.
2024-06-27 17:09:36 +02:00
Florian Schmaus
9254f735c7 [sinttest] Refactor MultiResulitSyncPoint TimeoutException message construction for readability 2024-06-27 16:49:23 +02:00
Florian Schmaus
68fa90435e
Merge pull request #599 from guusdk/sint_assertresult-multisync
[sinttest] Improving assertions for MultiResultSyncPoint
2024-06-27 14:42:22 +00:00
Florian Schmaus
98ff4d8a65
Merge pull request #598 from guusdk/sint_muc-occupant-race
[sinttest] Fix race condition in MUC test
2024-06-27 14:40:23 +00:00
Florian Schmaus
cf8a8466e4 Merge remote-tracking branch 'origin/master' 2024-06-23 09:24:14 +02:00
Guus der Kinderen
98dbc0ee2e [muc] Prevent duplicate processing of mediated invitations
MUC mediated invitations usually have the form

<message
    from='coven@chat.shakespeare.lit'
    id='nzd143v8'
    to='hecate@shakespeare.lit'>
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <invite from='crone1@shakespeare.lit/desktop'>
      <reason>
        Hey Hecate, this is the place for all good witches!
      </reason>
    </invite>
    <password>cauldronburn</password>
  </x>
</message>
(source: XEP-0045 Example 57.)

However, previous versions of XEP-0045 specified an additional <x
xmlns='jabberconference'> element to be included (see
implementation note in XEP-0045). Therefore, a legacy implementation
may emit a mediated invitations in the form of

<message
    from="smack-inttest-mediated-invite-from-8ta77-hw9igz@conference.example.org"
	to="smack-inttest-two-8ta77@example.org">
  <x xmlns="http://jabber.org/protocol/muc#user">
    <invite from="smack-inttest-one-8ta77@example.org"/>
  </x>
  <x xmlns="jabberconference" jid="smack-inttest-mediated-invite-from-8ta77-hw9igz@conference.example.org"/>
</message>

Unfortunately, this matches
MultiUserChatManager.DIRECT_INVITATION_FILTER because
GroupChatInvitation matches <x xmlns="jabberconference"/>. However
the message is not a direct invitation but a mediated one. Besides
this invoking the wrong listeners (direct vs. medidated) the value for
'inviter' that's used to invoke that listener will be false.

To fix this, extend DIRECT_INVITATION_FILTER with
NotFilter.of(MUCUser.class) to avoid matching those legacy mediated
invitations.

Fixes SMACK-943

Co-authored-by: Florian Schmaus <flo@geekplace.eu>
2024-06-23 09:07:51 +02:00
Florian Schmaus
0bb3bf292c [core] Add NotFilter.of(Class<E extends ExtensionElement>) 2024-06-22 20:01:35 +02:00
Florian Schmaus
095ba0a3ee
Merge pull request #603 from guusdk/smackx_package-info-copypaste-bugs
[docs] fix URL for XEP-0372
2024-06-20 07:49:29 +00:00
Florian Schmaus
a4eb5a7b01
Merge pull request #592 from guusdk/sint-versions-for-tests
[sinttest] Add versions for tests
2024-06-20 07:47:17 +00:00
Guus der Kinderen
95c39d2a44 [docs] fix URL for XEP-0372 2024-06-18 16:29:57 +02:00
Guus der Kinderen
7e9a5713e9 [sinttest] Improve test assertion message
Making use of the new assertion handling for MultiResultSyncPoint, the integration test that uses that implementation can now get improved assertion messages. This will allow users to more quickly determine why a test is failing.
2024-06-13 16:01:30 +02:00
Guus der Kinderen
440b497638 [sinttest] Add AssertResult for MultiResultSyncPoint
This adds an AssertResult implementation for MultiResultSyncPoint that mimics the equivalent for ResultSyncPoint.
2024-06-13 16:01:30 +02:00
Guus der Kinderen
adafcdb6d1 [sinttest] Fix race condition in MUC test
When occupant One waits for occupant Two to join the room, One should register the corresponding listener _before_ Two joins.

Without this, a race conditions occurs, where Two could have joined the room before One registered the listener, thus missing the event.
2024-06-13 15:26:42 +02:00
Guus der Kinderen
fc1e670a02 [sinttest] Add version to specref for XEP-0118
The test was originally implemented when version 1.2 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.3.0.
2024-06-12 17:42:18 +02:00
Guus der Kinderen
7d618563f4 [sinttest] Add version to specref for XEP-0232
The test was originally implemented after the most current version of the XEP was published, making it plausible that this implementation matches the current version of the XEP: 0.3.
2024-06-12 17:40:46 +02:00
Guus der Kinderen
3f0933e90e [sinttest] Add version to specref for XEP-0060
The test was originally implemented when version 1.15.7 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications (with regards to the functionality that is the subject of the tests), making it plausible that this implementation matches the current version of the XEP: 1.26.0.
2024-06-12 17:38:35 +02:00
Guus der Kinderen
2a6e6c7154 [sinttest] Add version to specref for XEP-0199
The test was originally implemented when version 2.0 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 2.0.1.
2024-06-12 17:35:46 +02:00
Guus der Kinderen
a40dd35eeb [sinttest] Add version to specref for XEP-0374
The test was originally implemented when version 0.1.2 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 0.2.0.
2024-06-12 17:34:14 +02:00
Guus der Kinderen
7e153d87d0 [sinttest] Add version to specref for XEP-0384
These tests were originally implemented when versions 0.2.1 and 0.3.0 of the XEP were the most current version. Later versions of the XEP do significantly modify the specifications, making it plausible that this implementation matches the version of the XEP that was the most recent version at the time the test was created: 0.3.0
2024-06-12 17:31:00 +02:00
Guus der Kinderen
6b912f9aba [sinttest] Add version to specref for XEP-0048
The test was originally implemented when version 1.1 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.2.
2024-06-12 17:25:20 +02:00
Guus der Kinderen
9e0f20b748 [sinttest] Add version to specref for XEP-0045
The test was originally implemented when version 1.25 of the XEP was the most current version. Later versions of the XEP do significantly modify the specifications, but the test implementation has had continuous changes over time too. This makes it plausible that this implementation matches the current version of the XEP: 1.34.6.
2024-06-12 17:22:32 +02:00
Guus der Kinderen
03ee544e0e [sinttest] Add version to specref for XEP-0045 (section 5)
The test was implemented when version 1.34.1 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.34.6.
2024-06-12 17:22:21 +02:00
Guus der Kinderen
963c25799a [sinttest] Add version to specref for XEP-0045 (section 7)
The test was implemented when version 1.34.1 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.34.6.
2024-06-12 17:21:33 +02:00
Guus der Kinderen
f78766ad6e [sinttest] Add version to specref for XEP-0045 (section 6)
The test was implemented when version 1.34.2 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.34.6.
2024-06-12 17:20:46 +02:00
Guus der Kinderen
268c298264 [sinttest] Add version to specref for XEP-0107
The test was implemented after the most current version of the XEP was published, making it plausible that the implementation matches that version of the XEP: 1.2.1
2024-06-12 17:11:34 +02:00
Guus der Kinderen
8d66f78b3b [sinttest] Add version to specref for XEP-0363
The test was originally implemented when version 0.5.1 of the XEP was the most current version. The Smack code that is being tested defines a namespace that was introduced in 0.6, making it plausible that this implementation matches the version of the XEP, followed by some editorial changes: 0.6.3 (which is _not_ the latest version of the XEP).
2024-06-12 17:11:33 +02:00
Guus der Kinderen
b753c4a876 [sinttest] Add version to specref for XEP-0092
The test was implemented years after the most current version of the XEP was published, making it plausible that the implementation matches that version of the XEP: 1.1.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
8b20d4b382 [sinttest] Add version to specref for XEP-0347
The test was implemented when version 0.4 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 0.5.1.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
f5e5b4a913 [sinttest] Add version to specref for XEP-0363
The test was implemented when version 0.3.1 of the XEP was the most current version. The Smack code that is being tested defines a namespace that was introduced in 0.4.0, making it plausible that this implementation matches that version of the XEP: 0.4.0 (which is _not_ the latest version of the XEP).
2024-06-12 17:11:33 +02:00
Guus der Kinderen
cdbc431cdd [sinttest] Add version to specref for XEP-0080
The test was implemented years after the most current version of the XEP was published, making it plausible that the implementation matches that version of the XEP: 1.9.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
973f37996f [sinttest] Add version to specref for XEP-0096
The test was implemented when version 1.2 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.3.1.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
74614b00f7 [sinttest] Add version to specref for XEP-0050
The test was implemented years after the most current version of the XEP was published, making it plausible that the implementation matches that version of the XEP: 1.3.0.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
febb0e8f24 [sinttest] Add version to specref for XEP-0085
The test was implemented years after the most current version of the XEP was published, making it plausible that the implementation matches that version of the XEP: 2.1.
2024-06-12 17:11:33 +02:00
Guus der Kinderen
4eafb0ceeb [sinttest] Add version to specref for XEP-0115
The test was implemented when version 1.5.1 of the XEP was the most current version. Later versions of the XEP do not significantly modify the specifications, making it plausible that this implementation matches the current version of the XEP: 1.6.0.
2024-06-12 17:11:33 +02:00
Florian Schmaus
4f09244253
Merge pull request #597 from guusdk/sint_add-host-config
[sinttest] Add new config option: 'host'
2024-06-09 17:32:37 +00:00
Guus der Kinderen
7c77cfbc20 [sinttest] Add new config option: 'host'
An optional configuration option for the Smack Integration Test framework has been added that allows one to bypass DNS when resolving a host for the XMPP domain that is the subject of the test.

The `host` option can be used with IP addresses (eg: `-Dsinttest.host=127.0.0.1`) and DNS names (eg: `-Dsinttest.host=example.org`).
2024-06-09 11:29:31 +02:00
Florian Schmaus
5cbcd67645 [sinttest] Add MultiUserChatIntegrationTest.mucTestChangeRoomName 2024-06-01 13:21:25 +02:00
Florian Schmaus
b2331aaacf [sinttest] Throw IllegalArgumentException if no tests have been selected 2024-06-01 12:13:33 +02:00
Florian Schmaus
3e2d01ce63
Merge pull request #594 from guusdk/sinttest_specref-normalization-access
[sinttest] Configuration.normalizeSpecification() should be public
2024-06-01 09:35:34 +00:00
Florian Schmaus
0db1c7a988
Merge pull request #593 from guusdk/sinttest_specref-normalization-dash
[sinttest] Normalization of SpecificationReference to include dash-seperator
2024-06-01 09:35:30 +00:00
Florian Schmaus
6ae8234d25 [sinttest] Add MultiUserChatIntegrationTest.mucTestVisitorNotAllowedToChangeSubject 2024-06-01 11:25:08 +02:00
Florian Schmaus
a708387210 [muc] Add roomconfig_changesubject support to MucConfigFormManager 2024-06-01 11:24:43 +02:00
Florian Schmaus
147071ff64 [muc] Fix changeSubject() to throw XMPPErrorException on failures
When Smack requests a subject change of a MUC, an error returned by
the server (eg: 'forbidden') should be propagated (as suggested by the
pre-existing javadoc).

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2024-06-01 00:16:56 +02:00
Florian Schmaus
4ce926bd63 [core] Use StanzaView as StanzaIdFilter constructor parameter type
Instead of Stanza, use StanzaView as constructor parameter type of
StanzaIdFilter. Even though StanzaView also includes builders, the
Stanza ID is even immutable in builders.
2024-06-01 00:16:56 +02:00
Florian Schmaus
7acde2acab [sinttest] Drop testReceivePresenceAndApprovalAndRosterPush
This tests reliably fails, not only for me.	I suspect that it is
related to the order of events checked by this tests, that can not be
reliably tested, even with sync listeners.

It is also is primarily a test for server behavior.
2024-06-01 00:16:56 +02:00