1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-31 17:25:58 +01:00

[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

View file

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