User: ejort   
  Date: 02/04/14 08:29:42

  Modified:    src/main/test/compliance/server/support Broadcaster.java
  Added:       src/main/test/compliance/server/support Listener.java
                        ListenerMBean.java MBeanListener.java
                        MBeanListenerMBean.java
  Log:
  MBeanServer notification tests
  
  Revision  Changes    Path
  1.2       +3 -0      jmx/src/main/test/compliance/server/support/Broadcaster.java
  
  Index: Broadcaster.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/test/compliance/server/support/Broadcaster.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Broadcaster.java  22 Feb 2002 16:44:34 -0000      1.1
  +++ Broadcaster.java  14 Apr 2002 15:29:42 -0000      1.2
  @@ -7,20 +7,23 @@
   
   package test.compliance.server.support;
   
  +import javax.management.Notification;
   import javax.management.NotificationBroadcasterSupport;
   
   /**
    * Simple Broadcaster
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    *   
    */
   public class Broadcaster
      extends NotificationBroadcasterSupport
      implements BroadcasterMBean
   {
  +   long sequence = 0;
      public void doSomething()
      {
  +      sendNotification(new Notification("test", this, ++sequence));
      }
   }
  
  
  
  1.1                  jmx/src/main/test/compliance/server/support/Listener.java
  
  Index: Listener.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.compliance.server.support;
  
  import javax.management.Notification;
  import javax.management.NotificationListener;
  import javax.management.ObjectName;
  
  /**
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
   * @version $Revision: 1.1 $
   *   
   */
  public class Listener
     implements ListenerMBean, NotificationListener
  {
     public int notificationCount = 0;
  
     public boolean error = false;
  
     public void doSomething()
     {
     }
  
     public void handleNotification(Notification notification, Object handback)
     {
         if (!(handback instanceof String))
            error = true;
         if (!(handback.equals("MyHandback")))
            error = true;
         if (!(notification.getSource() instanceof ObjectName))
            error = true;
         if 
(!(notification.getSource().toString().equals("JMImplementation:type=MBeanServerDelegate")))
            error = true;
  
         notificationCount++;
     }
  }
  
  
  
  1.1                  jmx/src/main/test/compliance/server/support/ListenerMBean.java
  
  Index: ListenerMBean.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.compliance.server.support;
  
  /**
   * Simple Listener Management Interface
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
   * @version $Revision: 1.1 $
   *   
   */
  public interface ListenerMBean
  {
     public void doSomething();
  }
  
  
  
  1.1                  jmx/src/main/test/compliance/server/support/MBeanListener.java
  
  Index: MBeanListener.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.compliance.server.support;
  
  import javax.management.Notification;
  import javax.management.NotificationListener;
  
  /**
   * Simple Listener
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
   * @version $Revision: 1.1 $
   *   
   */
  public class MBeanListener
     implements NotificationListener, MBeanListenerMBean
  {
     public long count = 0;
     public Object source = null;
     public Object handback = null;
     public long count1 = 0;
     public Object source1 = new Object();
     public Object handback1 = new Object();
     public long count2 = 0;
     public Object source2 = new Object();
     public Object handback2 = new Object();
  
     Object hb1 = null;
     Object hb2 = null;
  
     public MBeanListener()
     {
     }
  
     public MBeanListener(String hb1, String hb2)
     {
        this.hb1 = hb1;
        this.hb2 = hb2;
     }
  
     public void handleNotification(Notification n, Object nhb)
     {
        if (nhb != null && nhb.equals(hb1))
        {
           count1++;
           source1 = n.getSource();
           handback1 = nhb;
        }
        else if (nhb != null && nhb.equals(hb2))
        {
           count2++;
           source2 = n.getSource();
           handback2 = nhb;
        }
        else
        {
           count++;
           source = n.getSource();
           handback = nhb;
        }
     }
  }
  
  
  
  1.1                  
jmx/src/main/test/compliance/server/support/MBeanListenerMBean.java
  
  Index: MBeanListenerMBean.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.compliance.server.support;
  
  /**
   * Simple Listener Management Interface
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
   * @version $Revision: 1.1 $
   *   
   */
  public interface MBeanListenerMBean
  {
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to