Examples of EntityImpl


Examples of org.apache.vysper.xmpp.addressing.EntityImpl

    public void testChangeNick() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "nick 2");

        changeNick(OCCUPANT1_JID, new EntityImpl(ROOM1_JID, "new nick"));
       
        Occupant occupant = room.findOccupantByJID(OCCUPANT1_JID);
        assertEquals("new nick", occupant.getName());

        Item unavailbleItem = new Item(OCCUPANT1_JID, "new nick", Affiliation.None, Role.Participant);
        assertPresenceStanza(occupant1Queue.getNext(), new EntityImpl(ROOM1_JID, "nick"), OCCUPANT1_JID, "unavailable",
                Arrays.asList(unavailbleItem), Arrays.asList(StatusCode.NEW_NICK, StatusCode.OWN_PRESENCE));
        assertPresenceStanza(occupant2Queue.getNext(), new EntityImpl(ROOM1_JID, "nick"), OCCUPANT2_JID, "unavailable",
                Arrays.asList(unavailbleItem), Arrays.asList(StatusCode.NEW_NICK));

        Item availbleItem = new Item(OCCUPANT1_JID, null, Affiliation.None, Role.Participant);
        assertPresenceStanza(occupant1Queue.getNext(), new EntityImpl(ROOM1_JID, "new nick"), OCCUPANT1_JID, null,
                Arrays.asList(availbleItem), Arrays.asList(StatusCode.OWN_PRESENCE));
        assertPresenceStanza(occupant2Queue.getNext(), new EntityImpl(ROOM1_JID, "new nick"), OCCUPANT2_JID, null,
                Arrays.asList(availbleItem), null);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

    public void testChangeNickWithDuplicateNick() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "nick 2");
       
        Stanza error = changeNick(OCCUPANT1_JID, new EntityImpl(ROOM1_JID,"nick 2"));
       
        assertNotNull(error);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        String alias = decodedParts.get(0); // "authorization identity (identity to act as)", currently unused
        String username = decodedParts.get(1); // "authentication identity (identity whose password will be used)"
        String password = decodedParts.get(2);

        if (!username.contains("@")) username = username + "@" + sessionContext.getServerJID().getDomain();
        EntityImpl initiatingEntity;
        try {
            initiatingEntity = EntityImpl.parse(username);
        } catch (EntityFormatException e) {
            return AUTHORIZATION_RESPONSES.getFailureNotAuthorized();
        }
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        serverEntity = new EntityImpl(null, "pubsub.vysper.org", null);
        sessionContext = createTestSessionContext(serverEntity);

        root = new CollectionNode();
        serviceConfiguration = new PubSubServiceConfiguration(root);
        configurePubsubModule(sessionContext, serviceConfiguration);

        clientBare = new EntityImpl("tester", "vysper.org", null);
        sessionContext.setInitiatingEntity(clientBare);

        String boundResourceId = sessionContext.bindResource();
        client = new EntityImpl(clientBare, boundResourceId);
        pubsubService = EntityImpl.parse("pubsub.vysper.org");
        setResourceConnected(boundResourceId);

        handler = getHandler();
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        Room room = conference.findOrCreateRoom(ROOM1_JID, "Room 1");
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "Nick 2");

        // send message to occupant 1
        sendMessage(OCCUPANT1_JID, new EntityImpl(ROOM1_JID, "Nick 2"), MessageStanzaType.CHAT, body);

        // verify stanzas to existing occupants on the exiting user
        assertMessageStanza(ROOM1_JID_WITH_NICK, OCCUPANT2_JID, "chat", body,
                occupant2Queue.getNext());
        assertNull(occupant1Queue.getNext());
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        Room room = conference.findOrCreateRoom(ROOM1_JID, "Room 1");
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "Nick 2");

        // send message to occupant 1 with type groupchat
        Stanza errorStanza = sendMessage(OCCUPANT1_JID, new EntityImpl(ROOM1_JID, "Nick 2"), MessageStanzaType.GROUPCHAT, BODY);

        XMLElement expectedBody = new XMLElementBuilder("body").addText(BODY).build();
        assertMessageErrorStanza(errorStanza, ROOM1_JID, OCCUPANT1_JID, "modify",
                "bad-request", expectedBody);
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

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

        StanzaBuilder request = StanzaBuilder.createIQStanza(OCCUPANT1_JID, new EntityImpl(ROOM1_JID, "Nick 2"), IQStanzaType.GET, "123");
        request.startInnerElement("query", getNamespace()).endInnerElement();

        // send message to room
        sendDisco(request.build());
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        // do not send own presence
        if(existingOccupant.getJid().equals(newOccupant.getJid())) {
            return;
        }
       
        Entity roomAndOccupantNick = new EntityImpl(room.getJID(), existingOccupant.getName());
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndOccupantNick, newOccupant.getJid(), null, null, null, null);
       
        builder.addPreparedElement(new X(NamespaceURIs.XEP0045_MUC_USER,
                new Item(null, null, existingOccupant.getAffiliation(), existingOccupant.getRole())));
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        logger.debug("Room presence from {} sent to {}", newOccupant, roomAndOccupantNick);
        relayStanza(newOccupant.getJid(), builder.build(), serverRuntimeContext);
    }
   
    private void sendNewOccupantPresenceToExisting(Occupant newOccupant, Occupant existingOccupant, Room room, ServerRuntimeContext serverRuntimeContext) {
        Entity roomAndNewUserNick = new EntityImpl(room.getJID(), newOccupant.getName());
       
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndNewUserNick, existingOccupant.getJid(), null, null, null, null);
       
        List<XMLElement> inner = new ArrayList<XMLElement>();
View Full Code Here

Examples of org.apache.vysper.xmpp.addressing.EntityImpl

        logger.debug("Room presence from {} sent to {}", roomAndNewUserNick, existingOccupant);
        relayStanza(existingOccupant.getJid(), builder.build(), serverRuntimeContext);
    }

    private void sendChangeNickUnavailable(Occupant changer, String oldNick, Occupant receiver, Room room, ServerRuntimeContext serverRuntimeContext) {
        Entity roomAndOldNick = new EntityImpl(room.getJID(), oldNick);
       
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndOldNick, receiver.getJid(), null,
                PresenceStanzaType.UNAVAILABLE, null, null);
       
        List<XMLElement> inner = new ArrayList<XMLElement>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.