Make MBeanServer tests more robust

This commit refactors several tests to use SocketUtils to find an
available port, compose a custom JMX service URL using that port, and
start an MBeanServer for the particular test using that port.

This commit also makes other changes to MBeanServer related tests in an
effort to make them more robust when executed concurrently.

Closes gh-23699
This commit is contained in:
Sam Brannen
2019-10-31 14:34:57 +01:00
parent 57b4b74e7d
commit 74b7b550f6
12 changed files with 172 additions and 189 deletions

View File

@@ -5,22 +5,22 @@
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="propertyEditorRegistrars">
<bean class="org.springframework.jmx.export.CustomDateEditorRegistrar"/>
<bean class="org.springframework.jmx.export.CustomDateEditorRegistrar" />
</property>
</bean>
<bean id="dateRange" class="org.springframework.jmx.export.DateRange">
<property name="startDate" value="2004/10/12"/>
<property name="endDate" value="2004/11/13"/>
<property name="startDate" value="2004/10/12" />
<property name="endDate" value="2004/11/13" />
</bean>
<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="bean:name=dateRange" value-ref="dateRange"/>
<entry key="bean:name=dateRange" value-ref="dateRange" />
</map>
</property>
<property name="server" ref="server"/>
</bean>
<property name="server" ref="server" />
</bean>
</beans>