[sinttest] Increase 'try' block in MultiUserChatRolesAffiliations*Test

Fixes: aff6283798
This commit is contained in:
Florian Schmaus 2021-12-13 20:52:22 +01:00
parent 400a2b2564
commit 4e2d0035ac
1 changed files with 92 additions and 95 deletions

View File

@ -82,13 +82,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
// This implicitly tests "The service MUST add the user to the moderator list and then inform the admin of
// success" in §9.6, since it'll throw on either an error IQ or on no response.
mucAsSeenByOne.grantModerator(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -130,13 +131,13 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
mucAsSeenByOne.grantModerator(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -178,12 +179,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByOne.grantModerator(nicknameTwo);
mucAsSeenByOne.revokeModerator(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -225,6 +226,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
@ -232,7 +234,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByOne.grantModerator(nicknameTwo);
mucAsSeenByOne.revokeModerator(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -273,10 +274,10 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByOne.revokeVoice(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -318,13 +319,13 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
mucAsSeenByOne.revokeVoice(nicknameTwo);
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -366,12 +367,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
// This implicitly tests "The service MUST add the user to the admin list and then inform the owner of success" in §10.6, since it'll throw on either an error IQ or on no response.
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -414,13 +415,13 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -461,13 +462,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
mucAsSeenByOne.revokeAdmin(conTwo.getUser().asEntityBareJid());
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -509,6 +509,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
});
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
@ -516,7 +517,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
mucAsSeenByOne.revokeAdmin(conTwo.getUser().asEntityBareJid());
try {
resultSyncPoint.waitForResult(timeout);
} finally {
tryDestroy(mucAsSeenByOne);
@ -546,6 +546,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
@ -553,7 +554,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByTwo.addParticipantListener(kickPresence -> resultSyncPoint.signal(kickPresence));
mucAsSeenByOne.kickParticipant(nicknameTwo, "Nothing personal. Just a test.");
try {
Presence kickPresence = resultSyncPoint.waitForResult(timeout);
MUCUser mucUser = MUCUser.from(kickPresence);
assertNotNull(mucUser);
@ -593,6 +593,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
MultiUserChat mucAsSeenByThree = mucManagerThree.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, "one-" + randomString);
try {
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
mucAsSeenByTwo.join(nicknameTwo);
@ -602,7 +603,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByThree.addParticipantListener(kickPresence -> resultSyncPoint.signal(kickPresence));
mucAsSeenByOne.kickParticipant(nicknameTwo, "Nothing personal. Just a test.");
try {
Presence kickPresence = resultSyncPoint.waitForResult(timeout);
MUCUser mucUser = MUCUser.from(kickPresence);
assertNotNull(mucUser);
@ -646,7 +646,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
createMuc(mucAsSeenByOne, nicknameOne);
try {
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
@ -694,7 +693,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString);
createModeratedMuc(mucAsSeenByOne, nicknameOne);
try {
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByOne.grantModerator(nicknameTwo);
@ -732,14 +730,13 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
createModeratedMuc(mucAsSeenByOne, nicknameOne);
try {
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
mucAsSeenByOne.grantModerator(nicknameThree);
try {
// Admin cannot revoke from Owner
XMPPException.XMPPErrorException xe1 = assertThrows(XMPPException.XMPPErrorException.class,
() -> mucAsSeenByTwo.revokeModerator(nicknameOne));
@ -780,6 +777,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
final Resourcepart nicknameThree = Resourcepart.from("three-" + randomString);
createMuc(mucAsSeenByOne, nicknameOne);
try {
mucAsSeenByTwo.join(nicknameTwo);
mucAsSeenByThree.join(nicknameThree);
@ -793,7 +791,6 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
resultSyncPoint.waitForResult(timeout);
try {
assertEquals(mucAsSeenByOne.getOccupantsCount(), 3);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(
JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole());