Updated Branches:
  refs/heads/master 9ba787358 -> 6238bff69

WICKET-4668 Ajax responses for QUEUE and DROP type channels are not guaranteed 
to be processed in the order of the requests

Add a unit test that asserts that ChannelManager do not keep entries for 
done-ed channels.


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6238bff6
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6238bff6
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6238bff6

Branch: refs/heads/master
Commit: 6238bff69fe9b9e39a9a06d460fb87909f45b307
Parents: 3b0ccc9
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Tue Jul 24 15:44:59 2012 +0300
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Tue Jul 24 15:44:59 2012 +0300

----------------------------------------------------------------------
 wicket-core/src/test/js/channels.js |   33 ++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/6238bff6/wicket-core/src/test/js/channels.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/channels.js 
b/wicket-core/src/test/js/channels.js
index 25c36d0..4e16293 100644
--- a/wicket-core/src/test/js/channels.js
+++ b/wicket-core/src/test/js/channels.js
@@ -117,8 +117,6 @@ jQuery(document).ready(function() {
                        cha     = name + '|a',                                  
// the active channel
                        number  = 10,                                           
        // the number of requests to schedule while the active request is still 
running
                        i       = 0,                                            
        // the current iteration
-                       j       = 0,                                            
        // the counter that decides when to release the test
-                       result  = '',                                           
        // the container for the actual result
                        queueCallback = function() {
 
                                // run in a timeout to simulate long running 
request
@@ -144,4 +142,35 @@ jQuery(document).ready(function() {
                }
 
        });
+
+       /**
+        * Asserts that the ChannelManager removes entries for done()-ed 
channels
+        */
+       test('clean up', function () {
+
+               expect(11);
+
+               stop();
+
+               var cm      = Wicket.channelManager,            // the manager
+                       name    = 'name',                                       
        // the channel name
+                       cha     = name + '|s',                                  
// the channel
+                       number  = 10,                                           
        // the number of requests to schedule while the active request is still 
running
+                       i       = 0,                                            
        // the current iteration
+                       callback = function() {
+                               window.setTimeout(function() {
+                                       cm.done(cha);
+                               }, 0);
+                       };
+
+               for (; i < number; i++) {
+                       cm.schedule(cha, callback);
+                       ok(cm.channels[name], "A channel exists.");
+               }
+
+               window.setTimeout(function() {
+                       start();
+                       equal(undefined, cm.channels[name]);
+               }, 100);
+       });
 });

Reply via email to