コード例 #1
0
 @Test(dataProvider = "createTimer")
 public void test9(TimeScheduler timer) throws Exception {
   try {
     NakReceiverWindow win = new NakReceiverWindow(sender, cmd, 0, timer);
     win.add(1, new Message());
     win.add(2, new Message());
     win.add(3, new Message());
     win.add(4, new Message());
     win.add(6, new Message());
     System.out.println("win: " + win);
     while ((win.remove()) != null) ;
     win.stable(6); // 6 is ignore as it is >= highest delivered message
     System.out.println("win: " + win);
     assert win.get(2) != null;
     check(win, 0, 6, 4);
     win.add(5, new Message());
     check(win, 0, 6, 4);
     while ((win.remove()) != null) ;
     check(win, 0, 6, 6);
     win.stable(6);
     check(win, 6, 6, 6);
   } finally {
     timer.stop();
   }
 }
コード例 #2
0
 @Test(dataProvider = "createTimer")
 public void test3(TimeScheduler timer) throws Exception {
   try {
     NakReceiverWindow win = new NakReceiverWindow(sender, cmd, 0, timer);
     win.add(1, new Message());
     assert win.get(1) != null;
     check(win, 0, 1, 0);
     win.add(2, new Message());
     check(win, 0, 2, 0);
     assert win.get(2) != null;
     win.remove();
     check(win, 0, 2, 1);
     win.remove();
     check(win, 0, 2, 2);
   } finally {
     timer.stop();
   }
 }
コード例 #3
0
 @Test(dataProvider = "createTimer")
 public void test1(TimeScheduler timer) throws Exception {
   try {
     NakReceiverWindow win = new NakReceiverWindow(sender, cmd, 1, timer);
     check(win, 0, 1, 1);
     assert win.get(23) == null;
   } finally {
     timer.stop();
   }
 }