Search in sources :

Example 11 with IJmxTestBean

use of org.springframework.jmx.IJmxTestBean in project spring-framework by spring-projects.

the class MBeanClientInterceptorTests method testSetAttributeValue.

@Test
public void testSetAttributeValue() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    proxy.setName("Rob Harrop");
    assertEquals("The name of the bean should have been updated", "Rob Harrop", target.getName());
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 12 with IJmxTestBean

use of org.springframework.jmx.IJmxTestBean in project spring-framework by spring-projects.

the class MBeanClientInterceptorTests method testSetAttributeValueWithIOException.

@Test(expected = IOException.class)
public void testSetAttributeValueWithIOException() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    proxy.setName("Juergen IO");
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 13 with IJmxTestBean

use of org.springframework.jmx.IJmxTestBean in project spring-framework by spring-projects.

the class MBeanClientInterceptorTests method testSetAttributeValueWithRuntimeException.

@Test(expected = IllegalArgumentException.class)
public void testSetAttributeValueWithRuntimeException() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    proxy.setName("Juergen");
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 14 with IJmxTestBean

use of org.springframework.jmx.IJmxTestBean in project spring-framework by spring-projects.

the class MBeanClientInterceptorTests method testDifferentProxiesSameClass.

@Test
public void testDifferentProxiesSameClass() throws Exception {
    assumeTrue(runTests);
    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());
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 15 with IJmxTestBean

use of org.springframework.jmx.IJmxTestBean in project spring-framework by spring-projects.

the class AbstractJmxAssemblerTests method testSetAttribute.

@Test
public void testSetAttribute() throws Exception {
    ObjectName objectName = ObjectNameManager.getInstance(getObjectName());
    getServer().setAttribute(objectName, new Attribute(NAME_ATTRIBUTE, "Rob Harrop"));
    IJmxTestBean bean = (IJmxTestBean) getContext().getBean("testBean");
    assertEquals("Rob Harrop", bean.getName());
}
Also used : Attribute(javax.management.Attribute) IJmxTestBean(org.springframework.jmx.IJmxTestBean) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Aggregations

IJmxTestBean (org.springframework.jmx.IJmxTestBean)19 Test (org.junit.Test)18 ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)4 MBeanInfo (javax.management.MBeanInfo)3 HashMap (java.util.HashMap)2 ObjectName (javax.management.ObjectName)2 ProxyFactory (org.springframework.aop.framework.ProxyFactory)2 NopInterceptor (org.springframework.tests.aop.interceptor.NopInterceptor)2 BindException (java.net.BindException)1 Attribute (javax.management.Attribute)1 JMXConnectorServer (javax.management.remote.JMXConnectorServer)1 JMXServiceURL (javax.management.remote.JMXServiceURL)1 JmxException (org.springframework.jmx.JmxException)1 JmxTestBean (org.springframework.jmx.JmxTestBean)1 MBeanExporter (org.springframework.jmx.export.MBeanExporter)1