Package rocks.xmpp.core

Examples of rocks.xmpp.core.Jid


        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"error\"><body>test</body><error type=\"cancel\"><conflict xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></conflict></error></message>");
    }

    @Test
    public void marshalMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"></message>");
    }
View Full Code Here


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

    @Test
    public void marshalMessageThread() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        message.setThread("thread");
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><thread>thread</thread></message>");
    }
View Full Code Here

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

    @Test
    public void marshalMessageParentThread() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        message.setThread("thread");
        message.setParentThread("parentThread");
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><thread parent=\"parentThread\">thread</thread></message>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><thread parent=\"parentThread\">thread</thread></message>");
    }

    @Test
    public void marshalMessageParentThreadWithoutThread() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        message.setParentThread("parentThread");
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><thread parent=\"parentThread\"></thread></message>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><thread parent=\"parentThread\"></thread></message>");
    }

    @Test
    public void marshalMessageBody() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        message.getBodies().add(new AbstractMessage.Body("body", "de"));
        AbstractMessage.Body body2 = new AbstractMessage.Body("body2");
        body2.setLanguage("fr");
        message.getBodies().add(body2);
        String xml = marshal(message);
View Full Code Here

        Assert.assertEquals(xml, "<message from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"chat\"><body xml:lang=\"de\">body</body><body xml:lang=\"fr\">body2</body></message>");
    }

    @Test
    public void marshalMessageSubject() throws JAXBException, XMLStreamException {
        Message message = new Message(new Jid("to", "domain"), Message.Type.CHAT);
        message.setId("id");
        message.setFrom(new Jid("from", "domain"));
        message.getSubjects().add(new AbstractMessage.Subject("subject1", "de"));
        AbstractMessage.Subject subject2 = new AbstractMessage.Subject("subject2");
        subject2.setLanguage("fr");
        message.getSubjects().add(subject2);
        String xml = marshal(message);
View Full Code Here

    @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

    @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

    @Test
    public void testErrorIQ() 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 error = iq.createError(new StanzaError(new UndefinedCondition()));
        Assert.assertEquals(error.getType(), IQ.Type.ERROR);
        Assert.assertEquals(error.getId(), iq.getId());
        Assert.assertEquals(error.getTo(), iq.getFrom());
        Assert.assertEquals(error.getFrom(), iq.getTo());
View Full Code Here

    @Test
    public void testResultIQ() 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 result = iq.createResult();
        Assert.assertEquals(result.getType(), IQ.Type.RESULT);
        Assert.assertEquals(result.getId(), iq.getId());
        Assert.assertEquals(result.getTo(), iq.getFrom());
        Assert.assertEquals(result.getFrom(), iq.getTo());
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.Jid

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.