Examples of fetchNotifications()


Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

      // 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
      result = handler.fetchNotifications(result.getNextSequenceNumber(), count + 1, 100);
      assertEquals(result.getEarliestSequenceNumber(), 0);
      assertEquals(result.getNextSequenceNumber(), count + count);
      assertNotNull(result.getTargetedNotifications());
      assertEquals(result.getTargetedNotifications().length, count);
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

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

      // 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 testBufferOverflowWhileFetching() throws Exception
   {
View Full Code Here

Examples of mx4j.remote.RemoteNotificationServerHandler.fetchNotifications()

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

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

      // Add some notifications, but don't fill the buffer
      long count = bufferCapacity - 2;
      NotificationListener listener = handler.getServerNotificationListener();
      Notification notification = new Notification("dummy", this, 0);
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 < count; ++i) listener.handleNotification(notification, listenerID);

      // Fetch again
      result = handler.fetchNotifications(result.getNextSequenceNumber(), bufferCapacity + 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()

      int overflow = 7;
      // Note that count == result.getNextSequenceNumber() always yield true at this point (see assertion above),
      // so we actually overflew the buffer by a quantity q == count + overflow (see assertion below).
      long overflowCount = (bufferCapacity - count) + result.getNextSequenceNumber() + overflow;
      for (int i = 0; i < overflowCount; ++i) listener.handleNotification(notification, listenerID);
      result = handler.fetchNotifications(result.getNextSequenceNumber(), bufferCapacity + 1, 100);

      // After algebraic semplification, overflowCount == bufferCapacity + overflow, so
      // the buffer is full, and we fetched all notifications
      assertEquals(count + overflow, result.getEarliestSequenceNumber());
      assertEquals(count + overflow + bufferCapacity, result.getNextSequenceNumber());
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.