use of org.jivesoftware.smackx.last_interaction.element.IdleElement in project Smack by igniterealtime.
the class IdleTest method helperTest.
@Test
public void helperTest() {
Presence presence = StanzaBuilder.buildPresence().ofType(Presence.Type.available).build();
IdleElement.addToPresence(presence);
IdleElement element = IdleElement.fromPresence(presence);
assertNotNull(element);
}
use of org.jivesoftware.smackx.last_interaction.element.IdleElement in project Smack by igniterealtime.
the class IdleTest method providerTest.
@Test
public void providerTest() throws Exception {
String xml = "<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15Z' />";
XmlPullParser parser = TestUtils.getParser(xml);
assertNotNull(parser);
IdleElement parsed = IdleProvider.TEST_INSTANCE.parse(parser);
Date date = XmppDateTime.parseXEP0082Date("1969-07-21T02:56:15Z");
assertEquals(date, parsed.getSince());
IdleElement element = new IdleElement(date);
assertXmlSimilar("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15.000+00:00'/>", element.toXML().toString());
}
use of org.jivesoftware.smackx.last_interaction.element.IdleElement in project Smack by igniterealtime.
the class IdleProvider method parse.
@Override
public IdleElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws ParseException {
String dateString = parser.getAttributeValue(null, IdleElement.ATTR_SINCE);
Date since = XmppDateTime.parseXEP0082Date(dateString);
return new IdleElement(since);
}
Aggregations