Package org.apache.vysper.xmpp.modules.extension.xep0045_muc.model

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room


    protected StanzaHandler createHandler() {
        return new MUCPresenceHandler(conference);
    }

    public void testEnterExistingRoom() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        assertEquals(0, room.getOccupants().size());

        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK);

        assertEquals(1, room.getOccupants().size());
        Occupant occupant = room.getOccupants().iterator().next();

        assertEquals(OCCUPANT1_JID, occupant.getJid());
        assertEquals("nick", occupant.getNick());
    }
View Full Code Here


        assertEquals(OCCUPANT1_JID, occupant.getJid());
        assertEquals("nick", occupant.getNick());
    }

    public void testEnterWithGroupchatProtocol() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        assertEquals(0, room.getOccupants().size());

        // enter using the old groupchat protocol
        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK, null, null, true);

        assertEquals(1, room.getOccupants().size());
        Occupant occupant = room.getOccupants().iterator().next();

        assertEquals(OCCUPANT1_JID, occupant.getJid());
        assertEquals("nick", occupant.getNick());
    }
View Full Code Here

        assertEquals(OCCUPANT1_JID, occupant.getJid());
        assertEquals("nick", occupant.getNick());
    }

    public void testEnterAsAdmin() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.getAffiliations().add(OCCUPANT1_JID, Affiliation.Admin);

        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK);

        Occupant occupant = room.getOccupants().iterator().next();

        assertEquals(Affiliation.Admin, occupant.getAffiliation());
    }
View Full Code Here

        assertEquals(Affiliation.Admin, occupant.getAffiliation());
    }

    public void testEnterAsOutcast() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.getAffiliations().add(OCCUPANT1_JID, Affiliation.Outcast);

        Stanza error = enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK);
        assertPresenceErrorStanza(error, ROOM1_JID, OCCUPANT1_JID, StanzaErrorType.AUTH, StanzaErrorCondition.FORBIDDEN);

        assertEquals(0, room.getOccupants().size());
    }
View Full Code Here

        assertEquals(0, room.getOccupants().size());
    }

    public void testEnterAsNonMember() throws Exception {
        Room room = conference.createRoom(ROOM2_JID, "Room", RoomType.MembersOnly);

        Stanza error = enterRoom(OCCUPANT1_JID, ROOM2_JID_WITH_NICK);
        assertPresenceErrorStanza(error, ROOM2_JID, OCCUPANT1_JID, StanzaErrorType.AUTH, StanzaErrorCondition.REGISTRATION_REQUIRED);

        assertEquals(0, room.getOccupants().size());
    }
View Full Code Here

        assertNotNull(error);
    }

    public void testEnterNonExistingRoom() throws Exception {
        Room room = conference.findRoom(ROOM2_JID);
        assertNull(room);

        enterRoom(OCCUPANT1_JID, ROOM2_JID_WITH_NICK);

        room = conference.findRoom(ROOM2_JID);
        assertNotNull(room);
        assertEquals(1, room.getOccupants().size());
        Occupant occupant = room.getOccupants().iterator().next();

        assertEquals(OCCUPANT1_JID, occupant.getJid());
        assertEquals("nick", occupant.getNick());
        assertEquals(Role.Moderator, occupant.getRole());
    }
View Full Code Here

        assertPresenceErrorStanza(response, ROOM1_JID, OCCUPANT1_JID, StanzaErrorType.MODIFY, StanzaErrorCondition.JID_MALFORMED);
    }

    public void testEnterWithPassword() throws Exception {
        Room room = conference.createRoom(ROOM2_JID, "Room 1", RoomType.PasswordProtected);
        room.setPassword("secret");

        // no error should be returned
        assertNull(enterRoom(OCCUPANT1_JID, ROOM2_JID_WITH_NICK, "secret", null, false));
        assertEquals(1, room.getOccupants().size());
    }
View Full Code Here

        assertNull(enterRoom(OCCUPANT1_JID, ROOM2_JID_WITH_NICK, "secret", null, false));
        assertEquals(1, room.getOccupants().size());
    }

    public void testEnterWithoutPassword() throws Exception {
        Room room = conference.createRoom(ROOM2_JID, "Room 1", RoomType.PasswordProtected);
        room.setPassword("secret");

        // try entering without a password
        Stanza response = enterRoom(OCCUPANT1_JID, ROOM2_JID_WITH_NICK);

        assertPresenceErrorStanza(response, ROOM2_JID, OCCUPANT1_JID, StanzaErrorType.AUTH, StanzaErrorCondition.NOT_AUTHORIZED);
View Full Code Here

    }

    public void testEnterRoomWithRelays() throws Exception {

        // add one occupant to the room
        Room room = conference.findOrCreateRoom(ROOM1_JID, "Room 1");
        room.addOccupant(OCCUPANT2_JID, "Some nick");

        // now, let user 1 enter room
        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK);

        // verify stanzas to existing occupants on the new user
View Full Code Here

    }

    public void testDiscussionHistory() throws Exception {
        // add some messages
        Room room = conference.findOrCreateRoom(ROOM1_JID, "Room 1");
        room.getHistory().append(
                StanzaBuilder.createMessageStanza(OCCUPANT2_JID, ROOM1_JID, MessageStanzaType.GROUPCHAT, null, "Body")
                        .build(), new Occupant(OCCUPANT2_JID, "nick2", room, Role.Participant));
        room.getHistory().append(
                StanzaBuilder.createMessageStanza(OCCUPANT2_JID, ROOM1_JID, MessageStanzaType.GROUPCHAT, null, "Body2")
                        .build(), new Occupant(OCCUPANT2_JID, "nick2", room, Role.Participant));
        room.getHistory().append(
                StanzaBuilder.createMessageStanza(OCCUPANT2_JID, ROOM1_JID, MessageStanzaType.GROUPCHAT, null, "Body3")
                        .build(), new Occupant(OCCUPANT2_JID, "nick2", room, Role.Participant));

        // now, let user 1 enter room
        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK, null, new History(2, null, null, null), false);
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.