Search in sources :

Example 1 with CarbonManagerProvider

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());
}
Also used : CarbonManagerProvider(org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider) CarbonExtension(org.jivesoftware.smackx.carbons.packet.CarbonExtension) XmlPullParser(org.xmlpull.v1.XmlPullParser) ExperimentalInitializerTest(org.jivesoftware.smackx.ExperimentalInitializerTest) Test(org.junit.Test)

Example 2 with CarbonManagerProvider

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);
}
Also used : CarbonManagerProvider(org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider) XmlPullParser(org.xmlpull.v1.XmlPullParser) ExperimentalInitializerTest(org.jivesoftware.smackx.ExperimentalInitializerTest) Test(org.junit.Test)

Example 3 with CarbonManagerProvider

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());
}
Also used : CarbonManagerProvider(org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider) CarbonExtension(org.jivesoftware.smackx.carbons.packet.CarbonExtension) XmlPullParser(org.xmlpull.v1.XmlPullParser) Forwarded(org.jivesoftware.smackx.forward.packet.Forwarded) ExperimentalInitializerTest(org.jivesoftware.smackx.ExperimentalInitializerTest) Test(org.junit.Test)

Aggregations

ExperimentalInitializerTest (org.jivesoftware.smackx.ExperimentalInitializerTest)3 CarbonManagerProvider (org.jivesoftware.smackx.carbons.provider.CarbonManagerProvider)3 Test (org.junit.Test)3 XmlPullParser (org.xmlpull.v1.XmlPullParser)3 CarbonExtension (org.jivesoftware.smackx.carbons.packet.CarbonExtension)2 Forwarded (org.jivesoftware.smackx.forward.packet.Forwarded)1