diff options
author | hristoterezov <hristo@jitsi.org> | 2013-07-23 11:30:43 +0300 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2013-07-23 11:30:43 +0300 |
commit | 6eb5d4e440a60a5a358cf15211c5207bc590a160 (patch) | |
tree | e53ed382156cb16c1d6c085568905e1f5018a3f2 /test | |
parent | 8d60a758d0cc9122b8ac89f13601700de0f36a15 (diff) | |
download | jitsi-6eb5d4e440a60a5a358cf15211c5207bc590a160.zip jitsi-6eb5d4e440a60a5a358cf15211c5207bc590a160.tar.gz jitsi-6eb5d4e440a60a5a358cf15211c5207bc590a160.tar.bz2 |
Tries to fix randomly failing tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java index 11c0ba5..53129cd 100644 --- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java +++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java @@ -69,6 +69,8 @@ public class TestMsgHistoryService private static Date controlDate1 = null; private static Date controlDate2 = null; + + private static Object lock = new Object(); public TestMsgHistoryService(String name) { @@ -392,6 +394,21 @@ public class TestMsgHistoryService msgs.contains(messagesToSend[2].getContent())); } + private static void waitWrite(long timeout) + { + synchronized (lock) + { + // wait a moment + try + { + lock.wait(timeout); + } + catch (InterruptedException ex) + { + } + } + } + public void writeRecordsToMultiChat() { try @@ -407,39 +424,26 @@ public class TestMsgHistoryService TestMsgHistoryService.controlDate1 = new Date(); - Object lock = new Object(); - synchronized (lock) - { - // wait a moment - try - { - lock.wait(200); - } - catch (InterruptedException ex) - { - } - } + waitWrite(200); + room.sendMessage(messagesToSend[1]); + waitWrite(200); + room.sendMessage(messagesToSend[2]); TestMsgHistoryService.controlDate2 = new Date(); - synchronized (lock) - { - // wait a moment - try - { - lock.wait(200); - } - catch (InterruptedException ex) - { - } - } + + waitWrite(200); room.sendMessage(messagesToSend[3]); - + + waitWrite(200); + room.sendMessage(messagesToSend[4]); + + waitWrite(200); } catch(OperationFailedException ex) { |