Package rocks.xmpp.core.stanza.model.client

Examples of rocks.xmpp.core.stanza.model.client.IQ


                "  <query xmlns='jabber:iq:oob' sid='a0'>\n" +
                "    <url>http://www.jabber.org/images/psa-license.jpg</url>\n" +
                "    <desc>A license to Jabber!</desc>\n" +
                "  </query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        OobIQ oobIQ = iq.getExtension(OobIQ.class);
        Assert.assertNotNull(oobIQ);
        Assert.assertEquals(oobIQ.getUrl(), new URL("http://www.jabber.org/images/psa-license.jpg"));
        Assert.assertEquals(oobIQ.getDescription(), "A license to Jabber!");
        Assert.assertEquals(oobIQ.getSessionId(), "a0");
    }
View Full Code Here


                "       type='error'>\n" +
                "     <error type='continue'>\n" +
                "       <unknown xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>\n" +
                "     </error>\n" +
                "   </iq>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.ERROR);
        Assert.assertNotNull(iq.getError());
        Assert.assertEquals(iq.getError().getType(), StanzaError.Type.CONTINUE);
        Assert.assertTrue(iq.getError().getCondition() instanceof UndefinedCondition);
    }
View Full Code Here

                "      </q:lodging>\n" +
                "    </env:Body>\n" +
                "  </env:Envelope>  \n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        Element element = iq.getExtension(Element.class);
        Assert.assertNotNull(element);

        MessageFactory messageFactory = null;

        if (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(element.getNamespaceURI())) {
View Full Code Here

                "      </x>\n" +
                "    </feature>\n" +
                "  </si>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        StreamInitiation streamInitiation = iq.getExtension(StreamInitiation.class);
        Assert.assertNotNull(streamInitiation);
        Assert.assertNotNull(streamInitiation.getFeatureNegotiation());
    }
View Full Code Here

    @Test
    public void marshalCondition() throws JAXBException, XMLStreamException {
        String xml = "<iq id=\"1\" type=\"error\"><error type=\"wait\"><unexpected-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></unexpected-request></error></iq>";
        StanzaError error = new StanzaError(new UnexpectedRequest());
        IQ iq = new IQ("1", AbstractIQ.Type.ERROR);
        iq.setError(error);
        Assert.assertEquals(marshal(iq), xml);
    }
View Full Code Here

        Assert.assertNotNull(streamInitiation.getFeatureNegotiation());
    }

    @Test
    public void marshalBadProfile() throws JAXBException, XMLStreamException {
        IQ result = new IQ("1", IQ.Type.ERROR);
        result.setError(new StanzaError(new BadRequest()));
        result.getError().setExtension(new BadProfile());
        String xml = marshal(result);
        Assert.assertEquals(xml, "<iq id=\"1\" type=\"error\"><error type=\"modify\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></bad-request><bad-profile xmlns=\"http://jabber.org/protocol/si\"></bad-profile></error></iq>");

    }
View Full Code Here

    }

    @Test
    public void marshalNoValidStreams() throws JAXBException, XMLStreamException {
        IQ result = new IQ("1", IQ.Type.ERROR);
        result.setError(new StanzaError(new BadRequest()));
        result.getError().setExtension(new NoValidStreams());
        String xml = marshal(result);
        Assert.assertEquals(xml, "<iq id=\"1\" type=\"error\"><error type=\"modify\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></bad-request><no-valid-streams xmlns=\"http://jabber.org/protocol/si\"></no-valid-streams></error></iq>");

    }
View Full Code Here

                "         <option><value>23:00</value></option>\n" +
                "      </field>\n" +
                "    </x>\n" +
                "  </feature>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        FeatureNegotiation featureNegotiation = iq.getExtension(FeatureNegotiation.class);
        Assert.assertNotNull(featureNegotiation);
        Assert.assertNotNull(featureNegotiation.getDataForm());
    }
View Full Code Here

        Assert.assertEquals(body.getCondition(), Body.Condition.UNDEFINED_CONDITION);
    }

    @Test
    public void marshalBodyWithMultipleStanzas() throws XMLStreamException, JAXBException {
        IQ iq = new IQ("1", IQ.Type.GET);
        iq.setExtension(new Roster());
        Body body = Body.builder()
                .wrappedObjects(Arrays.<Object>asList(iq, new Presence())).build();

        Assert.assertEquals(marshal(body), "<body xmlns=\"http://jabber.org/protocol/httpbind\"><iq xmlns=\"jabber:client\" id=\"1\" type=\"get\"><query xmlns=\"jabber:iq:roster\"></query></iq><presence xmlns=\"jabber:client\"></presence></body>");
    }
View Full Code Here

                "    <feature var='jabber:iq:time'/>\n" +
                "    <feature var='jabber:iq:version'/>\n" +
                "  </query>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        InfoDiscovery serviceDiscovery = iq.getExtension(InfoDiscovery.class);
        Assert.assertNotNull(serviceDiscovery);
        Assert.assertEquals(serviceDiscovery.getIdentities().size(), 2);
        Assert.assertEquals(serviceDiscovery.getFeatures().size(), 7);

        Identity identity1 = new Identity("conference", "text", "Play-Specific Chatrooms");
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.stanza.model.client.IQ

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.