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

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


                        }
                    }

                    for (StanzaEntry entry : stanzaTableView.getItems()) {
                        if (newValue.getStanza() instanceof IQ && entry.getStanza() instanceof IQ) {
                            IQ selectedIQ = (IQ) newValue.getStanza();
                            IQ otherIQ = (IQ) entry.getStanza();
                            if (otherIQ.getId() != null && otherIQ.getId().equals(selectedIQ.getId())
                                    && ((selectedIQ.isRequest() && otherIQ.isResponse())
                                    || selectedIQ.isResponse() && otherIQ.isRequest())) {
                                // Add the highlighted items.
                                viewModel.highlightedItems.add(entry);
                            }
                        }
                    }
View Full Code Here


    @BeforeClass
    public void prepareRoster() throws Exception {
        Roster roster = new Roster();
        roster.getContacts().add(new Contact(Jid.valueOf("juliet@example.net"), "juliet", "friends", "friends2"));
        roster.getContacts().add(new Contact(Jid.valueOf("romeo@example.net"), "romeo", "friends"));
        IQ iq = new IQ(AbstractIQ.Type.SET, roster);
        // Simulate a roster push in order to fill the roster.
        xmppSession.handleElement(iq);
    }
View Full Code Here

    @Test
    public void unmarshalIQ() throws JAXBException, XMLStreamException {
        String xml = "<iq from='juliet@example.com/balcony'\n" +
                "       id='b4vs9km4'\n" +
                "       to='romeo@example.net' type='error'/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.ERROR);
        Assert.assertEquals(iq.getId(), "b4vs9km4");
        Assert.assertEquals(iq.getTo().toString(), "romeo@example.net");
        Assert.assertEquals(iq.getFrom().toString(), "juliet@example.com/balcony");
    }
View Full Code Here

    }

    @Test
    public void unmarshalResultIQ() throws XMLStreamException, JAXBException {
        String xml = "<iq type=\"result\"/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.RESULT);
    }
View Full Code Here

    }

    @Test
    public void unmarshalGetIQ() throws XMLStreamException, JAXBException {
        String xml = "<iq type=\"get\"/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.GET);
    }
View Full Code Here

        Roster roster = new Roster();
        List<Contact> contacts = new ArrayList<>();
        contacts.add(new Contact(new Jid("domain")));
        roster.getContacts().addAll(contacts);
        IQ iq = new IQ("1", IQ.Type.GET, roster);

        marshaller.marshal(iq, prefixFreeWriter);
        Assert.assertEquals("<iq id=\"1\" type=\"get\"><query xmlns=\"jabber:iq:roster\"><item jid=\"domain\"></item></query></iq>", writer.toString());
    }
View Full Code Here

    }

    @Test
    public void unmarshalSetIQ() throws XMLStreamException, JAXBException {
        String xml = "<iq type=\"set\"/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.SET);
    }
View Full Code Here

    }

    @Test
    public void unmarshalErrorIQ() throws XMLStreamException, JAXBException {
        String xml = "<iq type=\"error\"/>";
        IQ iq = unmarshal(xml, IQ.class);
        Assert.assertEquals(iq.getType(), IQ.Type.ERROR);
    }
View Full Code Here

        Assert.assertEquals(iq.getType(), IQ.Type.ERROR);
    }

    @Test
    public void marshalIQ() throws JAXBException, XMLStreamException {
        IQ iq = new IQ(IQ.Type.GET);
        iq.setId("id");
        iq.setTo(new Jid("to", "domain"));
        iq.setFrom(new Jid("from", "domain"));
        String xml = marshal(iq);
        Assert.assertEquals(xml, "<iq from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"get\"></iq>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<iq from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"get\"></iq>");
    }

    @Test
    public void marshalIQWithError() throws JAXBException, XMLStreamException {
        IQ iq = new IQ(IQ.Type.GET);
        iq.setId("id");
        iq.setTo(new Jid("to", "domain"));
        iq.setFrom(new Jid("from", "domain"));
        iq.setError(new StanzaError(StanzaError.Type.MODIFY, new ServiceUnavailable()));
        String xml = marshal(iq);
        Assert.assertEquals(xml, "<iq from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"get\"><error type=\"modify\"><service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></service-unavailable></error></iq>");
    }
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.