Package javax.management

Examples of javax.management.NotificationBroadcasterSupport$ListenerInfo


   }

   public void testOneListenerRegisteredWithTwoBroadcasters()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster1 = new NotificationBroadcasterSupport();
      NotificationBroadcasterSupport broadcaster2 = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      broadcaster1.addNotificationListener(listener, null, null);
      broadcaster2.addNotificationListener(listener, null, null);

      createNotification(broadcaster1);
      createNotification(broadcaster2);

      compare(sent, received(listener, null));
View Full Code Here


   }

   public void testRemoveListener()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      broadcaster.addNotificationListener(listener, null, null);
      broadcaster.removeNotificationListener(listener);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
   }
View Full Code Here

   }

   public void testRegisteredTwiceRemoveListener()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      broadcaster.addNotificationListener(listener, null, null);
      broadcaster.addNotificationListener(listener, null, null);
      broadcaster.removeNotificationListener(listener);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
   }
View Full Code Here

   }

   public void testRegisteredWithFilterRemoveListener()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      NotificationFilterSupport filter = new NotificationFilterSupport();
      filter.enableType(DEFAULT_TYPE);
      broadcaster.addNotificationListener(listener, filter, null);
      broadcaster.removeNotificationListener(listener);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
   }
View Full Code Here

   }

   public void testRegisteredWithHandbackRemoveListener()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      Object handback = new Object();
      broadcaster.addNotificationListener(listener, null, handback);
      broadcaster.removeNotificationListener(listener);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
      compare(EMPTY, received(listener, handback));
View Full Code Here

   }

   public void testRegisteredWithFilterHandbackRemoveListener()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      Object handback = new Object();
      NotificationFilterSupport filter = new NotificationFilterSupport();
      filter.enableType(DEFAULT_TYPE);
      broadcaster.addNotificationListener(listener, filter, handback);
      broadcaster.removeNotificationListener(listener);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
      compare(EMPTY, received(listener, handback));
View Full Code Here

   }

   public void testRegisterRemoveListenerRegister()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      broadcaster.addNotificationListener(listener, null, null);
      broadcaster.removeNotificationListener(listener);
      broadcaster.addNotificationListener(listener, null, null);

      createNotification(broadcaster);

      compare(sent, received(listener, null));
   }
View Full Code Here

   }

   public void testRemoveListenerErrors()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();

      boolean caught = false;
      try
      {
         broadcaster.removeNotificationListener(null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
      }
      assertTrue("Expected ListenerNotFoundException for null listener", caught);

      caught = false;
      try
      {
         broadcaster.removeNotificationListener(listener);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
      }
      assertTrue("Expected ListenerNotFoundException for listener never added", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, null);
         broadcaster.removeNotificationListener(listener);
         broadcaster.removeNotificationListener(listener);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
      }
View Full Code Here

   }

   public void testRemoveTripletListenerOnly()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      broadcaster.addNotificationListener(listener, null, null);
      broadcaster.removeNotificationListener(listener, null, null);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
   }
View Full Code Here

   }

   public void testRemoveTripletListenerFilter()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();

      Listener listener = new Listener();
      NotificationFilterSupport filter = new NotificationFilterSupport();
      filter.enableType(DEFAULT_TYPE);
      broadcaster.addNotificationListener(listener, filter, null);
      broadcaster.removeNotificationListener(listener, filter, null);

      createNotification(broadcaster);

      compare(EMPTY, received(listener, null));
   }
View Full Code Here

TOP

Related Classes of javax.management.NotificationBroadcasterSupport$ListenerInfo

Copyright © 2018 www.massapicom. 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.