Package org.apache.vysper.xmpp.stanza

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


        stanzaBuilder.startInnerElement("getRequest", NamespaceURIs.JABBER_CLIENT).endInnerElement();

        TestIQHandler iqHandler = new TestIQHandler();
        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.build(), sessionContext
                .getServerRuntimeContext(), true, sessionContext, null);
        IQStanza incomingStanza = iqHandler.getIncomingStanza();

        XMPPCoreStanzaVerifier verifier = incomingStanza.getCoreVerifier();
        assertTrue("iq", verifier.nameEquals("iq"));
        assertTrue("iq-id", verifier.attributeEquals("id", "1"));
        assertTrue("iq-type-get", verifier.attributeEquals("type", "get"));

        // response is "result"
View Full Code Here


    }

    private void assertUnknownSenderError(Stanza recordedResponse) throws XMLSemanticError {
        XMLElementVerifier verifier = recordedResponse.getVerifier();
        assertEquals("iq stanza error", "iq", recordedResponse.getName());
        IQStanza iqStanza = (IQStanza) XMPPCoreStanza.getWrapper(recordedResponse);
        assertEquals("error", iqStanza.getType());
        assertTrue("error embedded", verifier.subElementPresent("error"));
        XMLElement errorInner = recordedResponse.getSingleInnerElementsNamed("error");
        assertEquals("modify", errorInner.getAttributeValue("type"));
        XMLElementVerifier errorVerifier = errorInner.getVerifier();
        errorVerifier.subElementPresent("unknown-sender");
View Full Code Here

            return "*render-exception*";
        }
    }

    private static void renderIQ(StringBuilder stringBuilder, XMLElement stanza, XMLElement firstInnerElement) {
        IQStanza iq = (IQStanza) XMPPCoreStanza.getWrapper((Stanza) stanza);
        renderAttribute(stringBuilder, iq, "id");
        renderAttribute(stringBuilder, iq, "to");
        renderAttribute(stringBuilder, iq, "from");
        renderAttribute(stringBuilder, iq, "type");
        if (firstInnerElement != null) {
View Full Code Here

        Stanza stanza = sg.getStanza(client2, pubsubService, "id123", null);
        ResponseStanzaContainer result = sendStanza(stanza, true);

        assertTrue(result.hasResponse());

        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        XMLElement error = response.getInnerElementsNamed("error").get(0); //jump directly to the error part
        assertEquals("error", error.getName());
        assertEquals("auth", error.getAttributeValue("type"));

        List<XMLElement> errorContent = error.getInnerElements();
        assertEquals(1, errorContent.size());
View Full Code Here

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123");

        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());

        assertEquals(IQStanzaType.RESULT.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        // get the query Element
        XMLElement query = response.getFirstInnerElement();
        List<XMLElement> inner = query.getInnerElements();

        assertEquals("query", query.getName());

        // since we have no nodes, there should be no items.
View Full Code Here

        AbstractStanzaGenerator sg = new DefaultModifyAffiliationsStanzaGenerator("test", client,
                PubSubAffiliation.MEMBER);
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        XMLElement error = response.getInnerElementsNamed("error").get(0); //jump directly to the error part
        assertEquals("error", error.getName());
        assertEquals("cancel", error.getAttributeValue("type"));

        List<XMLElement> errorContent = error.getInnerElements();
        assertEquals(1, errorContent.size());
View Full Code Here

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123");

        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());

        assertEquals(IQStanzaType.RESULT.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        // get the query Element
        XMLElement query = response.getFirstInnerElement();
        List<XMLElement> inner = query.getInnerElements();

        assertEquals("query", query.getName());

        // since we have no nodes, there should be no items.
View Full Code Here

        Stanza stanza = sg.getStanza(client, pubsubService, "4711", null);
        ResponseStanzaContainer result = sendStanza(stanza, true);

        assertTrue(result.hasResponse());

        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(), response.getType());
        assertEquals("4711", response.getAttributeValue("id")); // IDs must match

        assertEquals(PubSubAffiliation.OWNER, n1.getAffiliation(client));
        assertEquals(PubSubAffiliation.MEMBER, n1.getAffiliation(client2));
        assertEquals(PubSubAffiliation.PUBLISHER, n1.getAffiliation(client3));
    }
View Full Code Here

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123", "news");

        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());

        assertEquals(IQStanzaType.RESULT.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        // get the query Element
        XMLElement query = response.getFirstInnerElement();
        List<XMLElement> inner = query.getInnerElements();

        assertEquals("query", query.getName());
        assertEquals("news", query.getAttributeValue("node"));
View Full Code Here

        Stanza stanza = sg.getStanza(client, pubsubService, "4711", null);
        ResponseStanzaContainer result = sendStanza(stanza, true);

        assertTrue(result.hasResponse());

        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(), response.getType());
        assertEquals("4711", response.getAttributeValue("id")); // IDs must match

        assertEquals(PubSubAffiliation.OWNER, n1.getAffiliation(client));
        assertEquals(PubSubAffiliation.NONE, n1.getAffiliation(client2));
        assertEquals(PubSubAffiliation.NONE, n1.getAffiliation(client3));
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.stanza.IQStanza

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.