mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
[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.
This commit is contained in:
parent
1d498efd46
commit
482a117e0d
2 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue