Search in sources :

Example 56 with Message

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

the class MessageCorrectExtensionTest method checkStanzas.

@Test
public void checkStanzas() throws Exception {
    Message initialMessage = (Message) PacketParserUtils.parseStanza(initialMessageXml);
    MessageCorrectExtension messageCorrectExtension = new MessageCorrectExtension(idInitialMessage);
    Assert.assertEquals(messageCorrectExtension.toXML().toString(), messageCorrectionXml);
    initialMessage.addExtension(messageCorrectExtension);
    Assert.assertEquals(initialMessage.toXML(), expectedXml);
}
Also used : Message(org.jivesoftware.smack.packet.Message) MessageCorrectExtension(org.jivesoftware.smackx.message_correct.element.MessageCorrectExtension) Test(org.junit.Test)

Example 57 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 58 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 59 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 60 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)

Aggregations

Message (org.jivesoftware.smack.packet.Message)166 Test (org.junit.Test)57 Presence (org.jivesoftware.smack.packet.Presence)21 XMPPException (org.jivesoftware.smack.XMPPException)15 StanzaCollector (org.jivesoftware.smack.StanzaCollector)14 NetworkException (com.xabber.android.data.NetworkException)13 Stanza (org.jivesoftware.smack.packet.Stanza)13 MUCUser (org.jivesoftware.smackx.muc.packet.MUCUser)13 MessageTypeFilter (org.jivesoftware.smack.filter.MessageTypeFilter)12 ExtensionElement (org.jivesoftware.smack.packet.ExtensionElement)12 AccountItem (com.xabber.android.data.account.AccountItem)11 XMPPConnection (org.jivesoftware.smack.XMPPConnection)11 Date (java.util.Date)10 Jid (org.jxmpp.jid.Jid)10 Chat (org.jivesoftware.smack.Chat)9 AccountJid (com.xabber.android.data.entity.AccountJid)7 ArrayList (java.util.ArrayList)7 XmlPullParser (org.xmlpull.v1.XmlPullParser)7 InputStream (java.io.InputStream)6 Forwarded (org.jivesoftware.smackx.forward.packet.Forwarded)6