From d3710014f16347468de9a761c9f0777e980722b2 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Fri, 13 Apr 2007 12:20:38 +0000 Subject: Yahoo tests enhancement for retry adding buddy if its not correctly added. --- .../protocol/yahoo/TestOperationSetPresence.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test') diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java index 2ead9e6..4d2f1d8 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java @@ -408,6 +408,40 @@ public class TestOperationSetPresence .removeContactPresenceStatusListener(contactPresEvtCollector); } + // something happened. the friend is not added correctly will + // try to remove it and add it again + if(contactPresEvtCollector.collectedEvents.size() == 0) + { + logger.info("ATTENTION: Yahoo friend not added correctly will remove and add him again"); + + // remove it + operationSetPresence1.unsubscribe(subEvt.getSourceContact()); + + // add it + operationSetPresence1.addSubsciptionListener(subEvtCollector); + subEvtCollector.collectedEvents.clear(); + synchronized (subEvtCollector){ + operationSetPresence1.subscribe(fixture.userID2); + //we may already have the event, but it won't hurt to check. + subEvtCollector.waitForEvent(10000); + operationSetPresence1.removeSubscriptionListener(subEvtCollector); + } + subEvtCollector.collectedEvents.clear(); + + // query it again for the status + contactPresEvtCollector.collectedEvents.clear(); + operationSetPresence1.addContactPresenceStatusListener( + contactPresEvtCollector); + + synchronized (contactPresEvtCollector){ + operationSetPresence2.publishPresenceStatus(newStatus, "new status"); + //we may already have the event, but it won't hurt to check. + contactPresEvtCollector.waitForEvent(10000); + operationSetPresence1 + .removeContactPresenceStatusListener(contactPresEvtCollector); + } + } + assertEquals("Presence Notif. event dispatching failed." , 1, contactPresEvtCollector.collectedEvents.size()); ContactPresenceStatusChangeEvent presEvt = -- cgit v1.1