test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java
/**
     * Tests participant roles when the room just has been created.
     * The member who has created the room should have OWNER role.
     * Others participants who are invited to the room should be MEMBER.
     *
     * @throws OperationNotSupportedException
     * @throws OperationFailedException
     */
Tests participant roles when the room just has been created.
The member who has created the room should have OWNER role.
Others participants who are invited to the room should be MEMBER.


Tests participant roles when the room just has been created . The member who has created the room should have OWNER role . Others participants who are invited to the room should be MEMBER .
public void testInitialParticipantsRoles()
    throws OperationFailedException, OperationNotSupportedException
    {
        String roomName = testRoomBaseName + roomID;
        logger.info("--- Start testInitialParticipantsRoles room:" + roomName);
        ChatRoom roomUser1 = opSetMUC1.createChatRoom(roomName, null);
        roomUser1.join();
        MUCEventCollector roomUser1Collector =
            new MUCEventCollector(roomUser1, MUCEventCollector.EVENT_PRESENCE);
        roomUser1Collector.waitForEvent(10000); 
        assertEquals("Unexpected role for user1",
            roomUser1.getUserRole(), ChatRoomMemberRole.OWNER);
        assertEquals("Unexpected role for user1", roomUser1.getUserRole(),
            getRole(fixture.userID1, roomUser1.getMembers(),
                    roomUser1.getName(), true));
        ChatRoom roomUser2 = opSetMUC2.findRoom(roomName);
        assertNotNull("Room can't be retrieved on user2's side", roomUser2);
        roomUser2.join();
        roomUser1Collector.waitForEvent(10000); 
        ChatRoom roomUser3 = opSetMUC3.findRoom(roomName);
        assertNotNull("Room can't be retrieved on user3's side", roomUser2);
        roomUser3.join();
        roomUser1Collector.waitForEvent(10000); 
        assertTrue("User2 not on member list after having join the room"
            , nameIsOnMemberList(fixture.userID2, roomUser1.getMembers()));
        assertTrue("User3 not on member list after having join the room"
            , nameIsOnMemberList(fixture.userID3, roomUser1.getMembers()));
        List<ChatRoomMember> members = roomUser1.getMembers();
        assertEquals("Unexpected members count", 3, members.size());
        assertEquals("The current implementation requires that room's new " +
            "comers must have MEMBER role",
            ChatRoomMemberRole.MEMBER, getRole(fixture.userID2, members,
                                        roomName, true));
        assertEquals("The current implementation requires that room's new " +
            "comers must have the MEMBER role",
            ChatRoomMemberRole.MEMBER, getRole(fixture.userID3, members,
                                        roomName, true));
        logger.info("--- End testInitialParticipantsRoles room:" + roomName);
    }
public void testInitialParticipantsRoles ( ) throws OperationFailedException , OperationNotSupportedException { String roomName = testRoomBaseName + roomID ; logger . info ( "--- Start testInitialParticipantsRoles room:" + roomName ) ; ChatRoom roomUser1 = opSetMUC1 . createChatRoom ( roomName , null ) ; roomUser1 . join ( ) ; MUCEventCollector roomUser1Collector = new MUCEventCollector ( roomUser1 , MUCEventCollector . EVENT_PRESENCE ) ; roomUser1Collector . waitForEvent ( 10000 ) ; assertEquals ( "Unexpected role for user1" , roomUser1 . getUserRole ( ) , ChatRoomMemberRole . OWNER ) ; assertEquals ( "Unexpected role for user1" , roomUser1 . getUserRole ( ) , getRole ( fixture . userID1 , roomUser1 . getMembers ( ) , roomUser1 . getName ( ) , true ) ) ; ChatRoom roomUser2 = opSetMUC2 . findRoom ( roomName ) ; assertNotNull ( "Room can't be retrieved on user2's side" , roomUser2 ) ; roomUser2 . join ( ) ; roomUser1Collector . waitForEvent ( 10000 ) ; ChatRoom roomUser3 = opSetMUC3 . findRoom ( roomName ) ; assertNotNull ( "Room can't be retrieved on user3's side" , roomUser2 ) ; roomUser3 . join ( ) ; roomUser1Collector . waitForEvent ( 10000 ) ; assertTrue ( "User2 not on member list after having join the room" , nameIsOnMemberList ( fixture . userID2 , roomUser1 . getMembers ( ) ) ) ; assertTrue ( "User3 not on member list after having join the room" , nameIsOnMemberList ( fixture . userID3 , roomUser1 . getMembers ( ) ) ) ; List < ChatRoomMember > members = roomUser1 . getMembers ( ) ; assertEquals ( "Unexpected members count" , 3 , members . size ( ) ) ; assertEquals ( "The current implementation requires that room's new " + "comers must have MEMBER role" , ChatRoomMemberRole . MEMBER , getRole ( fixture . userID2 , members , roomName , true ) ) ; assertEquals ( "The current implementation requires that room's new " + "comers must have the MEMBER role" , ChatRoomMemberRole . MEMBER , getRole ( fixture . userID3 , members , roomName , true ) ) ; logger . info ( "--- End testInitialParticipantsRoles room:" + roomName ) ; }
Tests participant roles when the room just has been created.
Tests participant roles when the room just has been created .
// We create the test room // wait for user1 // User1 who just created the room is supposed to be the owner: // Both of our peers join the room: // wait for user2 // wait for user3 // Three members are supposed to be in the room: // We are sure two of these members are our peers (checked before the // last assertion), now we make sure they are both members: // (Note that the first element of the list refers to the owner)