Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.StanzaBuilder.startInnerElement()


    private static Entity JID = TestUtil.parseUnchecked("jid1@vysper.org");

    public void testFromStanza() {
        StanzaBuilder builder = StanzaBuilder.createMessageStanza(JID, JID, null, "Foo");
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.startInnerElement("password").addText("secret").endInnerElement();
        builder.endInnerElement();
       
        X x = X.fromStanza(builder.build());
       
View Full Code Here


    private static Entity JID = TestUtil.parseUnchecked("jid1@vysper.org");

    public void testFromStanza() {
        StanzaBuilder builder = StanzaBuilder.createMessageStanza(JID, JID, null, "Foo");
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.startInnerElement("password").addText("secret").endInnerElement();
        builder.endInnerElement();
       
        X x = X.fromStanza(builder.build());
       
        assertNotNull(x);
View Full Code Here

    protected Stanza sendMessage(Entity from, Entity to, MessageStanzaType type,
            String body, X x, String subject) throws ProtocolException {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createMessageStanza(from,
                to, type, null, body);
        if(subject != null) {
            stanzaBuilder.startInnerElement("subject").addText(subject).endInnerElement();
        }
        if(x != null) {
            stanzaBuilder.addPreparedElement(x);
        }
View Full Code Here

*/
public class MUCPresenceHandlerChangeNickTestCase extends AbstractMUCHandlerTestCase {

    private Stanza changeNick(Entity occupantJid, Entity roomWithNickJid) throws ProtocolException {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createPresenceStanza(occupantJid, roomWithNickJid, null, null, null, null);
        stanzaBuilder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
       
        stanzaBuilder.endInnerElement();
        Stanza presenceStanza = stanzaBuilder.build();
        ResponseStanzaContainer container = handler.execute(presenceStanza, sessionContext.getServerRuntimeContext(), true, sessionContext, null);
        if(container != null) {
View Full Code Here

        */

        if (languageCode == null) languageCode = "en_US";
        StanzaBuilder stanzaBuilder = new StanzaBuilder("error");

        stanzaBuilder.startInnerElement(definedErrorCondition.value())
            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STREAMS)
            .endInnerElement();

        if (descriptiveText != null) {
            stanzaBuilder.startInnerElement("text")
View Full Code Here

        stanzaBuilder.startInnerElement(definedErrorCondition.value())
            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STREAMS)
            .endInnerElement();

        if (descriptiveText != null) {
            stanzaBuilder.startInnerElement("text")
                .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STREAMS)
                .addAttribute(NamespaceURIs.XML, "lang", languageCode)
                .addText(descriptiveText)
                .endInnerElement();
        }
View Full Code Here

        presenceHandler = new MUCPresenceHandler(conference);
    }

    public void testVerifyNonPresence() {
        StanzaBuilder builder = StanzaBuilder.createMessageStanza(FROM, TO, "en", "foo");
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.endInnerElement();
       
        assertFalse(presenceHandler.verify(builder.build()));
    }
View Full Code Here

    }

    public Stanza getSASLFailure(SASLFailureType failureType) {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("failure", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
        if (failureType != null) {
            stanzaBuilder.startInnerElement(failureType.toString()).endInnerElement();
        }
        return stanzaBuilder.build();
    }
}
View Full Code Here

    }


    public void testVerifyWithMUCNamespace() {
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(FROM, TO, null, null, null, null);
        builder.startInnerElement("x", NamespaceURIs.XEP0045_MUC);
        builder.endInnerElement();
       
        assertTrue(presenceHandler.verify(builder.build()));
    }
View Full Code Here

        assertTrue(presenceHandler.verify(builder.build()));
    }

    public void testVerifyWithNonMUCNamespace() {
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(FROM, TO, null, null, null, null);
        builder.startInnerElement("x", "foo");
        builder.endInnerElement();
       
        assertFalse(presenceHandler.verify(builder.build()));
    }
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.