Examples of fetchNotifications()


Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

   public void testFirstFetch() throws Exception
   {
      RemoteNotificationServerHandler handler = new DefaultRemoteNotificationServerHandler(null);

      // First call is with sequence number negative; no notification waiting
      NotificationResult result = handler.fetchNotifications(-1, 10, 100);

      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), 0);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, 0);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      Notification notification = new Notification("dummy", this, 0);
      Integer listenerID = new Integer(1);
      listener.handleNotification(notification, listenerID);

      // Fetch notifications
      NotificationResult result = handler.fetchNotifications(-1, 10, 100);
      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), 1);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, 0);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      // Add another notification
      listener.handleNotification(notification, listenerID);

      // Fetch again
      result = handler.fetchNotifications(result.getNextSequenceNumber(), 10, 100);
      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), 2);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, 1);
   }
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      Notification notification = new Notification("dummy", this, 0);
      Integer listenerID = new Integer(1);
      for (int i = 0; i < bufferCapacity; ++i) listener.handleNotification(notification, listenerID);

      // Fetch first time
      NotificationResult result = handler.fetchNotifications(-1, bufferCapacity + 1, 100);
      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), bufferCapacity);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, 0);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      // Add another notification: the buffer is full, the earliest sequence number must change
      listener.handleNotification(notification, listenerID);

      // Fetch again
      result = handler.fetchNotifications(result.getNextSequenceNumber(), bufferCapacity + 1, 100);
      assertEquals(result.getEarliestSequenceNumber(), bufferCapacity);
      assertEquals(result.getNextSequenceNumber(), bufferCapacity + 1);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, 1);
   }
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      Map environment = new HashMap();
      environment.put(MX4JRemoteConstants.NOTIFICATION_PURGE_DISTANCE, new Integer(distance));
      RemoteNotificationServerHandler handler = new DefaultRemoteNotificationServerHandler(environment);

      // Fetch
      NotificationResult result = handler.fetchNotifications(-1, 10, 100);

      // Add notifications
      NotificationListener listener = handler.getServerNotificationListener();
      Notification notification = new Notification("dummy", this, 0);
      Integer listenerID = new Integer(1);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      Integer listenerID = new Integer(1);
      int count = distance + 1;
      for (int i = 0; i < count; ++i) listener.handleNotification(notification, listenerID);

      // Fetch again
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);
      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), count);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, count);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      assertEquals(result.getNextSequenceNumber(), count);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, count);

      // Fetch again: this call triggers purge of old notifications, which changes the earliest sequence number
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);

      // Check that the earliest sequence number has changed
      long oldEarliest = result.getEarliestSequenceNumber();
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);
      if (oldEarliest >= result.getEarliestSequenceNumber()) fail();
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      // Fetch again: this call triggers purge of old notifications, which changes the earliest sequence number
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);

      // Check that the earliest sequence number has changed
      long oldEarliest = result.getEarliestSequenceNumber();
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);
      if (oldEarliest >= result.getEarliestSequenceNumber()) fail();
   }

   public void testPurgeNotificationsWithInitialNotificationMiss() throws Exception
   {
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      Integer listenerID = new Integer(1);
      int count = distance + 1;
      for (int i = 0; i < count; ++i) listener.handleNotification(notification, listenerID);

      // First fetch
      NotificationResult result = handler.fetchNotifications(-1, count + 1, 100);

      // Add notifications
      for (int i = 0; i < count; ++i) listener.handleNotification(notification, listenerID);

      // Fetch again: this call triggers purge of old notifications, which changes the earliest sequence number
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.