test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java
/**
     * User2 which is currently moderator in the room for our scenario will
     * revoke voice to user3, thanks to his moderator privileges.
     *
     * We will first check that user3 has become a silent member before making
     * sure that he can't send messages through the room.
     *
     * @throws OperationNotSupportedException
     * @throws OperationFailedException
     */
User2 which is currently moderator in the room for our scenario will
revoke voice to user3, thanks to his moderator privileges.

We will first check that user3 has become a silent member before making
sure that he can't send messages through the room.


User2 which is currently moderator in the room for our scenario will revoke voice to user3 thanks to his moderator privileges . We will first check that user3 has become a silent member before making sure that he can ' t send messages through the room .
public void testRevokeVoice()
    throws OperationFailedException, OperationNotSupportedException
    {
        try
        {
            Thread.sleep(2000);
        }
        catch (InterruptedException ex)
        {}
        String roomName = testRoomBaseName + roomID;
        logger.info("---= Start test for RevokeVoice =--- room: " + roomName);
        ChatRoom roomUser1 = opSetMUC1.findRoom(roomName);
        assertNotNull("The room can't be retrieved on user1's side", roomUser1);
        ChatRoom roomUser2 = opSetMUC2.findRoom(roomName);
        assertNotNull("The room can't be retrieved on user2's side", roomUser2);
        ChatRoom roomUser3 = opSetMUC3.findRoom(roomName);
        assertNotNull("The room can't be retrieved on user3's side", roomUser3);
        MUCEventCollector roomUser1Col = new MUCEventCollector(
            roomUser1, MUCEventCollector.EVENT_ROLE);
        MUCEventCollector roomUser2Col = new MUCEventCollector(
            roomUser2, MUCEventCollector.EVENT_ROLE);
        roomUser2.revokeVoice(fixture.userID3);
        roomUser1Col.waitForEvent(10000);
        roomUser2Col.waitForEvent(10000);
        assertEquals("Wrong count of collected events on user1's side",
            1, roomUser1Col.collectedEvents.size());
        ChatRoomMemberRoleChangeEvent roleEventUser1 =
            (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0);
        assertEquals("Wrong count of collected events on user2's side",
            1, roomUser2Col.collectedEvents.size());
        ChatRoomMemberRoleChangeEvent roleEventUser2 =
            (ChatRoomMemberRoleChangeEvent) roomUser2Col.collectedEvents.get(0);
        assertEquals("Collected event does not belong to the right chatroom",
            roomName, XmppStringUtils.parseLocalpart(
                roleEventUser1.getSourceChatRoom().getName()));
        assertEquals("Collected event does not belong to the expected user",
            fixture.userID3,
            roleEventUser1.getSourceMember().getContactAddress());
        assertEquals("User3's previous role does not match",
            ChatRoomMemberRole.MEMBER, roleEventUser1.getPreviousRole());
        assertEquals("Unexpected new role",
            ChatRoomMemberRole.SILENT_MEMBER, roleEventUser1.getNewRole());
        assertEquals("Collected event does not belong to the right chatroom",
            roomName, XmppStringUtils.parseLocalpart(
                roleEventUser2.getSourceChatRoom().getName()));
        assertEquals("Collected event does not belong to the expected user",
            fixture.userID3,
            roleEventUser2.getSourceMember().getContactAddress());
        assertEquals("User3's previous role does not match",
            ChatRoomMemberRole.MEMBER, roleEventUser2.getPreviousRole());
        assertEquals("Unexpected new role",
            ChatRoomMemberRole.SILENT_MEMBER, roleEventUser2.getNewRole());
        logger.info("---= End test for RevokeVoice =--- room: " + roomName);
    }
public void testRevokeVoice ( ) throws OperationFailedException , OperationNotSupportedException { try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException ex ) { } String roomName = testRoomBaseName + roomID ; logger . info ( "---= Start test for RevokeVoice =--- room: " + roomName ) ; ChatRoom roomUser1 = opSetMUC1 . findRoom ( roomName ) ; assertNotNull ( "The room can't be retrieved on user1's side" , roomUser1 ) ; ChatRoom roomUser2 = opSetMUC2 . findRoom ( roomName ) ; assertNotNull ( "The room can't be retrieved on user2's side" , roomUser2 ) ; ChatRoom roomUser3 = opSetMUC3 . findRoom ( roomName ) ; assertNotNull ( "The room can't be retrieved on user3's side" , roomUser3 ) ; MUCEventCollector roomUser1Col = new MUCEventCollector ( roomUser1 , MUCEventCollector . EVENT_ROLE ) ; MUCEventCollector roomUser2Col = new MUCEventCollector ( roomUser2 , MUCEventCollector . EVENT_ROLE ) ; roomUser2 . revokeVoice ( fixture . userID3 ) ; roomUser1Col . waitForEvent ( 10000 ) ; roomUser2Col . waitForEvent ( 10000 ) ; assertEquals ( "Wrong count of collected events on user1's side" , 1 , roomUser1Col . collectedEvents . size ( ) ) ; ChatRoomMemberRoleChangeEvent roleEventUser1 = ( ChatRoomMemberRoleChangeEvent ) roomUser1Col . collectedEvents . get ( 0 ) ; assertEquals ( "Wrong count of collected events on user2's side" , 1 , roomUser2Col . collectedEvents . size ( ) ) ; ChatRoomMemberRoleChangeEvent roleEventUser2 = ( ChatRoomMemberRoleChangeEvent ) roomUser2Col . collectedEvents . get ( 0 ) ; assertEquals ( "Collected event does not belong to the right chatroom" , roomName , XmppStringUtils . parseLocalpart ( roleEventUser1 . getSourceChatRoom ( ) . getName ( ) ) ) ; assertEquals ( "Collected event does not belong to the expected user" , fixture . userID3 , roleEventUser1 . getSourceMember ( ) . getContactAddress ( ) ) ; assertEquals ( "User3's previous role does not match" , ChatRoomMemberRole . MEMBER , roleEventUser1 . getPreviousRole ( ) ) ; assertEquals ( "Unexpected new role" , ChatRoomMemberRole . SILENT_MEMBER , roleEventUser1 . getNewRole ( ) ) ; assertEquals ( "Collected event does not belong to the right chatroom" , roomName , XmppStringUtils . parseLocalpart ( roleEventUser2 . getSourceChatRoom ( ) . getName ( ) ) ) ; assertEquals ( "Collected event does not belong to the expected user" , fixture . userID3 , roleEventUser2 . getSourceMember ( ) . getContactAddress ( ) ) ; assertEquals ( "User3's previous role does not match" , ChatRoomMemberRole . MEMBER , roleEventUser2 . getPreviousRole ( ) ) ; assertEquals ( "Unexpected new role" , ChatRoomMemberRole . SILENT_MEMBER , roleEventUser2 . getNewRole ( ) ) ; logger . info ( "---= End test for RevokeVoice =--- room: " + roomName ) ; }
User2 which is currently moderator in the room for our scenario will
 revoke voice to user3, thanks to his moderator privileges.
User2 which is currently moderator in the room for our scenario will revoke voice to user3 thanks to his moderator privileges .
// User2 (moderator role) revokes voice right to user2 (guest):