Search in sources :

Example 61 with Message

use of org.xmpp.packet.Message in project Openfire by igniterealtime.

the class OfflineMessageStoreTest method shouldNotStoreErrorMessages.

@Test
public void shouldNotStoreErrorMessages() {
    // XEP-0160: "error" message types SHOULD NOT be stored offline,
    Message message = new Message();
    message.setType(Message.Type.error);
    assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
Also used : Message(org.xmpp.packet.Message) Test(org.junit.Test)

Example 62 with Message

use of org.xmpp.packet.Message in project Openfire by igniterealtime.

the class OfflineMessageStoreTest method shouldStoreNonEmptyChatMessages.

@Test
public void shouldStoreNonEmptyChatMessages() {
    // XEP-0160: "chat" message types SHOULD be stored offline unless they only contain chat state notifications
    Message message = new Message();
    message.setType(Message.Type.chat);
    message.setBody(" ");
    assertTrue(OfflineMessageStore.shouldStoreMessage(message));
}
Also used : Message(org.xmpp.packet.Message) Test(org.junit.Test)

Example 63 with Message

use of org.xmpp.packet.Message in project Openfire by igniterealtime.

the class OfflineMessageStoreTest method shouldNotStoreGroupChatMessages.

@Test
public void shouldNotStoreGroupChatMessages() {
    // XEP-0160: "groupchat" message types SHOULD NOT be stored offline
    Message message = new Message();
    message.setType(Message.Type.groupchat);
    assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
Also used : Message(org.xmpp.packet.Message) Test(org.junit.Test)

Example 64 with Message

use of org.xmpp.packet.Message in project Openfire by igniterealtime.

the class OfflineMessageStoreTest method shouldNotStoreEmptyChatMessagesWithOnlyChatStatesAndThread.

@Test
public void shouldNotStoreEmptyChatMessagesWithOnlyChatStatesAndThread() {
    Message message = new Message();
    message.setType(Message.Type.chat);
    message.setThread("1234");
    PacketExtension chatState = new PacketExtension("composing", "http://jabber.org/protocol/chatstates");
    message.addExtension(chatState);
    assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
Also used : PacketExtension(org.xmpp.packet.PacketExtension) Message(org.xmpp.packet.Message) Test(org.junit.Test)

Example 65 with Message

use of org.xmpp.packet.Message in project Openfire by igniterealtime.

the class OfflineMessageStoreTest method shouldNotStoreHeadlineMessages.

@Test
public void shouldNotStoreHeadlineMessages() {
    // XEP-0160: "headline" message types SHOULD NOT be stored offline
    Message message = new Message();
    message.setType(Message.Type.headline);
    assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
Also used : Message(org.xmpp.packet.Message) Test(org.junit.Test)

Aggregations

Message (org.xmpp.packet.Message)111 Element (org.dom4j.Element)35 JID (org.xmpp.packet.JID)25 Test (org.junit.Test)23 Presence (org.xmpp.packet.Presence)18 IQ (org.xmpp.packet.IQ)16 ArrayList (java.util.ArrayList)10 Packet (org.xmpp.packet.Packet)10 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)9 Date (java.util.Date)6 ClientSession (org.jivesoftware.openfire.session.ClientSession)6 NotFoundException (org.jivesoftware.util.NotFoundException)6 StringReader (java.io.StringReader)4 List (java.util.List)4 GroupNotFoundException (org.jivesoftware.openfire.group.GroupNotFoundException)4 User (org.jivesoftware.openfire.user.User)4 IOException (java.io.IOException)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 SAXReader (org.dom4j.io.SAXReader)3 DefaultElement (org.dom4j.tree.DefaultElement)3