From 482a117e0da416110319192630b85dfc6c0fc533 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 May 2024 22:05:52 +0200 Subject: [PATCH] [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. --- .../smackx/muc/AbstractMultiUserChatIntegrationTest.java | 6 ------ .../smackx/muc/MultiUserChatOccupantIntegrationTest.java | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java index c48cbcf1b..0f803e97f 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java @@ -196,10 +196,4 @@ public abstract class AbstractMultiUserChatIntegrationTest extends AbstractSmack muc.sendConfigurationForm(answerForm); } - static void setPublicLogging(MultiUserChat muc, boolean publicLogging) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, InterruptedException, SmackException.NotConnectedException { - Form configForm = muc.getConfigurationForm(); - FillableForm answerForm = configForm.getFillableForm(); - answerForm.setAnswer("muc#roomconfig_enablelogging", publicLogging); - muc.sendConfigurationForm(answerForm); - } } 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 484cfae73..0701ecede 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 @@ -37,6 +37,7 @@ import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.sm.predicates.ForEveryMessage; import org.jivesoftware.smack.util.StringUtils; +import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException; import org.jivesoftware.smackx.muc.packet.MUCItem; import org.jivesoftware.smackx.muc.packet.MUCUser; @@ -924,12 +925,17 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI final Resourcepart nicknameTwo = Resourcepart.from("two-" + randomString); createMuc(mucAsSeenByOne, nicknameOne); - setPublicLogging(mucAsSeenByOne, true); try { + mucAsSeenByOne.getConfigFormManager() + .enablePublicLogging() + .submitConfigurationForm(); + Presence twoPresence = mucAsSeenByTwo.join(nicknameTwo); assertTrue(MUCUser.from(twoPresence).getStatus().stream().anyMatch(status -> 170 == status.getCode()), "Expected initial presence reflected to '" + conTwo.getUser() + "' when joining room '" + mucAddress + "' to include the status code '170' (but it did not)."); + } catch (MucConfigurationNotSupportedException e) { + throw new TestNotPossibleException(e); } finally { mucAsSeenByOne.destroy(); }