Search in sources :

Example 1 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testInvokeUnexposedMethodWithException.

@Test(expected = InvalidInvocationException.class)
public void testInvokeUnexposedMethodWithException() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean bean = getProxy();
    bean.dontExposeMe();
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 2 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testSetAttributeValueWithCheckedException.

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

Example 3 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testGetAttributeValue.

@Test
public void testGetAttributeValue() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy1 = getProxy();
    int age = proxy1.getAge();
    assertEquals("The age should be 100", 100, age);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 4 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testProxyClassIsDifferent.

@Test
public void testProxyClassIsDifferent() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    assertTrue("The proxy class should be different than the base class", (proxy.getClass() != IJmxTestBean.class));
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.Test)

Example 5 with IJmxTestBean

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

the class MBeanClientInterceptorTests method testInvokeArgs.

@Test
public void testInvokeArgs() throws Exception {
    assumeTrue(runTests);
    IJmxTestBean proxy = getProxy();
    int result = proxy.add(1, 2);
    assertEquals("The operation should return 3", 3, result);
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) Test(org.junit.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