Package org.apache.vysper.xmpp.protocol

Examples of org.apache.vysper.xmpp.protocol.ResponseStanzaContainer


    public void testRetrieveAffiliationsNoAuth() {
        Entity client2 = new EntityImpl("yoda", "starwars.com", null);

        AbstractStanzaGenerator sg = new DefaultRetrieveAffiliationsStanzaGenerator("Node1");
        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
View Full Code Here


        String testNode = "test";
        assertNull(root.find(testNode));

        AbstractStanzaGenerator sg = new DefaultRetrieveAffiliationsStanzaGenerator("test");
        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
View Full Code Here

    }

    public void testNoSubscriptions() {
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", null);
        ResponseStanzaContainer result = sendStanza(stanza, true);
       
        assertTrue(result.hasResponse());
       
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());
        XMLElement sub = response.getFirstInnerElement().getFirstInnerElement();
        assertEquals("subscriptions", sub.getName());
        assertEquals(0, sub.getInnerElements().size()); // there should be no subscriptions
    }
View Full Code Here

    public void testRetrieveAffiliations() {
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();

        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());
        XMLElement sub = response.getFirstInnerElement().getFirstInnerElement();
        assertEquals("affiliations", sub.getName());
        assertEquals(3, sub.getInnerElements().size());
View Full Code Here

        n1.subscribe("id124", client);
        n2.subscribe("id125", client);
        n3.subscribe("id126", client);
       
        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());
        XMLElement sub = response.getFirstInnerElement().getFirstInnerElement();
        assertEquals("subscriptions", sub.getName());
        assertEquals(4, sub.getInnerElements().size());
    }
View Full Code Here

        n1.subscribe("id124", client);
        n2.subscribe("id125", client);
        n3.subscribe("id126", client);
       
        Stanza stanza = sg.getStanza(client, pubsubService, "4711", "Node1");
        ResponseStanzaContainer result = sendStanza(stanza, true);
       
        assertTrue(result.hasResponse());
       
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());
        XMLElement sub = response.getFirstInnerElement().getFirstInnerElement();
        assertEquals("subscriptions", sub.getName());
        assertEquals(2, sub.getInnerElements().size());
    }
View Full Code Here

    public void testModifyAffiliationsNoAuth() {
        Entity client2 = new EntityImpl("yoda", "starwars.com", null);

        AbstractStanzaGenerator sg = new DefaultModifyAffiliationsStanzaGenerator("Node1", client, PubSubAffiliation.MEMBER);
        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
View Full Code Here

        String testNode = "test";
        assertNull(root.find(testNode));

        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
View Full Code Here

        assertEquals(PubSubAffiliation.NONE, n1.getAffiliation(client3));

        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();

        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));
View Full Code Here

        assertEquals(PubSubAffiliation.NONE, n1.getAffiliation(client3));

        DefaultModifyAffiliationsStanzaGenerator sg = new DefaultModifyAffiliationsStanzaGenerator(n1.getName(), client2, PubSubAffiliation.NONE);

        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));
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.protocol.ResponseStanzaContainer

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.