aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2007-02-15 12:58:47 +0000
committerDamian Minkov <damencho@jitsi.org>2007-02-15 12:58:47 +0000
commit064fd81c36178fe2dca6497a24377ad36d629d5d (patch)
treeae291e57b0e2a109ad0e289ac09d2811b2d09366 /test
parentc5c7c263d0cb6457366b6c336dfce2e0a0a1a7f7 (diff)
downloadjitsi-064fd81c36178fe2dca6497a24377ad36d629d5d.zip
jitsi-064fd81c36178fe2dca6497a24377ad36d629d5d.tar.gz
jitsi-064fd81c36178fe2dca6497a24377ad36d629d5d.tar.bz2
Retry sending authorization reply if auth.process doesn't finnish.
Diffstat (limited to 'test')
-rw-r--r--test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java16
-rw-r--r--test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java54
2 files changed, 59 insertions, 11 deletions
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
index 41dc5a5..5b75044 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java
@@ -1244,6 +1244,11 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level.
{
conn.sendSnac(new OfflineSnacCmd(buddy, body));
}
+
+ void sendAuthorizationReplay(String uin, String reasonStr, boolean isAccpeted)
+ {
+ conn.sendSnac(new AuthReplyCmd(uin, reasonStr, isAccpeted));
+ }
private class OfflineSnacCmd extends SendImIcbm
{
@@ -1371,11 +1376,12 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level.
}
logger.trace("sending authorization " + ACCEPT);
- conn.sendSnac(
- new AuthReplyCmd(
- String.valueOf(cmd.uin),
- responseReasonStr,
- ACCEPT));
+
+ sendAuthorizationReplay(
+ String.valueOf(cmd.uin),
+ responseReasonStr,
+ ACCEPT);
+
return cmd;
}
else if (command == 27) // auth reply
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
index d3241bc..0c3d7a1 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java
@@ -565,15 +565,10 @@ public class TestOperationSetPresence
//don't want any more events
operationSetPresence.removeSubscriptionListener(subEvtCollector);
}
-
+
assertEquals("Subscription event dispatching failed."
, 1, subEvtCollector.collectedEvents.size());
- // after the authorization process finished
- // we must have received two events
- // the first is created in NotInContactList group
- // the second one is moved from NotInContactListGroup to the target group
-
EventObject evt =
(EventObject)subEvtCollector.collectedEvents.get(0);
@@ -640,6 +635,53 @@ public class TestOperationSetPresence
.removeContactPresenceStatusListener(contactPresEvtCollector);
}
+ if(contactPresEvtCollector.collectedEvents.size() == 0)
+ {
+ logger.info("PROBLEM. Authorisation process doesn't have finnished " +
+ "Server doesn't report us for changing authorization flag! Will try to authorize once again");
+
+ fixture.testerAgent.sendAuthorizationReplay(
+ fixture.icqAccountID.getUserID(),
+ fixture.testerAgent.getAuthCmdFactory().responseReasonStr,
+ fixture.testerAgent.getAuthCmdFactory().ACCEPT);
+
+ Object obj = new Object();
+ synchronized(obj)
+ {
+ logger.debug("wait for authorization process to be finnished for second time");
+ obj.wait(10000);
+ logger.debug("Stop waiting!");
+ }
+
+ testerAgentOldStatus = fixture.testerAgent.getPresneceStatus();
+ testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_FFC;
+
+ //in case we are by any chance already in a FREE_FOR_CHAT status, we'll
+ //be changing to something else
+ if(testerAgentOldStatus.equals(testerAgentNewStatus)){
+ testerAgentNewStatus = IcqStatusEnum.OCCUPIED;
+ testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_OCCUPIED;
+ }
+
+ contactPresEvtCollector.collectedEvents.clear();
+ operationSetPresence.addContactPresenceStatusListener(
+ contactPresEvtCollector);
+
+ synchronized (contactPresEvtCollector){
+ if (!fixture.testerAgent.enterStatus(testerAgentNewStatusLong))
+ {
+ throw new RuntimeException(
+ "Tester UserAgent Failed to switch to the "
+ + testerAgentNewStatus.getStatusName() + " state.");
+ }
+ //we may already have the event, but it won't hurt to check.
+ contactPresEvtCollector.waitForEvent(12000);
+ operationSetPresence
+ .removeContactPresenceStatusListener(contactPresEvtCollector);
+ }
+ }
+
+
assertEquals("Presence Notif. event dispatching failed."
, 1, contactPresEvtCollector.collectedEvents.size());
ContactPresenceStatusChangeEvent presEvt =