Class MultiUserChatOccupantIntegrationTest

    • Constructor Detail

      • MultiUserChatOccupantIntegrationTest

        public MultiUserChatOccupantIntegrationTest​(SmackIntegrationTestEnvironment environment)
                                             throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                    org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                                    java.lang.InterruptedException,
                                                    TestNotPossibleException
        Throws:
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        org.jivesoftware.smack.SmackException.NotConnectedException
        java.lang.InterruptedException
        TestNotPossibleException
    • Method Detail

      • mucJoinEventOrderingTest

        @SmackIntegrationTest(section="7.1 & 7.2.2",
                              quote="\u00a7 7.1 The order of events involved in joining a room needs to be consistent so that clients can know which events to expect when. After a client sends presence to join a room, the MUC service MUST send it events in the following order: 1. In-room presence from other occupants 2. In-room presence from the joining entity itself (so-called \"self-presence\") 3. Room history (if any) 4. The room subject [...]\u00a7 7.2.2 This self-presence MUST NOT be sent to the new occupant until the room has sent the presence of all other occupants to the new occupant ... The service MUST first send the complete list of the existing occupants to the new occupant and only then send the new occupant\'s own presence to the new occupant")
        public void mucJoinEventOrderingTest()
                                      throws java.lang.Exception
        Asserts that when a user joins a room, all events are received, and in the correct order.
        Throws:
        java.lang.Exception - when errors occur
      • mucSendBeforeJoiningTest

        @SmackIntegrationTest(section="7.2.1 & 7.4",
                              quote="\u00a7 7.2.1: In order to participate in the discussions held in a multi-user chat room, a user MUST first become an occupant by entering the room [...] \u00a7 7.4: If the sender is not an occupant of the room, the service SHOULD return a <not-acceptable/> error to the sender and SHOULD NOT reflect the message to all occupants")
        public void mucSendBeforeJoiningTest()
                                      throws java.lang.Exception
        Asserts that when a user sends a message to a room without joining, they receive an error and the message is not sent to the occupants.

        From XEP-0045 § 7.2.1:

        In order to participate in the discussions held in a multi-user chat room, a user MUST first become an occupant by entering the room

        From XEP-0045 § 7.4:

        If the sender is not an occupant of the room, the service SHOULD return a <not-acceptable/> error to the sender and SHOULD NOT reflect the message to all occupants
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinPresenceInformationTest

        @SmackIntegrationTest(section="7.2.2",
                              quote="If the service is able to add the user to the room, it MUST send presence from all the existing participants\' occupant JIDs to the new occupant\'s full JID, including extended presence information about roles in a single <x/> element qualified by the \'http://jabber.org/protocol/muc#user\' namespace and containing an <item/> child with the \'role\' attribute set to a value of \"moderator\", \"participant\", or \"visitor\", and with the \'affiliation\' attribute set to a value of \"owner\", \"admin\", \"member\", or \"none\" as appropriate. [...] the \"self-presence\" sent by the room to the new user MUST include a status code of 110 so that the user knows this presence refers to itself as an occupant [...] The service MUST first send the complete list of the existing occupants to the new occupant and only then send the new occupant\'s own presence to the new occupant.")
        public void mucJoinPresenceInformationTest()
                                            throws java.lang.Exception
        Asserts that when a user joins a room, they are sent presence information about existing participants and themselves that includes role and affiliation information and appropriate status codes.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinPresenceBroadcastTest

        @SmackIntegrationTest(section="7.2.2",
                              quote="the service MUST also send presence from the new participant\'s occupant JID to the full JIDs of all the occupants (including the new occupant)")
        public void mucJoinPresenceBroadcastTest()
                                          throws java.lang.Exception
        Asserts that when a user joins a room, all users are sent presence information about the new participant.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinNonAnonymousRoomTest

        @SmackIntegrationTest(section="7.2.3",
                              quote="If the room is non-anonymous, the service MUST send the new occupant\'s full JID to all occupants using extended presence information in an <x/> element qualified by the \'http://jabber.org/protocol/muc#user\' namespace and containing an <item/> child with a \'jid\' attribute specifying the occupant\'s full JID. [...]If the user is entering a room that is non-anonymous (i.e., which informs all occupants of each occupant\'s full JID as shown above), the service MUST warn the user by including a status code of \"100\" in the initial presence that the room sends to the new occupant.")
        public void mucJoinNonAnonymousRoomTest()
                                         throws java.lang.Exception
        Asserts that when a user enters a non-anonymous room, the presence notifications contain extended presence information.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinSemiAnonymousRoomReceivedByNonModeratorTest

        @SmackIntegrationTest(section="7.2.4",
                              quote="If the room is semi-anonymous, the service MUST send presence from the new occupant to all occupants as specified above (i.e., unless the room is configured to not broadcast presence from new occupants below a certain affiliation level as controlled by the \"muc#roomconfig_presencebroadcast\" room configuration option), but MUST include the new occupant\'s full JID only in the presence notifications it sends to occupants with a role of \"moderator\" and not to non-moderator occupants.")
        public void mucJoinSemiAnonymousRoomReceivedByNonModeratorTest()
                                                                throws java.lang.Exception
        Asserts that when a user enters a semi-anonymous room, the presence notifications received by occupants that are not a moderator does not contain extended presence information.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinSemiAnonymousRoomReceivedByModeratorTest

        @SmackIntegrationTest(section="7.2.4",
                              quote="If the room is semi-anonymous, the service MUST send presence from the new occupant to all occupants as specified above (i.e., unless the room is configured to not broadcast presence from new occupants below a certain affiliation level as controlled by the \"muc#roomconfig_presencebroadcast\" room configuration option), but MUST include the new occupant\'s full JID only in the presence notifications it sends to occupants with a role of \"moderator\" and not to non-moderator occupants.")
        public void mucJoinSemiAnonymousRoomReceivedByModeratorTest()
                                                             throws java.lang.Exception
        Asserts that when a user enters a semi-anonymous room, the presence notifications contain extended presence information when sent to moderators.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinPasswordProtectedWithoutPasswordRoomTest

        @SmackIntegrationTest(section="7.2.5",
                              quote="If the room requires a password and the user did not supply one (or the password provided is incorrect), the service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning a presence stanza of type \"error\" specifying a <not-authorized/> error.")
        public void mucJoinPasswordProtectedWithoutPasswordRoomTest()
                                                             throws java.lang.Exception
        Asserts that a user can not enter a password-protected room without supplying a password.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinPasswordProtectedRoomWrongPasswordTest

        @SmackIntegrationTest(section="7.2.5",
                              quote="If the room requires a password and the user did not supply one (or the password provided is incorrect), the service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning a presence stanza of type \"error\" specifying a <not-authorized/> error.")
        public void mucJoinPasswordProtectedRoomWrongPasswordTest()
                                                           throws java.lang.Exception
        Asserts that a user can not enter a password-protected room without supplying the correct password.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinPasswordProtectedRoomCorrectPasswordTest

        @SmackIntegrationTest(section="7.2.5",
                              quote="If the room requires a password and the user did not supply one (or the password provided is incorrect), the service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning a presence stanza of type \"error\" specifying a <not-authorized/> error.")
        public void mucJoinPasswordProtectedRoomCorrectPasswordTest()
                                                             throws java.lang.Exception
        Asserts that a user can enter a password-protected room when supplying the correct password.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinMembersOnlyRoomTest

        @SmackIntegrationTest(section="7.2.6",
                              quote="If the room is members-only but the user is not on the member list, the service MUST deny access to the room and inform the user that they are not allowed to enter the room; this is done by returning a presence stanza of type \"error\" specifying a <registration-required/> error condition.")
        public void mucJoinMembersOnlyRoomTest()
                                        throws java.lang.Exception
        Asserts that a user can not enter a members-only room while not being a member. This test does not cover § 9.3, aka the happy path.
        Throws:
        java.lang.Exception - when errors occur
      • mucBannedUserJoinRoomTest

        @SmackIntegrationTest(section="7.2.7",
                              quote="If the user has been banned from the room (i.e., has an affiliation of \"outcast\"), the service MUST deny access to the room and inform the user of the fact that they are banned; this is done by returning a presence stanza of type \"error\" specifying a <forbidden/> error condition.")
        public void mucBannedUserJoinRoomTest()
                                       throws java.lang.Exception
        Asserts that a user can not enter a room while being banned.

        From XEP-0045 § 7.2.7:

        Throws:
        java.lang.Exception - when errors occur
      • mucNicknameConflictJoinRoomTest

        @SmackIntegrationTest(section="7.2.8",
                              quote="If the room already contains another user with the nickname desired by the user seeking to enter the room (or if the nickname is reserved by another user on the member list), the service MUST deny access to the room and inform the user of the conflict; this is done by returning a presence stanza of type \"error\" specifying a <conflict/> error condition.")
        public void mucNicknameConflictJoinRoomTest()
                                             throws java.lang.Exception
        Asserts that a user can not enter a room with the same nickname as another user who is already present.
        Throws:
        java.lang.Exception - when errors occur
      • mucMaxUsersLimitJoinRoomTest

        @SmackIntegrationTest(section="7.2.9",
                              quote="If the room has reached its maximum number of occupants, the service SHOULD deny access to the room and inform the user of the restriction; this is done by returning a presence stanza of type \"error\" specifying a <service-unavailable/> error condition. Alternatively, the room could kick an \"idle user\" in order to free up space (where the definition of \"idle user\" is up to the implementation).")
        public void mucMaxUsersLimitJoinRoomTest()
                                          throws java.lang.Exception
        Asserts that a room can not go past the configured maximum number of users, if a non-admin non-owner user attempts to join.
        Throws:
        java.lang.Exception - when errors occur
      • mucMaxUsersLimitAdminCanStillJoinRoomTest

        @SmackIntegrationTest(section="7.2.9",
                              quote="If the room has reached its maximum number of occupants and a room admin or owner attempts to join, the room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
        public void mucMaxUsersLimitAdminCanStillJoinRoomTest()
                                                       throws java.lang.Exception
        Asserts that an admin can still join a room that has reached the configured maximum number of users.
        Throws:
        java.lang.Exception - when errors occur
      • mucMaxUsersLimitOwnerCanStillJoinRoomTest

        @SmackIntegrationTest(section="7.2.9",
                              quote="If the room has reached its maximum number of occupants and a room admin or owner attempts to join, the room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
        public void mucMaxUsersLimitOwnerCanStillJoinRoomTest()
                                                       throws java.lang.Exception
        Asserts that an owner can still join a room that has reached the configured maximum number of users.
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinLockedRoomTest

        @SmackIntegrationTest(section="7.2.10",
                              quote="If a user attempts to enter a room while it is \"locked\" (i.e., before the room creator provides an initial configuration and therefore before the room officially exists), the service MUST refuse entry and return an <item-not-found/> error to the user.")
        public void mucJoinLockedRoomTest()
                                   throws java.lang.Exception
        Asserts that a room can not be entered while it still being created (locked).
        Throws:
        java.lang.Exception - when errors occur
      • mucJoinRoomWithPublicLoggingTest

        @SmackIntegrationTest(section="7.2.12",
                              quote="If the user is entering a room in which the discussions are logged to a public archive (often accessible via HTTP), the service SHOULD allow the user to enter the room but MUST also warn the user that the discussions are logged. This is done by including a status code of \"170\" in the initial presence that the room sends to the new occupant.")
        public void mucJoinRoomWithPublicLoggingTest()
                                              throws java.lang.Exception
        Asserts that a user is warned when entering a room that allows public logging.
        Throws:
        java.lang.Exception - when errors occur
      • mucChangeNicknameInformationTest

        @SmackIntegrationTest(section="7.6",
                              quote="A common feature of chat rooms is the ability for an occupant to change his or her nickname within the room. In MUC this is done by sending updated presence information to the room, specifically by sending presence to a new occupant JID in the same room (changing only the resource identifier in the occupant JID). The service then sends two presence stanzas to the full JID of each occupant (including the occupant who is changing his or her room nickname), one of type \"unavailable\" for the old nickname and one indicating availability for the new nickname. The unavailable presence MUST contain the following as extended presence information in an <x/>; element qualified by the \'http://jabber.org/protocol/muc#user\' namespace: - The new nickname (in this case, nick=\'oldhag\') - A status code of 303 This enables the recipients to correlate the old roomnick with the new roomnick.\n")
        public void mucChangeNicknameInformationTest()
                                              throws java.lang.Exception
        Asserts that all users in a room are correctly informed about nickname change of a participant.
        Throws:
        java.lang.Exception - when errors occur
      • mucBlockChangeNicknameInformationTest

        @SmackIntegrationTest(section="7.6",
                              quote="If the user attempts to change his or her room nickname to a room nickname that is already in use by another user (or that is reserved by another user affiliated with the room, e.g., a member or owner), the service MUST deny the nickname change request and inform the user of the conflict; this is done by returning a presence stanza of type \"error\" specifying a <conflict/> error condition:")
        public void mucBlockChangeNicknameInformationTest()
                                                   throws java.lang.Exception
        Asserts that user can not change nickname to one that is already in use.
        Throws:
        java.lang.Exception - when errors occur
      • mucLeaveTest

        @SmackIntegrationTest(section="7.14",
                              quote="The service MUST then send a presence stanzas of type \"unavailable\" from the departing user\'s occupant JID to the departing occupant\'s full JIDs, including a status code of \"110\" to indicate that this notification is \"self-presence\"")
        public void mucLeaveTest()
                          throws java.lang.Exception
        Asserts that when a user leaves a room, they are themselves included on the list of users notified (self-presence).
        Throws:
        java.lang.Exception - when errors occur