Use dynamic ports for the test to avoid clashing with other brokers.
This commit is contained in:
Timothy Bish 2014-09-30 09:56:24 -04:00
parent 025c2316d9
commit 80322ce00d
2 changed files with 25 additions and 21 deletions

View File

@ -43,10 +43,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SimpleAMQPAuthTest {
public static final String SIMPLE_AUTH_AMQP_BROKER_XML = "org/apache/activemq/transport/amqp/simple-auth-amqp-broker.xml";
public BrokerService brokerService;
protected static final Logger LOG = LoggerFactory.getLogger(SimpleAMQPAuthTest.class);
protected int port = 5672;
private static final Logger LOG = LoggerFactory.getLogger(SimpleAMQPAuthTest.class);
private final String SIMPLE_AUTH_AMQP_BROKER_XML =
"org/apache/activemq/transport/amqp/simple-auth-amqp-broker.xml";
private BrokerService brokerService;
private int port;
@Before
public void setUp() throws Exception {
@ -167,6 +170,7 @@ public class SimpleAMQPAuthTest {
public void startBroker() throws Exception {
brokerService = createBroker();
brokerService.start();
port = brokerService.getTransportConnectorByName("amqp").getPublishableConnectURI().getPort();
brokerService.waitUntilStarted();
}
}

View File

@ -6,9 +6,9 @@
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -29,8 +29,8 @@
<broker useJmx="true" persistent="false" xmlns="http://activemq.apache.org/schema/core" populateJMSXUserID="true" schedulePeriodForDestinationPurge="2000">
<destinations>
<queue physicalName="TEST.Q" />
</destinations>
<queue physicalName="TEST.Q" />
</destinations>
<!-- Use a non-default port in case the default port is in use -->
<managementContext>
@ -39,18 +39,18 @@
<transportConnectors>
<transportConnector name="openwire" uri="vm://localhost" />
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:0"/>
</transportConnectors>
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="system" password="systemPassword" groups="users,admins"/>
<authenticationUser username="user" password="userPassword" groups="users"/>
<authenticationUser username="guest" password="guestPassword" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="system" password="systemPassword" groups="users,admins"/>
<authenticationUser username="user" password="userPassword" groups="users"/>
<authenticationUser username="guest" password="guestPassword" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
@ -63,18 +63,18 @@
<authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
<authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
<authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
<authorizationEntry queue="TEST.Q" read="guests" write="guests" />
<authorizationEntry topic=">" read="admins" write="admins" admin="admins" />
<authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
<authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
<authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
</authorizationEntries>
<tempDestinationAuthorizationEntry>
<tempDestinationAuthorizationEntry>
<tempDestinationAuthorizationEntry read="admins" write="admins" admin="admins"/>
</tempDestinationAuthorizationEntry>
</tempDestinationAuthorizationEntry>
</authorizationMap>
</map>
</authorizationPlugin>