Search in sources :

Example 31 with IJmxTestBean

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

the class MBeanClientInterceptorTests method invokeUnexposedMethodWithException.

@Test
void invokeUnexposedMethodWithException() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean bean = getProxy();
    assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() -> bean.dontExposeMe());
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Example 32 with IJmxTestBean

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

the class MBeanClientInterceptorTests method setReadOnlyAttribute.

@Test
void setReadOnlyAttribute() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    assertThatExceptionOfType(InvalidInvocationException.class).isThrownBy(() -> proxy.setAge(900));
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Aggregations

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