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

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


    public void testExitRoomWithRelaysWithStatus() throws Exception {
        String statusMessage = "Custom status";

        // add occupants to the room
        Room room = conference.findOrCreateRoom(ROOM1_JID, "Room 1");
        room.addOccupant(OCCUPANT1_JID, "Nick 1");
        room.addOccupant(OCCUPANT2_JID, "Nick 2");

        // now, let user 1 exit room
        exitRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK, statusMessage);

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


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

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

        enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK);

        assertEquals(1, room.getOccupantCount());
        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.getOccupantCount());

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

        assertEquals(1, room.getOccupantCount());
        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.getOccupantCount());
    }
View Full Code Here

        assertEquals(0, room.getOccupantCount());
    }

    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.getOccupantCount());
    }
View Full Code Here

        assertEquals(0, room.getOccupantCount());
    }

    public void testEnterRoomWithDuplicateNick() throws Exception {
        Room room1 = conference.findRoom(ROOM1_JID);
        room1.setRewriteDuplicateNick(false); // do not rewrite existing nick, second join will fail
        assertNull(enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK)); // 1st join                                  
        Stanza error = enterRoom(OCCUPANT2_JID, ROOM1_JID_WITH_NICK); // 2nd join

        assertNotNull(error);
    }
View Full Code Here

        assertNotNull(error);
    }

    public void testEnterRoomWithDuplicateNick_Rewrite() throws Exception {
        Room room1 = conference.findRoom(ROOM1_JID);
        room1.setRewriteDuplicateNick(true); // do rewrite nick, second join will succeed
        assertNull(enterRoom(OCCUPANT2_JID, ROOM1_JID_WITH_NICK)); // 1st join                                  
        Stanza error = enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK); // 2nd join
        assertNull(error);
        final Stanza stanza1 = occupant1Queue.getNext();
        final Stanza stanza2 = occupant1Queue.getNext();
View Full Code Here

        }
        assertTrue(rewriteCode);
    }

    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.getOccupantCount());
        Occupant occupant = room.getOccupants().iterator().next();

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

        assertChangeNotAllowed("Nick 2", StanzaErrorCondition.NOT_ALLOWED, null, Role.Participant);
    }

    public void testToRevokeYourself() throws Exception {
        Room room = conference.findOrCreateRoom(ROOM2_JID, "Room 2");
        Occupant occupant1 = room.addOccupant(OCCUPANT1_JID, "nick");
        occupant1.setRole(Role.Moderator);

        // added only for presence check later
        room.addOccupant(OCCUPANT2_JID, "Nick 2");
        room.getAffiliations().add(OCCUPANT1_JID, Affiliation.Owner);

        assertChangeNotAllowed("nick", StanzaErrorCondition.CONFLICT, null, Role.Participant);
    }
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.