Search in sources :

Example 26 with IJmxTestBean

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

the class MBeanClientInterceptorTests method getAttributeValue.

@Test
void getAttributeValue() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy1 = getProxy();
    int age = proxy1.getAge();
    assertThat(age).as("The age should be 100").isEqualTo(100);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Example 27 with IJmxTestBean

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

the class MBeanClientInterceptorTests method setAttributeValueWithCheckedException.

@Test
void setAttributeValueWithCheckedException() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    assertThatExceptionOfType(ClassNotFoundException.class).isThrownBy(() -> proxy.setName("Juergen Class"));
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Example 28 with IJmxTestBean

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

the class MBeanClientInterceptorTests method invokeArgs.

@Test
void invokeArgs() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    int result = proxy.add(1, 2);
    assertThat(result).as("The operation should return 3").isEqualTo(3);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Example 29 with IJmxTestBean

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

the class MBeanClientInterceptorTests method setAttributeValue.

@Test
void setAttributeValue() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    proxy.setName("Rob Harrop");
    assertThat(target.getName()).as("The name of the bean should have been updated").isEqualTo("Rob Harrop");
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.jupiter.api.Test)

Example 30 with IJmxTestBean

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

the class MBeanClientInterceptorTests method invokeNoArgs.

@Test
void invokeNoArgs() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    long result = proxy.myOperation();
    assertThat(result).as("The operation should return 1").isEqualTo(1);
}
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