Search in sources :

Example 16 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testSetReadOnlyAttribute.

@Test(expected = InvalidInvocationException.class)
public void testSetReadOnlyAttribute() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    proxy.setAge(900);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 17 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testInvokeNoArgs.

@Test
public void testInvokeNoArgs() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    long result = proxy.myOperation();
    assertEquals("The operation should return 1", 1, result);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 18 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 19 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)

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