[sip-comm-cvs] CVS update: /sip-communicator/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java

damencho at dev.java.net damencho at dev.java.net
Fri Apr 13 14:20:41 CEST 2007


User: damencho
Date: 2007-04-13 12:20:41+0000
Log:
 Yahoo tests enhancement for retry adding buddy if its not correctly added.

File Changes:

Directory: /sip-communicator/test/net/java/sip/communicator/slick/protocol/yahoo/
=================================================================================

File [changed]: TestOperationSetPresence.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java?r1=1.11&r2=1.12
Delta lines:  +34 -0
--------------------
--- TestOperationSetPresence.java	2007-03-23 11:39:47+0000	1.11
+++ TestOperationSetPresence.java	2007-04-13 12:20:38+0000	1.12
@@ -408,6 +408,40 @@
                 .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 =




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list