diff options
author | Damian Minkov <damencho@jitsi.org> | 2007-03-21 16:10:12 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2007-03-21 16:10:12 +0000 |
commit | a4178a23d6540fe8c59eca35c489886de408d919 (patch) | |
tree | 026b1361cf4571aea4e9c8ed25874adb2ae76e91 /test/net/java | |
parent | a0600fa3b5029a4f6b640fa90b95ff3d21748467 (diff) | |
download | jitsi-a4178a23d6540fe8c59eca35c489886de408d919.zip jitsi-a4178a23d6540fe8c59eca35c489886de408d919.tar.gz jitsi-a4178a23d6540fe8c59eca35c489886de408d919.tar.bz2 |
Tests improvement.
Diffstat (limited to 'test/net/java')
-rw-r--r-- | test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java index ab2434f..5f3553d 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java @@ -501,10 +501,24 @@ public class TestOperationSetPresence operationSetPresence1.removeSubscriptionListener(subEvtCollector); - assertEquals("Subscription event dispatching failed." - , 1, subEvtCollector.collectedEvents.size()); - SubscriptionEvent subEvt = - (SubscriptionEvent)subEvtCollector.collectedEvents.get(0); + + assertTrue("Subscription event dispatching failed." + , subEvtCollector.collectedEvents.size() > 0); + + SubscriptionEvent subEvt = null; + + Iterator events = subEvtCollector.collectedEvents.iterator(); + while (events.hasNext()) + { + SubscriptionEvent elem = (SubscriptionEvent) events.next(); + if(elem.getEventID() == SubscriptionEvent.SUBSCRIPTION_CREATED) + subEvt = elem; + } + + // it happens that when adding contacts which require authorization + // sometimes the collected events are 3 - added, deleted, added + // so we get the last one if there is such + assertNotNull("Subscription event dispatching failed.", subEvt); assertEquals("SubscriptionEvent Source:", fixture.userID2, @@ -1040,7 +1054,7 @@ public class TestOperationSetPresence this.response = response; logger.trace("processAuthorizationResponse '" + - response.getResponseCode() + " " + + response.getResponseCode().getCode() + " " + sourceContact); notifyAll(); @@ -1052,7 +1066,10 @@ public class TestOperationSetPresence synchronized(this) { if(isAuthorizationResponseReceived) + { + logger.debug("authorization response already received"); return; + } try{ wait(waitFor); } @@ -1068,7 +1085,11 @@ public class TestOperationSetPresence { synchronized(this) { - if(isAuthorizationRequestReceived) return; + if(isAuthorizationRequestReceived) + { + logger.debug("authorization request already received"); + return; + } try{ wait(waitFor); } |