use of org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider in project Smack by igniterealtime.
the class CarbonTest method carbonReceivedTest.
@Test
public void carbonReceivedTest() throws Exception {
XmlPullParser parser;
String control;
CarbonExtension cc;
control = XMLBuilder.create("received").e("forwarded").a("xmlns", "urn:xmpp:forwarded:0").e("message").a("from", "romeo@montague.com").asString(outputProperties);
parser = PacketParserUtils.getParserFor(control);
cc = new CarbonManagerProvider().parse(parser);
assertEquals(CarbonExtension.Direction.received, cc.getDirection());
// check end of tag
assertEquals(XmlPullParser.END_TAG, parser.getEventType());
assertEquals("received", parser.getName());
}
use of org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider in project Smack by igniterealtime.
the class CarbonTest method carbonEmptyTest.
@Test(expected = Exception.class)
public void carbonEmptyTest() throws Exception {
XmlPullParser parser;
String control;
control = XMLBuilder.create("sent").a("xmlns", "urn:xmpp:forwarded:0").asString(outputProperties);
parser = PacketParserUtils.getParserFor(control);
new CarbonManagerProvider().parse(parser);
}
use of org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider in project Smack by igniterealtime.
the class CarbonTest method carbonSentTest.
@Test
public void carbonSentTest() throws Exception {
XmlPullParser parser;
String control;
CarbonExtension cc;
Forwarded fwd;
control = XMLBuilder.create("sent").e("forwarded").a("xmlns", "urn:xmpp:forwarded:0").e("message").a("from", "romeo@montague.com").asString(outputProperties);
parser = PacketParserUtils.getParserFor(control);
cc = new CarbonManagerProvider().parse(parser);
fwd = cc.getForwarded();
// meta
assertEquals(CarbonExtension.Direction.sent, cc.getDirection());
// no delay in packet
assertEquals(null, fwd.getDelayInformation());
// check message
assertThat("romeo@montague.com", equalsCharSequence(fwd.getForwardedStanza().getFrom()));
// check end of tag
assertEquals(XmlPullParser.END_TAG, parser.getEventType());
assertEquals("sent", parser.getName());
}
Aggregations