Examples of IQStanza


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

        DefaultUnsubscribeStanzaGenerator sg = new DefaultUnsubscribeStanzaGenerator();

        assertFalse(node.isSubscribed(client));
        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubService, "id123", "news"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
        assertFalse(node.isSubscribed(client));
        assertEquals(0, node.countSubscriptions(client));

        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(2, errorContent.size());
View Full Code Here

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

        node.subscribe("subid1", EntityImpl.parse(yoda));

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubService, "id123", "news"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
        assertFalse(node.isSubscribed(client));
        assertEquals(0, node.countSubscriptions(client));

        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

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

        DefaultUnsubscribeStanzaGenerator sg = new DefaultUnsubscribeStanzaGenerator();
        Entity pubsubWrongNode = new EntityImpl(null, "pubsub.vysper.org", null);

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubWrongNode, "id123", "doesnotexsist"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
        assertFalse(node.isSubscribed(client));

        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

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

        node.subscribe("subid1", client);
        node.subscribe("subid2", client);

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubService, "id123", "news"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
        assertTrue(node.isSubscribed(client));
        assertEquals(2, node.countSubscriptions(client)); // still 2 subscriptions

        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("modify", error.getAttributeValue("type"));

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

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

        DefaultUnsubscribeStanzaGenerator sg = new DefaultUnsubscribeStanzaGenerator();
        sg.overrideSubscriberJID("@@");

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubService, "id123", "news"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
        assertFalse(node.isSubscribed(client));

        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("modify", error.getAttributeValue("type"));

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

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

    }

    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

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

        stanzaBuilder.addAttribute("type", "get");
        stanzaBuilder.startInnerElement("getRequest").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

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

        DiscoInfoIQHandler infoIQHandler = new DiscoInfoIQHandler();

        StanzaBuilder request = StanzaBuilder.createIQStanza(EntityImpl.parse("user@vysper.org"), EntityImpl.parse("info@vysper.org"), IQStanzaType.GET, "1");

        IQStanza finalStanza = (IQStanza)XMPPCoreStanza.getWrapper(request.build());
       
        Stanza resultStanza = infoIQHandler.handleGet(finalStanza, runtimeContext, new TestSessionContext(runtimeContext, new SessionStateHolder()));

        assertTrue(resultStanza.getVerifier().onlySubelementEquals("query", NamespaceURIs.XEP0030_SERVICE_DISCOVERY_INFO));
        XMLElement queryElement = resultStanza.getFirstInnerElement();
View Full Code Here

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

        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

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

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