Package org.springframework.jmx

Examples of org.springframework.jmx.JmxTestBean


  @SuppressWarnings({"rawtypes", "unchecked"})
  @Test
  public void testRegisterNotificationListenerForMBean() throws Exception {
    ObjectName objectName = ObjectName.getInstance("spring:name=Test");
    JmxTestBean bean = new JmxTestBean();

    Map<String, Object> beans = new HashMap<String, Object>();
    beans.put(objectName.getCanonicalName(), bean);

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
View Full Code Here


  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Test
  public void testRegisterNotificationListenerWithWildcard() throws Exception {
    ObjectName objectName = ObjectName.getInstance("spring:name=Test");
    JmxTestBean bean = new JmxTestBean();

    Map<String, Object> beans = new HashMap<String, Object>();
    beans.put(objectName.getCanonicalName(), bean);

    CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
View Full Code Here

  @Test
  public void testRegisterManagedResourceWithUserSuppliedObjectName() throws Exception {
    ObjectName objectName = ObjectNameManager.getInstance("spring:name=Foo");

    JmxTestBean bean = new JmxTestBean();
    bean.setName("Rob Harrop");

    MBeanExporter exporter = new MBeanExporter();
    exporter.setServer(getServer());
    exporter.registerManagedResource(bean, objectName);

    String name = (String) getServer().getAttribute(objectName, "Name");
    assertEquals("Incorrect name on MBean", name, bean.getName());
  }
View Full Code Here

      public ObjectName getObjectName(Object managedBean, String beanKey) {
        return objectNameTemplate;
      }
    });

    JmxTestBean bean1 = new JmxTestBean();
    JmxTestBean bean2 = new JmxTestBean();

    ObjectName reg1 = exporter.registerManagedResource(bean1);
    ObjectName reg2 = exporter.registerManagedResource(bean2);

    assertIsRegistered("Bean 1 not registered with MBeanServer", reg1);
View Full Code Here

      public ObjectName getObjectName(Object managedBean, String beanKey) {
        return objectNameTemplate;
      }
    });

    JmxTestBean bean1 = new JmxTestBean();
    JmxTestBean bean2 = new JmxTestBean();

    ObjectName reg1 = exporter.registerManagedResource(bean1);
    assertIsRegistered("Bean 1 not registered with MBeanServer", reg1);

    try {
View Full Code Here

  protected int getExpectedOperationCount() {
    return 9;
  }

  protected IJmxTestBean createJmxTestBean() {
    return new JmxTestBean();
  }
View Full Code Here

* @author Rob Harrop
*/
public abstract class AbstractAutodetectTests extends TestCase {

  public void testAutodetect() throws Exception {
    JmxTestBean bean = new JmxTestBean();

    AutodetectCapableMBeanInfoAssembler assembler = getAssembler();
    assertTrue("The bean should be included", assembler.includeBean(bean.getClass(), "testBean"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.jmx.JmxTestBean

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.