Package org.apache.vysper.xmpp.delivery.RecordingStanzaRelay

Examples of org.apache.vysper.xmpp.delivery.RecordingStanzaRelay.Triple


        Stanza stanza = XMPPCoreStanza.getWrapper(StanzaBuilder.createMessageStanza(FROM, TO, LANG, BODY).build());
       
        strategy.process(stanza, Arrays.asList((DeliveryException)new RemoteServerNotFoundException(ERROR_TEXT)));
       
        Iterator<Triple> triples = relay.iterator();
        Triple triple = triples.next();
        Assert.assertEquals(FROM, triple.getEntity());
        MessageStanza errorStanza = (MessageStanza) XMPPCoreStanza.getWrapper(triple.getStanza());
        Assert.assertEquals("error", errorStanza.getType());
        Assert.assertEquals(FROM, errorStanza.getTo());
        Assert.assertEquals(SERVER, errorStanza.getFrom());
       
        XMLElement errorElm = errorStanza.getSingleInnerElementsNamed("error", NamespaceURIs.JABBER_CLIENT);
        Assert.assertEquals("cancel", errorElm.getAttributeValue("type"));

        Assert.assertNotNull(errorElm.getSingleInnerElementsNamed("remote-server-not-found", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS));

        XMLElement textElm = errorElm.getSingleInnerElementsNamed("text", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS);
        Assert.assertEquals(ERROR_TEXT, textElm.getInnerText().getText());
       
        Assert.assertEquals(IgnoreFailureStrategy.IGNORE_FAILURE_STRATEGY, triple.getDeliveryFailureStrategy());
       
        Assert.assertFalse(triples.hasNext());
    }
View Full Code Here


        Stanza stanza = XMPPCoreStanza.getWrapper(StanzaBuilder.createMessageStanza(FROM, TO, LANG, BODY).build());
       
        strategy.process(stanza, null);
       
        Iterator<Triple> triples = relay.iterator();
        Triple triple = triples.next();
        Assert.assertEquals(FROM, triple.getEntity());
        MessageStanza errorStanza = (MessageStanza) XMPPCoreStanza.getWrapper(triple.getStanza());
        Assert.assertEquals("error", errorStanza.getType());
        Assert.assertEquals(FROM, errorStanza.getTo());
        Assert.assertEquals(SERVER, errorStanza.getFrom());
       
        XMLElement errorElm = errorStanza.getSingleInnerElementsNamed("error", NamespaceURIs.JABBER_CLIENT);
        Assert.assertEquals("cancel", errorElm.getAttributeValue("type"));
        Assert.assertNotNull(errorElm.getSingleInnerElementsNamed("service-unavailable", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS));

        Assert.assertNotNull(errorElm.getSingleInnerElementsNamed("text", NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS));
       
        Assert.assertEquals(IgnoreFailureStrategy.IGNORE_FAILURE_STRATEGY, triple.getDeliveryFailureStrategy());
       
        Assert.assertFalse(triples.hasNext());
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.delivery.RecordingStanzaRelay.Triple

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.