Search in sources :

Example 6 with Message

use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.

the class ChatConnectionTest method validateMessageTypeWithDefaults2.

@Test
public void validateMessageTypeWithDefaults2() {
    Message incomingChat = createChatPacket("134", true);
    incomingChat.setType(Type.normal);
    processServerMessage(incomingChat);
    assertNotNull(listener.getNewChat());
}
Also used : Message(org.jivesoftware.smack.packet.Message) Test(org.junit.Test)

Example 7 with Message

use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.

the class ChatConnectionTest method validateMessageTypeWithNoNormal2.

@Test
public void validateMessageTypeWithNoNormal2() {
    cm.setNormalIncluded(false);
    Message incomingChat = createChatPacket("134", true);
    incomingChat.setType(Type.normal);
    processServerMessage(incomingChat);
    assertNull(listener.getNewChat());
}
Also used : Message(org.jivesoftware.smack.packet.Message) Test(org.junit.Test)

Example 8 with Message

use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.

the class ChatConnectionTest method chatNotMatchedWithTypeNormal.

@Test
public void chatNotMatchedWithTypeNormal() {
    cm.setNormalIncluded(false);
    Message incomingChat = createChatPacket(null, false);
    incomingChat.setType(Type.normal);
    processServerMessage(incomingChat);
    assertNull(listener.getNewChat());
}
Also used : Message(org.jivesoftware.smack.packet.Message) Test(org.junit.Test)

Example 9 with Message

use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.

the class ChatConnectionTest method validateMessageTypeWithDefaults3.

@Test
public void validateMessageTypeWithDefaults3() {
    Message incomingChat = createChatPacket("134", true);
    incomingChat.setType(Type.groupchat);
    processServerMessage(incomingChat);
    assertNull(listener.getNewChat());
}
Also used : Message(org.jivesoftware.smack.packet.Message) Test(org.junit.Test)

Example 10 with Message

use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.

the class DeliveryReceiptTest method receiptManagerListenerTest.

@Test
public void receiptManagerListenerTest() throws Exception {
    DummyConnection c = new DummyConnection();
    c.connect();
    DeliveryReceiptManager drm = DeliveryReceiptManager.getInstanceFor(c);
    TestReceiptReceivedListener rrl = new TestReceiptReceivedListener();
    drm.addReceiptReceivedListener(rrl);
    Message m = new Message(JidCreate.from("romeo@montague.com"), Message.Type.normal);
    m.setFrom(JidCreate.from("julia@capulet.com"));
    m.setStanzaId("reply-id");
    m.addExtension(new DeliveryReceipt("original-test-id"));
    c.processStanza(m);
    rrl.waitUntilInvocationOrTimeout();
}
Also used : Message(org.jivesoftware.smack.packet.Message) DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Aggregations

Message (org.jivesoftware.smack.packet.Message)142 Test (org.junit.Test)57 Presence (org.jivesoftware.smack.packet.Presence)17 StanzaCollector (org.jivesoftware.smack.StanzaCollector)14 MessageTypeFilter (org.jivesoftware.smack.filter.MessageTypeFilter)12 Stanza (org.jivesoftware.smack.packet.Stanza)12 XMPPException (org.jivesoftware.smack.XMPPException)11 XMPPConnection (org.jivesoftware.smack.XMPPConnection)9 Date (java.util.Date)8 MUCUser (org.jivesoftware.smackx.muc.packet.MUCUser)8 AccountItem (com.xabber.android.data.account.AccountItem)7 Chat (org.jivesoftware.smack.Chat)7 ExtensionElement (org.jivesoftware.smack.packet.ExtensionElement)7 XmlPullParser (org.xmlpull.v1.XmlPullParser)7 ArrayList (java.util.ArrayList)6 Jid (org.jxmpp.jid.Jid)6 NetworkException (com.xabber.android.data.NetworkException)5 Forwarded (org.jivesoftware.smackx.forward.packet.Forwarded)5 GeoLocation (org.jivesoftware.smackx.geoloc.packet.GeoLocation)5 IOException (java.io.IOException)4