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

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


        Assert.assertEquals(message.getParentThread(), "e0ffe42b28561960c6b12b944a092794b9683a38");
    }

    @Test
    public void marshalChatMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(Jid.valueOf("juliet@example.com"), Message.Type.CHAT);
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"chat\"></message>");
    }
View Full Code Here


        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"chat\"></message>");
    }

    @Test
    public void marshalGroupChatMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(Jid.valueOf("juliet@example.com"), Message.Type.GROUPCHAT);
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"groupchat\"></message>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"groupchat\"></message>");
    }

    @Test
    public void marshalNormalMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(Jid.valueOf("juliet@example.com"), Message.Type.NORMAL);
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"normal\"></message>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"normal\"></message>");
    }

    @Test
    public void marshalHeadlineMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(Jid.valueOf("juliet@example.com"), Message.Type.HEADLINE);
        String xml = marshal(message);
        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"headline\"></message>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<message to=\"juliet@example.com\" type=\"headline\"></message>");
    }

    @Test
    public void marshalErrorMessage() throws JAXBException, XMLStreamException {
        Message message = new Message(Jid.valueOf("juliet@example.com"), Message.Type.ERROR);
        message.setBody("test");
        message.setError(new StanzaError(new Conflict()));
        String xml = marshal(message);
        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>");
    }
View Full Code Here

        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);
        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>");
    }
View Full Code Here

TOP

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

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.