Package org.springframework.jmx

Examples of org.springframework.jmx.IJmxTestBean


    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(bean);
    factory.addAdvice(new NopInterceptor());
    factory.setInterfaces(new Class[]{IJmxTestBean.class});

    IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
    String name = "bean:mmm=whatever";

    Map beans = new HashMap();
    beans.put(name, proxy);
View Full Code Here


    assertEquals("Incorrect name for y param", "y", params[1].getName());
    assertEquals("Incorrect type for y param", int.class.getName(), params[1].getType());
  }

  public void testWithCglibProxy() throws Exception {
    IJmxTestBean tb = createJmxTestBean();
    ProxyFactory pf = new ProxyFactory();
    pf.setTarget(tb);
    pf.addAdvice(new NopInterceptor());
    Object proxy = pf.getProxy();
View Full Code Here

    return "org/springframework/jmx/export/propertyPlaceholderConfigurer.xml";
  }

  @Test
  public void testPropertiesReplaced() {
    IJmxTestBean bean = (IJmxTestBean) getContext().getBean("testBean");

    assertEquals("Name is incorrect", "Rob Harrop", bean.getName());
    assertEquals("Age is incorrect", 100, bean.getAge());
  }
View Full Code Here

    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(bean);
    factory.addAdvice(new NopInterceptor());
    factory.setInterfaces(IJmxTestBean.class);

    IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
    String name = "bean:mmm=whatever";

    Map<String, Object> beans = new HashMap<String, Object>();
    beans.put(name, proxy);
View Full Code Here

  @Test
  public void testProxyClassIsDifferent() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy = getProxy();
    assertTrue("The proxy class should be different than the base class", (proxy.getClass() != IJmxTestBean.class));
  }
View Full Code Here

  @Test
  public void testDifferentProxiesSameClass() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy1 = getProxy();
    IJmxTestBean proxy2 = getProxy();

    assertNotSame("The proxies should NOT be the same", proxy1, proxy2);
    assertSame("The proxy classes should be the same", proxy1.getClass(), proxy2.getClass());
  }
View Full Code Here

  @Test
  public void testGetAttributeValue() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy1 = getProxy();
    int age = proxy1.getAge();
    assertEquals("The age should be 100", 100, age);
  }
View Full Code Here

  @Test
  public void testSetAttributeValue() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy = getProxy();
    proxy.setName("Rob Harrop");
    assertEquals("The name of the bean should have been updated", "Rob Harrop", target.getName());
  }
View Full Code Here

  @Test
  public void testSetAttributeValueWithRuntimeException() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy = getProxy();
    try {
      proxy.setName("Juergen");
      fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException ex) {
      // expected
    }
  }
View Full Code Here

  @Test
  public void testSetAttributeValueWithCheckedException() throws Exception {
    if (!runTests)
      return;
    IJmxTestBean proxy = getProxy();
    try {
      proxy.setName("Juergen Class");
      fail("Should have thrown ClassNotFoundException");
    } catch (ClassNotFoundException ex) {
      // expected
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.jmx.IJmxTestBean

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.