Skip to content

Commit

Permalink
[sinttest] Add MultiUserChatIntegrationTest.mucNameChangeTest()
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed May 20, 2024
1 parent 9f58c99 commit c5e3f89
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@

import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException;

import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
Expand All @@ -33,6 +40,7 @@
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException;

@SpecificationReference(document = "XEP-0045")
public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrationTest {
Expand Down Expand Up @@ -119,4 +127,29 @@ public void roomDestroyed(MultiUserChat alternateMUC, String reason) {
assertEquals(0, muc.getOccupantsCount(), "Expected room " + mucAddress + " to no longer have any occupants after it was destroyed (but it has).");
assertNull(muc.getNickname());
}

@SmackIntegrationTest
public void mucNameChangeTest()
throws XmppStringprepException, MucAlreadyJoinedException, MissingMucCreationAcknowledgeException,
NotAMucServiceException, NoResponseException, XMPPErrorException, NotConnectedException,
InterruptedException, MucConfigurationNotSupportedException {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-muc-name-change");

MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(muc, Resourcepart.from("one-" + randomString));

final String newRoomName = "New Room Name (" + randomString + ")";

try {
muc.getConfigFormManager()
.setRoomName(newRoomName)
.submitConfigurationForm();

MultiUserChatManager mucManager = MultiUserChatManager.getInstanceFor(conTwo);
RoomInfo roomInfo = mucManager.getRoomInfo(muc.getRoom());
assertEquals(newRoomName, roomInfo.getName());
} finally {
tryDestroy(muc);
}
}
}

0 comments on commit c5e3f89

Please sign in to comment.