Package org.springframework.jmx.access

Examples of org.springframework.jmx.access.NotificationListenerRegistrar


    exporter.setBeans(beans);
    exporter.afterPropertiesSet();

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();

    NotificationListenerRegistrar registrar = new NotificationListenerRegistrar();
    registrar.setServer(server);
    registrar.setNotificationListener(listener);
    registrar.setMappedObjectName(objectName);
    registrar.afterPropertiesSet();

    // update the attribute
    String attributeName = "Name";
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener not notified", 1, listener.getCount(attributeName));

    registrar.destroy();

    // try to update the attribute again
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
  }
View Full Code Here


    exporter.setBeans(beans);
    exporter.afterPropertiesSet();

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();

    NotificationListenerRegistrar registrar = new NotificationListenerRegistrar();
    registrar.setServer(server);
    registrar.setNotificationListener(listener);
    //registrar.setMappedObjectNames(new Object[] {objectName, objectName2});
    registrar.setMappedObjectNames(new String[] {"spring:name=Test", "spring:name=Test2"});
    registrar.afterPropertiesSet();

    // update the attribute
    String attributeName = "Name";
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener not notified", 1, listener.getCount(attributeName));

    registrar.destroy();

    // try to update the attribute again
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
  }
View Full Code Here

    exporter.setBeans(beans);
    start(exporter);

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();

    NotificationListenerRegistrar registrar = new NotificationListenerRegistrar();
    registrar.setServer(server);
    registrar.setNotificationListener(listener);
    registrar.setMappedObjectName(objectName);
    registrar.afterPropertiesSet();

    // update the attribute
    String attributeName = "Name";
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener not notified", 1, listener.getCount(attributeName));

    registrar.destroy();

    // try to update the attribute again
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
  }
View Full Code Here

    exporter.setBeans(beans);
    start(exporter);

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();

    NotificationListenerRegistrar registrar = new NotificationListenerRegistrar();
    registrar.setServer(server);
    registrar.setNotificationListener(listener);
    //registrar.setMappedObjectNames(new Object[] {objectName, objectName2});
    registrar.setMappedObjectNames(new String[] { "spring:name=Test", "spring:name=Test2" });
    registrar.afterPropertiesSet();

    // update the attribute
    String attributeName = "Name";
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener not notified", 1, listener.getCount(attributeName));

    registrar.destroy();

    // try to update the attribute again
    server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
    assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
  }
View Full Code Here

TOP

Related Classes of org.springframework.jmx.access.NotificationListenerRegistrar

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.