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

[sinttest] Add ejabberd specific behavior for mucMaxUsersLimitJoinRoomTest

ejabberd returns resource-constraint instead of service-unavailable if
the maximum number of participants is reached.
This commit is contained in:
Florian Schmaus 2024-05-20 22:00:56 +02:00
parent e69e7d2342
commit 6cda9a6379

View file

@ -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 // 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. // reasonably test here is whether the room doesn't have more occupants than its max size.
try { XMPPException.XMPPErrorException errorException = assertThrows(XMPPException.XMPPErrorException.class, () -> mucAsSeenByThree.join(nicknameThree));
mucAsSeenByThree.join(nicknameThree);
} catch (XMPPException.XMPPErrorException unavailableErrorException) { final StanzaError.Condition expectedCondition;
// This exception is expected if the muc implementation employs the strategy to deny access beyond the switch (sinttestConfiguration.compatibilityMode) {
// maxusers value default:
if (unavailableErrorException.getStanzaError() == null expectedCondition = StanzaError.Condition.service_unavailable;
|| !StanzaError.Condition.service_unavailable.equals( break;
unavailableErrorException.getStanzaError().getCondition())) { case ejabberd:
throw unavailableErrorException; 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 // 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 // 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. // participant three has received its own presence response. This is not watertight though.