1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 20:25:59 +02:00
Commit graph

5141 commits

Author SHA1 Message Date
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
Florian Schmaus
1f34f3e613 [sinttest] Directly use rosterTwo instead of Roster.getInstanceFor() 2024-05-31 23:09:35 +02:00
Florian Schmaus
3749f524f5 [sinttest] Fix NPE by checking that status is not null testCurrentPresenceSentAfterSubscriptionApproval() 2024-05-21 13:08:46 +02:00
Florian Schmaus
34c2d5210e [sinttest] Improve TimeoutException's message of ResultSyncPoint 2024-05-21 13:08:46 +02:00
Florian Schmaus
2a5cf149b2 [sinttest] Use unique room names for mucJoinSemiAnonymousRoomReceivedBy*()
In order to be able to identify potential room leaks, use unique rooms
names for the two integration tests. Also destroy the room in
mucJoinSemiAnonymousRoomReceivedByNonModeratorTest().
2024-05-21 12:39:12 +02:00
Florian Schmaus
41022d139b [sinttest] Improve assertion message of mucDestroyTest()
Improve the assertion message of mucDestroyTest() by including the
still joined rooms.
2024-05-21 12:37:26 +02:00
Florian Schmaus
d2810cf9b6 [sinttest] Move throw statement before setting the listener in mucDestroyTest()
Also add tryDestroy(muc).
2024-05-20 23:13:24 +02:00
Florian Schmaus
bf6b7bd692 [sinttest] Use set operation instead of Java stream API in mucDestroyTest() 2024-05-20 23:08:53 +02:00
Florian Schmaus
35f621be05 [muc] Switch away from deprecated DefaultUserStatusListener in mucDestroyTest() 2024-05-20 23:08:23 +02:00
Florian Schmaus
c5e3f89e21 [sinttest] Add MultiUserChatIntegrationTest.mucNameChangeTest() 2024-05-20 22:17:38 +02:00
Florian Schmaus
9f58c992bd [sinttest] Improve mucChangeNicknameInformationTest()
Only declare the body of the participant listeners once. And increase
the try block, to account, for example, for
participantOneSeesTwoEnter.waitForResult() throwing.
2024-05-20 22:17:38 +02:00
Florian Schmaus
2a243fe3b6 [sinttest] Do not use Java stream() API to check if MUC status is set
MUCUser.getStatus() returns a set, checking if a particular MUC status
number is set should be done via a simple and efficient set operation
and not by resorting to using Java's stream API.
2024-05-20 22:17:38 +02:00
Florian Schmaus
482a117e0d [sinttest] Migrate mucJoinRoomWithPublicLoggingTest() to use MucConfigFormManager
This also ensures that the test does not fail if the service does not
support the required MUC configuration option.
2024-05-20 22:17:38 +02:00
Florian Schmaus
1d498efd46 [muc] Add support for muc#roomconfig_enablelogging to MucConfigFormManager 2024-05-20 22:17:38 +02:00
Florian Schmaus
90c7dc4390 [sinttest] Add ejabberd specific behavior for mucJoinLockedRoomTest()
ejabberd does not seem to implement the MUC locked behavior specified
in XEP-0045 § 7.2.10.
2024-05-20 22:17:38 +02:00
Florian Schmaus
6cda9a6379 [sinttest] Add ejabberd specific behavior for mucMaxUsersLimitJoinRoomTest
ejabberd returns resource-constraint instead of service-unavailable if
the maximum number of participants is reached.
2024-05-20 22:00:56 +02:00
Florian Schmaus
e69e7d2342 [sinttest] Add TestNotPossibleException(Throwable) 2024-05-20 21:59:32 +02:00
Florian Schmaus
eed707f39d [sinttest] Inline createLockedMuc()
This method only had one call site and using such "helper" methods has
the drawback that it is not immediatly obvious what it does when
reading the integration test code. Therefore, we better inline it.
2024-05-20 21:58:16 +02:00
Florian Schmaus
c87bb8aaa4 [sinttest] Ensure that message has body in mucJoinEventOrderingTest()
It is possible that messages do not have a body. Therefore, we need to
ensure that the message has one before we compare the body.
2024-05-20 21:52:01 +02:00
Florian Schmaus
9447030cd4 [muc] Do not invoke userHasLeft() on nickname change
When the incoming unavailable presence is signalling a nickname
change (303), then do not invoke userHasLeft(), because the user
actually does not leave but instead just changes its nickname.

Note that this would also have had fixed SMACK-942, as it would
resolve the deadlock. However, using a dedicated lock for
changeNickname() still seems sensible, and if its just to avoid a bit
of lock contention.

What this also fixes is that a MultiUserChat does no longer invoke its
listener-based callbacks after a nickname change, as previously, after
a nickname change, the userHasLeft() would have been invoked, which
tears down the listeners. This issue was found with
MultiUserChatOccupantIntegrationTest.mucChangeNicknameInformationTest().
2024-05-20 21:45:47 +02:00
Florian Schmaus
c34c9bdb62 [muc] Fix MultiUserChat.changeNickname(Resourcepart)
Using this method used to result in a deadlock, as shown by these two threads

"main" #1 prio=5 os_prio=0 cpu=926.39ms elapsed=21.00s tid=0x00007f463802c800 nid=0x5a691 in Object.wait()  [0x00007f463f323000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(java.base@11.0.23/Native Method)
	- waiting on <0x0000000622e82fd8> (a org.jivesoftware.smack.StanzaCollector)
	at org.jivesoftware.smack.StanzaCollector.nextResult(StanzaCollector.java:206)
	- waiting to re-lock in wait() <0x0000000622e82fd8> (a org.jivesoftware.smack.StanzaCollector)
	at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:270)
	at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:228)
	at org.jivesoftware.smackx.muc.MultiUserChat.changeNickname(MultiUserChat.java:1314)
	- locked <0x0000000622e19700> (a org.jivesoftware.smackx.muc.MultiUserChat)
	at org.jivesoftware.smackx.muc.MultiUserChatOccupantIntegrationTest.mucChangeNicknameInformationTest(MultiUserChatOccupantIntegrationTest.java:981)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11.0.23/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11.0.23/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.23/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@11.0.23/Method.java:566)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.lambda$runTests$0(SmackIntegrationTestFramework.java:476)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework$$Lambda$141/0x000000084026e040.execute(Unknown Source)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.runConcreteTest(SmackIntegrationTestFramework.java:551)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework$PreparedTest.run(SmackIntegrationTestFramework.java:759)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.runTests(SmackIntegrationTestFramework.java:539)
	at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.run(SmackIntegrationTestFramework.java:277)
	- locked <0x000000062d191318> (a org.igniterealtime.smack.inttest.SmackIntegrationTestFramework)
	at
	org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.main(SmackIntegrationTestFramework.java:115)

"Smack Cached Executor" #19 daemon prio=5 os_prio=0 cpu=7.85ms elapsed=20.48s tid=0x00007f4638a42800 nid=0x5a6b2 waiting for monitor entry  [0x00007f46023fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.jivesoftware.smackx.muc.MultiUserChat.userHasLeft(MultiUserChat.java:2281)
	- waiting to lock <0x0000000622e19700> (a org.jivesoftware.smackx.muc.MultiUserChat)
	at org.jivesoftware.smackx.muc.MultiUserChat.access$800(MultiUserChat.java:117)
	at org.jivesoftware.smackx.muc.MultiUserChat$3.processStanza(MultiUserChat.java:263)
	at org.jivesoftware.smack.AbstractXMPPConnection.lambda$invokeStanzaCollectorsAndNotifyRecvListeners$8(AbstractXMPPConnection.java:1654)
	at org.jivesoftware.smack.AbstractXMPPConnection$$Lambda$127/0x000000084022f440.run(Unknown Source)
	at org.jivesoftware.smack.AbstractXMPPConnection$10.run(AbstractXMPPConnection.java:2213)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.23/ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.23/ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(java.base@11.0.23/Thread.java:829)

The changeNickname() method was synchronized and is userHasLeft(),
this caused a deadlock since changeNickname() awaits the presence that
is send as result of the nickname change. But this presence is also
processed in a listener which invokes userHasLeft(). However, this
invocation blocks as userHasLeft() is waiting on the montior currently
hold by the thread invoking changeNickname().

To fix this, we change changeNickname() to not take the MultiUserChat
monitor, but instead use a dedicate lock.

Fixes SMACK-942.
2024-05-20 21:45:34 +02:00
Florian Schmaus
1836537c42 [core] Add unit test for IQ parsing
Motivated by
https://discourse.igniterealtime.org/t/question-about-tigase-server-8-3-1-and-smack-4-4-7/93796/
2024-05-20 15:18:37 +02:00
Florian Schmaus
e70d0cd858 [sinttest] Improve MultiUResultSyncPoint's TimoutException message 2024-05-20 15:11:28 +02:00
Florian Schmaus
c4ce6b4707 [muc] Add support for muc#roomconfig_roomname in MucConfigFormManager 2024-05-20 15:10:56 +02:00
Florian Schmaus
1bf0aed0f5 [build.gradle] Add junit-platform-launcher add testRuntimeOnly
Fixes

   NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()

when running unit tests in Eclipse.
2024-05-20 15:09:22 +02:00
Guus der Kinderen
121d4ac245 [sinttest] Normalization of SpecificationReference to include dash-seperator
When comparing SINT-configuration to annotations, a bit of normalization occurs, to ensure that common variations in denoting a specification are detected to be equal to each-other.

The dash (`-`) character is commonly used when referencing a specification (eg: `XEP-0001`).

This commit ensures that usage of a dash (`-`) character is included in the normalization process, making `XEP 0001`, `XEP0001` and `XEP-0001` all to be identified as the same reference.
2024-05-10 15:05:50 +02:00
Guus der Kinderen
4cc9a7d7eb [sinttest] Configuration.normalizeSpecification() should be public
It is likely to be desirable to re-use the normalization of specification references, for example in implementations of `TestRunResultProcessor`.
2024-05-10 15:01:44 +02:00
Florian Schmaus
617d1bfff2 [smack-examples] Add XmppConnectionTool 2024-05-08 15:53:00 +02:00
Florian Schmaus
e08c95a0a1 [smack-repl] Fix scala.repl's imports 2024-05-08 14:59:05 +02:00
Florian Schmaus
e0f335be40 [smack-repl] Bump Ammonite to 3.0.0-M1 and Scala to 2.13.13 2024-05-08 14:58:43 +02:00
Florian Schmaus
e79429e052
Merge pull request #591 from guusdk/sint-specref-version
[sinttest] Add optional version to specification reference
2024-05-02 09:50:26 +00:00