use of org.springframework.jmx.export.naming.MetadataNamingStrategy in project spring-boot by spring-projects.
the class JmxAutoConfigurationTests method testDefaultDomainConfiguredOnMBeanExport.
@Test
public void testDefaultDomainConfiguredOnMBeanExport() {
MockEnvironment env = new MockEnvironment();
env.setProperty("spring.jmx.enabled", "true");
env.setProperty("spring.jmx.default-domain", "my-test-domain");
this.context = new AnnotationConfigApplicationContext();
this.context.setEnvironment(env);
this.context.register(TestConfiguration.class, JmxAutoConfiguration.class);
this.context.refresh();
MBeanExporter mBeanExporter = this.context.getBean(MBeanExporter.class);
assertThat(mBeanExporter).isNotNull();
MetadataNamingStrategy naming = (MetadataNamingStrategy) ReflectionTestUtils.getField(mBeanExporter, "namingStrategy");
assertThat(ReflectionTestUtils.getField(naming, "defaultDomain")).isEqualTo("my-test-domain");
}
Aggregations