Package javax.management

Examples of javax.management.NotificationBroadcasterSupport$SendNotifJob


   }

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

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

      createNotification(broadcaster);

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


   }

   public void testRemoveTripletListenerFilterHandback()
      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, filter, handback);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwiceRemoveOnceTriplet()
      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.addNotificationListener(listener, filter, handback);
      broadcaster.removeNotificationListener(listener, filter, handback);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwiceRemoveTwiceTriplet()
      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.addNotificationListener(listener, filter, handback);
      broadcaster.removeNotificationListener(listener, filter, handback);
      broadcaster.removeNotificationListener(listener, filter, handback);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwoRemoveOneTripletListener()
      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.addNotificationListener(listener, null, null);
      broadcaster.removeNotificationListener(listener, null, null);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwoRemoveOneTripletListenerFilter()
      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.addNotificationListener(listener, filter, null);
      broadcaster.removeNotificationListener(listener, filter, null);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwoRemoveOneTripletListenerHandback()
      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.addNotificationListener(listener, null, handback);
      broadcaster.removeNotificationListener(listener, null, handback);

      createNotification(broadcaster);

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

   }

   public void testRegisterTwoRemoveOneTripletListenerFilterHandback()
      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, null, null);
      broadcaster.addNotificationListener(listener, filter, handback);
      broadcaster.removeNotificationListener(listener, filter, handback);

      createNotification(broadcaster);

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

   }

   public void testRemoveTripletErrors()
      throws Exception
   {
      NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
      Object handback = new Object();
      NotificationFilterSupport filter = new NotificationFilterSupport();
      filter.enableType(DEFAULT_TYPE);

      Listener listener = new Listener();

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

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

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

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, null);
         broadcaster.removeNotificationListener(listener, new NotificationFilterSupport(), null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      assertTrue("Expected ListenerNotFoundException for wrong filter", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, handback);
         broadcaster.removeNotificationListener(listener, null, new Object());
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      assertTrue("Expected ListenerNotFoundException for wrong handback", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, handback);
         broadcaster.removeNotificationListener(listener, new NotificationFilterSupport(), new Object());
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      assertTrue("Expected ListenerNotFoundException for wrong filter and handback", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, handback);
         broadcaster.removeNotificationListener(listener, null, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 1", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, handback);
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 2", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, handback);
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 3", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, null);
         broadcaster.removeNotificationListener(listener, null, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 4", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, null);
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 5", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, filter, null);
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 6", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, handback);
         broadcaster.removeNotificationListener(listener, null, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 7", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, handback);
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 8", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, handback);
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 9", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, null);
         broadcaster.removeNotificationListener(listener, filter, null);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 10", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, null);
         broadcaster.removeNotificationListener(listener, null, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 11", caught);

      caught = false;
      try
      {
         broadcaster.addNotificationListener(listener, null, null);
         broadcaster.removeNotificationListener(listener, filter, handback);
      }
      catch (ListenerNotFoundException e)
      {
         caught = true;
         broadcaster.removeNotificationListener(listener, null, null);
      }
      assertTrue("Expected ListenerNotFoundException for listener remove with wrong triplet 12", caught);
   }
View Full Code Here

   // Tests ---------------------------------------------------------------------

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

      broadcaster.addNotificationListener(new Listener(), null, null);

      broadcaster.addNotificationListener(new Listener(), new NotificationFilterSupport(), null);

      broadcaster.addNotificationListener(new Listener(), null, new Object());

      broadcaster.addNotificationListener(new Listener(), new NotificationFilterSupport(), new Object());
   }
View Full Code Here

TOP

Related Classes of javax.management.NotificationBroadcasterSupport$SendNotifJob

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.