Examples of Stanza


Examples of org.apache.vysper.xmpp.stanza.Stanza

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

        // send message to room
        Stanza error = sendMessage(OCCUPANT1_JID, ROOM2_JID, GROUPCHAT, null, null, SUBJECT);

        assertMessageErrorStanza(error, ROOM2_JID, OCCUPANT1_JID, "auth", "forbidden",
                new XMLElementBuilder("subject").addText(SUBJECT).build());
       
        assertNull(occupant1Queue.getNext());
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

        if (!"stream".equals(name)) {
            if (!fillDeep(startElementEvent.element.rawname, xmlFragments)) throw new ParsingException("XML end element not found as expected");
        }

        return new Stanza(null, name, null, stanzaAttributes, xmlFragments);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

        return handler.execute(toSend, sessionContext.getServerRuntimeContext(), isOutboundStanza, sessionContext, null);
    }

    public void testSimpleStanza() {
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id1", "sometestnode");

        assertTrue(handler.verify(stanza));
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

    public Stanza getStreamOpenerForError(boolean forClient, Entity from, XMPPVersion version, Stanza errorStanza) {
        return getStreamOpener(forClient, from, null, version, errorStanza).build();
    }

    public Stanza getStreamOpener(boolean forClient, Entity from, XMPPVersion version, SessionContext sessionContext) {
        Stanza innerFeatureStanza;
        if (sessionContext.getState() == SessionState.INITIATED) innerFeatureStanza = getFeaturesForEncryption(sessionContext);
        else if (sessionContext.getState() == SessionState.ENCRYPTED) innerFeatureStanza = getFeaturesForAuthentication(sessionContext.getServerRuntimeContext().getServerFeatures().getAuthenticationMethods());
        else if (sessionContext.getState() == SessionState.AUTHENTICATED) {
            sessionContext.setIsReopeningXMLStream();
            innerFeatureStanza = getFeaturesForSession();
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

        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.stanza.Stanza

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

        Decline decline = new Decline(null, OCCUPANT2_JID, reason);
        // send message to occupant 1
        Stanza error = sendMessage(OCCUPANT1_JID, ROOM1_JID, null, null, new X(decline), null);
        assertNull(error);

        X expectedX = new X(new Decline(OCCUPANT1_JID, null, reason));
        // verify stanzas to existing occupants on the exiting user
        assertMessageStanza(ROOM1_JID, OCCUPANT2_JID, null, null, null, expectedX,
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

            if(history != null) {
              xInnerElms.add(history);
            }
            stanzaBuilder.addPreparedElement(new X(xInnerElms));
        }
        Stanza presenceStanza = stanzaBuilder.build();
        ResponseStanzaContainer container = handler.execute(presenceStanza, userSessionContext.getServerRuntimeContext(), true, userSessionContext, null);
        if(container != null) {
            return container.getResponseStanza();
        } else {
            return null;
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

    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, "auth", "forbidden");

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

Examples of org.apache.vysper.xmpp.stanza.Stanza

    }

    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, "auth", "registration-required");

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

Examples of org.apache.vysper.xmpp.stanza.Stanza

        assertEquals(0, room.getOccupants().size());
    }
   
    public void testEnterRoomWithDuplicateNick() throws Exception {
        assertNull(enterRoom(OCCUPANT1_JID, ROOM1_JID_WITH_NICK));
        Stanza error = enterRoom(OCCUPANT2_JID, ROOM1_JID_WITH_NICK);
       
        assertNotNull(error);
    }
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.