From 6cda9a637961bb3bbf472b72142a303dee028b7c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 May 2024 22:00:56 +0200 Subject: [PATCH] [sinttest] Add ejabberd specific behavior for mucMaxUsersLimitJoinRoomTest ejabberd returns resource-constraint instead of service-unavailable if the maximum number of participants is reached. --- .../MultiUserChatOccupantIntegrationTest.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java index 3ceac42ac..5f19e7385 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java @@ -728,18 +728,23 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI // it can kick user 2. Both strategies would comply with the specification. So the only thing we can // reasonably test here is whether the room doesn't have more occupants than its max size. - try { - mucAsSeenByThree.join(nicknameThree); - } catch (XMPPException.XMPPErrorException unavailableErrorException) { - // This exception is expected if the muc implementation employs the strategy to deny access beyond the - // maxusers value - if (unavailableErrorException.getStanzaError() == null - || !StanzaError.Condition.service_unavailable.equals( - unavailableErrorException.getStanzaError().getCondition())) { - throw unavailableErrorException; - } + XMPPException.XMPPErrorException errorException = assertThrows(XMPPException.XMPPErrorException.class, () -> mucAsSeenByThree.join(nicknameThree)); + + final StanzaError.Condition expectedCondition; + switch (sinttestConfiguration.compatibilityMode) { + default: + expectedCondition = StanzaError.Condition.service_unavailable; + break; + case ejabberd: + expectedCondition = StanzaError.Condition.resource_constraint; + break; } + StanzaError stanzaError = errorException.getStanzaError(); + assertNotNull(stanzaError); + + assertEquals(expectedCondition, stanzaError.getCondition()); + // Now we should wait until participant one is informed about the (probably failed) new participant three // room join. But if joining failed, there will be no such update. All we can reasonably do is wait until // participant three has received its own presence response. This is not watertight though.