[AMQP-99] AmqpBrokerAdminIntegrationTests failing with new rabbit server (2.3.1)
This commit is contained in:
@@ -66,6 +66,7 @@ import org.springframework.util.exec.Os;
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @author Dave Syer
|
||||
* @author Helena Edelson
|
||||
*/
|
||||
public class RabbitBrokerAdmin implements RabbitBrokerOperations {
|
||||
|
||||
@@ -231,24 +232,24 @@ public class RabbitBrokerAdmin implements RabbitBrokerOperations {
|
||||
@ManagedOperation()
|
||||
public void addUser(String username, String password) {
|
||||
erlangTemplate
|
||||
.executeAndConvertRpc("rabbit_access_control", "add_user", getBytes(username), getBytes(password));
|
||||
.executeAndConvertRpc("rabbit_auth_backend_internal", "add_user", getBytes(username), getBytes(password));
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public void deleteUser(String username) {
|
||||
erlangTemplate.executeAndConvertRpc("rabbit_access_control", "delete_user", getBytes(username));
|
||||
erlangTemplate.executeAndConvertRpc("rabbit_auth_backend_internal", "delete_user", getBytes(username));
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public void changeUserPassword(String username, String newPassword) {
|
||||
erlangTemplate.executeAndConvertRpc("rabbit_access_control", "change_password", getBytes(username),
|
||||
erlangTemplate.executeAndConvertRpc("rabbit_auth_backend_internal", "change_password", getBytes(username),
|
||||
getBytes(newPassword));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ManagedOperation
|
||||
public List<String> listUsers() {
|
||||
return (List<String>) erlangTemplate.executeAndConvertRpc("rabbit_access_control", "list_users");
|
||||
return (List<String>) erlangTemplate.executeAndConvertRpc("rabbit_auth_backend_internal", "list_users");
|
||||
}
|
||||
|
||||
public int addVhost(String vhostPath) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.ericsson.otp.erlang.OtpErlangTuple;
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @author Mark Fisher
|
||||
* @author Helena Edelson
|
||||
*/
|
||||
public class RabbitControlErlangConverter extends SimpleErlangConverter implements ErlangConverter {
|
||||
|
||||
@@ -66,7 +67,7 @@ public class RabbitControlErlangConverter extends SimpleErlangConverter implemen
|
||||
}
|
||||
|
||||
protected void initializeConverterMap() {
|
||||
registerConverter("rabbit_access_control", "list_users", new ListUsersConverter());
|
||||
registerConverter("rabbit_auth_backend_internal", "list_users", new ListUsersConverter());
|
||||
registerConverter("rabbit", "status", new StatusConverter());
|
||||
registerConverter("rabbit_amqqueue", "info_all", new QueueInfoAllConverter());
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.exec.Os;
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @author Dave Syer
|
||||
* @author Helena Edelson
|
||||
*/
|
||||
public class RabbitBrokerAdminIntegrationTests {
|
||||
|
||||
@@ -54,6 +55,8 @@ public class RabbitBrokerAdminIntegrationTests {
|
||||
|
||||
private static RabbitBrokerAdmin brokerAdmin;
|
||||
|
||||
private static final String NODE_NAME = "spring@localhost";
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
panic.setBrokerAdmin(brokerAdmin);
|
||||
@@ -61,10 +64,9 @@ public class RabbitBrokerAdminIntegrationTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void start() throws Exception {
|
||||
brokerAdmin = new RabbitBrokerAdmin("spring@localhost", 15672);
|
||||
brokerAdmin.setRabbitLogBaseDirectory("target/rabbitmq/log");
|
||||
brokerAdmin.setRabbitMnesiaBaseDirectory("target/rabbitmq/mnesia");
|
||||
brokerAdmin.setStartupTimeout(10000L);
|
||||
brokerAdmin = new RabbitBrokerAdmin(NODE_NAME, 15672);
|
||||
brokerAdmin.setRabbitLogBaseDirectory("target/rabbitmq/log");
|
||||
brokerAdmin.setRabbitMnesiaBaseDirectory("target/rabbitmq/mnesia");
|
||||
brokerAdmin.startNode();
|
||||
}
|
||||
|
||||
@@ -117,18 +119,23 @@ public class RabbitBrokerAdminIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetQueues() throws Exception {
|
||||
ConnectionFactory connectionFactory = new SingleConnectionFactory();
|
||||
new RabbitAdmin(connectionFactory).declareQueue(new Queue("test.queue"));
|
||||
Queue queue = new RabbitAdmin(connectionFactory).declareQueue();
|
||||
assertEquals("/", connectionFactory.getVirtualHost());
|
||||
List<QueueInfo> queues = brokerAdmin.getQueues();
|
||||
assertEquals("test.queue", queues.get(0).getName());
|
||||
assertEquals(queue.getName(), queues.get(0).getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the named-node is running.
|
||||
* @param status
|
||||
*/
|
||||
private void assertBrokerAppRunning(RabbitStatus status) {
|
||||
assertEquals(1, status.getRunningNodes().size());
|
||||
assertTrue(status.getRunningNodes().get(0).getName().contains("spring@localhost"));
|
||||
assertTrue(status.getRunningNodes().get(0).getName().contains(NODE_NAME));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user