use of org.springframework.jmx.JmxTestBean in project spring-framework by spring-projects.
the class MBeanExporterTests method getBeanMap.
private Map<String, Object> getBeanMap() {
Map<String, Object> map = new HashMap<>();
map.put(OBJECT_NAME, new JmxTestBean());
return map;
}
use of org.springframework.jmx.JmxTestBean in project spring-framework by spring-projects.
the class MBeanExporterOperationsTests method testRegisterManagedResourceWithGeneratedObjectName.
@Test
void testRegisterManagedResourceWithGeneratedObjectName() throws Exception {
final ObjectName objectNameTemplate = ObjectNameManager.getInstance("spring:type=Test");
MBeanExporter exporter = new MBeanExporter();
exporter.setServer(getServer());
exporter.setNamingStrategy((managedBean, beanKey) -> objectNameTemplate);
JmxTestBean bean1 = new JmxTestBean();
JmxTestBean bean2 = new JmxTestBean();
ObjectName reg1 = exporter.registerManagedResource(bean1);
ObjectName reg2 = exporter.registerManagedResource(bean2);
assertIsRegistered("Bean 1 not registered with MBeanServer", reg1);
assertIsRegistered("Bean 2 not registered with MBeanServer", reg2);
assertObjectNameMatchesTemplate(objectNameTemplate, reg1);
assertObjectNameMatchesTemplate(objectNameTemplate, reg2);
}
use of org.springframework.jmx.JmxTestBean in project spring-framework by spring-projects.
the class MBeanClientInterceptorTests method onSetUp.
@Override
public void onSetUp() throws Exception {
target = new JmxTestBean();
target.setAge(100);
target.setName("Rob Harrop");
MBeanExporter adapter = new MBeanExporter();
Map<String, Object> beans = new HashMap<>();
beans.put(OBJECT_NAME, target);
adapter.setServer(getServer());
adapter.setBeans(beans);
adapter.setAssembler(new ProxyTestAssembler());
start(adapter);
}
Aggregations