1717package org .apache .activemq .jmx ;
1818
1919import org .apache .activemq .broker .BrokerService ;
20+ import org .apache .activemq .broker .jmx .BrokerView ;
2021import org .apache .activemq .broker .jmx .BrokerViewMBean ;
2122import org .apache .activemq .broker .jmx .NetworkConnectorViewMBean ;
2223import org .junit .After ;
23- import org .junit .AfterClass ;
2424import org .junit .Before ;
2525import org .junit .Test ;
2626
2727import javax .management .ObjectName ;
28+ import org .slf4j .Logger ;
29+ import org .slf4j .LoggerFactory ;
2830
31+ import static org .apache .activemq .broker .jmx .BrokerView .DENIED_TRANSPORT_SCHEMES ;
2932import static org .junit .Assert .assertEquals ;
3033import static org .junit .Assert .assertNotNull ;
3134import static org .junit .Assert .fail ;
3639 */
3740public class JmxCreateNCTest {
3841
42+ private static final Logger LOG = LoggerFactory .getLogger (JmxCreateNCTest .class );
43+
3944 private static final String BROKER_NAME = "jmx-broker" ;
4045
4146 private BrokerService broker ;
@@ -79,16 +84,19 @@ public void testBridgeRegistration() throws Exception {
7984 }
8085
8186 @ Test
82- public void testVmBridgeBlocked () throws Exception {
83- testDeniedBridgeBlocked ("vm" );
84- }
85-
86- @ Test
87- public void testHttpBridgeBlocked () throws Exception {
88- testDeniedBridgeBlocked ("http" );
87+ public void testTransportSchemeBridgeBlocked () throws Exception {
88+ for (String deniedScheme : DENIED_TRANSPORT_SCHEMES ) {
89+ try {
90+ LOG .info ("verify testTransportSchemeBridgeBlocked scheme: {}" , deniedScheme );
91+ testTransportSchemeBridgeBlocked (deniedScheme );
92+ } catch (Exception e ) {
93+ LOG .warn ("testTransportSchemeBridgeBlocked failed for scheme: {}" , deniedScheme );
94+ throw e ;
95+ }
96+ }
8997 }
9098
91- protected void testDeniedBridgeBlocked (String scheme ) throws Exception {
99+ protected void testTransportSchemeBridgeBlocked (String scheme ) throws Exception {
92100 // Test composite network connector uri
93101 try {
94102 proxy .addNetworkConnector ("static:(" + scheme + "://localhost)" );
@@ -97,13 +105,6 @@ protected void testDeniedBridgeBlocked(String scheme) throws Exception {
97105 assertEquals ("Transport scheme '" + scheme + "' is not allowed" , e .getMessage ());
98106 }
99107
100- try {
101- proxy .addNetworkConnector ("multicast:(" + scheme + "://localhost)" );
102- fail ("Should have failed trying to add connector bridge" );
103- } catch (IllegalArgumentException e ) {
104- assertEquals ("Transport scheme '" + scheme + "' is not allowed" , e .getMessage ());
105- }
106-
107108 // verify direct connector as well
108109 try {
109110 proxy .addNetworkConnector (scheme + "://localhost" );
0 commit comments