aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2014-11-18 11:11:20 +0200
committerDamian Minkov <damencho@jitsi.org>2014-11-18 11:29:13 +0200
commitd47cbb28e3613a0b1c59e408e0fa15d74c8053fb (patch)
treec2b8deb7083fd6a4f6612e2eb173a5543a066ee6 /test
parent12d551f7a15b1aeb9aafe6449c9911a8f82bd97e (diff)
downloadjitsi-d47cbb28e3613a0b1c59e408e0fa15d74c8053fb.zip
jitsi-d47cbb28e3613a0b1c59e408e0fa15d74c8053fb.tar.gz
jitsi-d47cbb28e3613a0b1c59e408e0fa15d74c8053fb.tar.bz2
Adds advanced msg history service, to allow plugins to insert messages into the history, and tests for the implementation.
Diffstat (limited to 'test')
-rw-r--r--test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
index b81d1e0..d78a912 100644
--- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
+++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
@@ -94,6 +94,8 @@ public class TestMsgHistoryService
suite.addTest(
new TestMsgHistoryService("specialChars"));
suite.addTest(
+ new TestMsgHistoryService("insertRecords"));
+ suite.addTest(
new TestMsgHistoryService("writeRecordsToMultiChat"));
suite.addTest(
new TestMsgHistoryService("readRecordsFromMultiChat"));
@@ -436,6 +438,26 @@ public class TestMsgHistoryService
msgs.contains(messagesToSend[6].getContent()));
}
+ /**
+ * Inserts a message between the control dates and queries to check
+ * of the expected number of messages.
+ */
+ public void insertRecords()
+ {
+ if(!(msgHistoryService instanceof MessageHistoryAdvancedService))
+ return;
+
+ ((MessageHistoryAdvancedService)msgHistoryService).insertMessage(
+ "out", null, testContact, messagesToSend[1],
+ new Date(controlDate1.getTime() + 50), false);
+
+ Collection<EventObject> rs
+ = msgHistoryService.findByPeriod(
+ testMetaContact, controlDate1, controlDate2);
+ List<String> msgs = getMessages(rs);
+ assertEquals("Messages must be 3", 3, msgs.size());
+ }
+
private static void waitWrite(long timeout)
{
synchronized (lock)