test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java
/**
     * The owner of the room (the user who created it, and which is an
     * administrator too, typically user1) will revoke moderator role to user2.
     * The considered participant is then supposed to be a member.
     *
     * @throws OperationNotSupportedException
     * @throws OperationFailedException
     */
The owner of the room (the user who created it, and which is an
administrator too, typically user1) will revoke moderator role to user2.
The considered participant is then supposed to be a member.


The owner of the room ( the user who created it and which is an administrator too typically user1 ) will revoke moderator role to user2 . The considered participant is then supposed to be a member .
public void testRevokeModerator()
    throws OperationFailedException, OperationNotSupportedException
    {
        try
        {
            Thread.sleep(2000);
        }
        catch (InterruptedException ex)
        {}
        String roomName = testRoomBaseName + roomID;
        logger.info("--- Start testRevokeModerator room:" + roomName);
        ChatRoom roomUser1 = opSetMUC1.findRoom(roomName);
        assertNotNull("The room can't be retrieved on user1's side", roomUser1);
        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 roomUser3Col = new MUCEventCollector(
            roomUser3, MUCEventCollector.EVENT_ROLE);
        roomUser1.revokeModerator(fixture.userID2);
        roomUser1Col.waitForEvent(10000);
        roomUser3Col.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 user3's side",
            1, roomUser3Col.collectedEvents.size());
        ChatRoomMemberRoleChangeEvent roleEventUser3 =
            (ChatRoomMemberRoleChangeEvent) roomUser3Col.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.userID2,
            roleEventUser1.getSourceMember().getContactAddress());
        assertEquals("User2's previous role does not match",
            ChatRoomMemberRole.MODERATOR, roleEventUser1.getPreviousRole());
        assertEquals("Unexpected new role",
            ChatRoomMemberRole.MEMBER, roleEventUser1.getNewRole());
        assertEquals("Collected event does not belong to the right chatroom",
            roomName, XmppStringUtils.parseLocalpart(
                roleEventUser3.getSourceChatRoom().getName()));
        assertEquals("Collected event does not belong to the expected user",
            fixture.userID2,
            roleEventUser3.getSourceMember().getContactAddress());
        assertEquals("User2's previous role does not match",
            ChatRoomMemberRole.MODERATOR, roleEventUser3.getPreviousRole());
        assertEquals("Unexpected new role",
            ChatRoomMemberRole.MEMBER, roleEventUser3.getNewRole());
        logger.info("--- End testRevokeModerator room:" + roomName);
    }
public void testRevokeModerator ( ) throws OperationFailedException , OperationNotSupportedException { try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException ex ) { } String roomName = testRoomBaseName + roomID ; logger . info ( "--- Start testRevokeModerator room:" + roomName ) ; ChatRoom roomUser1 = opSetMUC1 . findRoom ( roomName ) ; assertNotNull ( "The room can't be retrieved on user1's side" , roomUser1 ) ; 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 roomUser3Col = new MUCEventCollector ( roomUser3 , MUCEventCollector . EVENT_ROLE ) ; roomUser1 . revokeModerator ( fixture . userID2 ) ; roomUser1Col . waitForEvent ( 10000 ) ; roomUser3Col . 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 user3's side" , 1 , roomUser3Col . collectedEvents . size ( ) ) ; ChatRoomMemberRoleChangeEvent roleEventUser3 = ( ChatRoomMemberRoleChangeEvent ) roomUser3Col . 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 . userID2 , roleEventUser1 . getSourceMember ( ) . getContactAddress ( ) ) ; assertEquals ( "User2's previous role does not match" , ChatRoomMemberRole . MODERATOR , roleEventUser1 . getPreviousRole ( ) ) ; assertEquals ( "Unexpected new role" , ChatRoomMemberRole . MEMBER , roleEventUser1 . getNewRole ( ) ) ; assertEquals ( "Collected event does not belong to the right chatroom" , roomName , XmppStringUtils . parseLocalpart ( roleEventUser3 . getSourceChatRoom ( ) . getName ( ) ) ) ; assertEquals ( "Collected event does not belong to the expected user" , fixture . userID2 , roleEventUser3 . getSourceMember ( ) . getContactAddress ( ) ) ; assertEquals ( "User2's previous role does not match" , ChatRoomMemberRole . MODERATOR , roleEventUser3 . getPreviousRole ( ) ) ; assertEquals ( "Unexpected new role" , ChatRoomMemberRole . MEMBER , roleEventUser3 . getNewRole ( ) ) ; logger . info ( "--- End testRevokeModerator room:" + roomName ) ; }
The owner of the room (the user who created it, and which is an
 administrator too, typically user1) will revoke moderator role to user2.
The owner of the room ( the user who created it and which is an administrator too typically user1 ) will revoke moderator role to user2 .
// Owner of the room revokes user2 member rights: