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

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


        Assert.assertEquals(xml, "<presence><x xmlns=\"http://jabber.org/protocol/muc\"><history maxchars=\"65000\"></history></x></presence>");
    }

    @Test
    public void testEnterRoomWithHistoryMaxStanzas() throws JAXBException, XMLStreamException {
        Presence presence = new Presence();
        presence.getExtensions().add(new Muc(History.forMaxMessages(20)));
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence><x xmlns=\"http://jabber.org/protocol/muc\"><history maxstanzas=\"20\"></history></x></presence>");
    }
View Full Code Here


        Assert.assertEquals(xml, "<presence><x xmlns=\"http://jabber.org/protocol/muc\"><history maxstanzas=\"20\"></history></x></presence>");
    }

    @Test
    public void testEnterRoomWithHistorySeconds() throws JAXBException, XMLStreamException {
        Presence presence = new Presence();
        presence.getExtensions().add(new Muc(History.forSeconds(180)));
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence><x xmlns=\"http://jabber.org/protocol/muc\"><history seconds=\"180\"></history></x></presence>");
    }
View Full Code Here

                "  <show>dnd</show>\n" +
                "  <status>Wooing Juliet</status>\n" +
                "  <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>\n" +
                "  <priority>1</priority>\n" +
                "</presence>";
        Presence presence = unmarshal(xml, Presence.class);
        Assert.assertEquals(presence.getPriority(), 1);
    }
View Full Code Here

    @Test
    public void testEnterRoomWithHistorySince() throws JAXBException, XMLStreamException {
        Date date = new Date();
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        Presence presence = new Presence();
        presence.getExtensions().add(new Muc(History.since(date)));
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence><x xmlns=\"http://jabber.org/protocol/muc\"><history since=\"" + DatatypeConverter.printDateTime(calendar) + "\"></history></x></presence>");
    }
View Full Code Here

        Assert.assertEquals(presence.getPriority(), 1);
    }

    @Test
    public void marshalPresenceMultipleStatus() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.SUBSCRIBE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.getStatuses().add(new Presence.Status("status", "de"));
        Presence.Status status = new Presence.Status("status2");
        status.setLanguage("en");
        presence.getStatuses().add(status);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"subscribe\"><status xml:lang=\"de\">status</status><status xml:lang=\"en\">status2</status></presence>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"subscribe\"><status xml:lang=\"de\">status</status><status xml:lang=\"en\">status2</status></presence>");
    }

    @Test
    public void marshalPresenceShowDnd() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.SUBSCRIBED);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.DND);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"subscribed\"><show>dnd</show></presence>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"subscribed\"><show>dnd</show></presence>");
    }

    @Test
    public void marshalPresenceShowAway() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNSUBSCRIBE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.AWAY);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribe\"><show>away</show></presence>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribe\"><show>away</show></presence>");
    }

    @Test
    public void marshalPresenceShowXA() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNSUBSCRIBED);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.XA);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribed\"><show>xa</show></presence>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unsubscribed\"><show>xa</show></presence>");
    }

    @Test
    public void marshalPresenceShowChat() throws JAXBException, XMLStreamException {
        Presence presence = new Presence(Presence.Type.UNAVAILABLE);
        presence.setId("id");
        presence.setTo(new Jid("to", "domain"));
        presence.setFrom(new Jid("from", "domain"));
        presence.setShow(Presence.Show.CHAT);
        String xml = marshal(presence);
        Assert.assertEquals(xml, "<presence from=\"from@domain\" id=\"id\" to=\"to@domain\" type=\"unavailable\"><show>chat</show></presence>");
    }
View Full Code Here

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

    @Test
    public void testIsAvailable() throws JAXBException, XMLStreamException {
        Presence presence1 = new Presence();
        Assert.assertTrue(presence1.isAvailable());

        Presence presence2 = new Presence(Presence.Type.SUBSCRIBE);
        Assert.assertFalse(presence2.isAvailable());

        Presence presence3 = new Presence(Presence.Type.UNSUBSCRIBED);
        Assert.assertFalse(presence3.isAvailable());

        Presence presence4 = new Presence(Presence.Type.UNSUBSCRIBE);
        Assert.assertFalse(presence4.isAvailable());

        Presence presence5 = new Presence(Presence.Type.SUBSCRIBED);
        Assert.assertFalse(presence5.isAvailable());

        Presence presence6 = new Presence(Presence.Type.ERROR);
        Assert.assertFalse(presence6.isAvailable());

        Presence presence7 = new Presence(Presence.Type.PROBE);
        Assert.assertFalse(presence7.isAvailable());

        Presence presence8 = new Presence(Presence.Type.UNAVAILABLE);
        Assert.assertFalse(presence8.isAvailable());
    }
View Full Code Here

TOP

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

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.