Example usage for com.rabbitmq.client ConnectionFactory getUsername

List of usage examples for com.rabbitmq.client ConnectionFactory getUsername

Introduction

In this page you can find the example usage for com.rabbitmq.client ConnectionFactory getUsername.

Prototype

public String getUsername() 

Source Link

Document

Retrieve the user name.

Usage

From source file:org.teksme.server.common.messaging.AMQPBrokerManager.java

License:Apache License

private void toString(ConnectionFactory connFactory) {
    logger.info("[ Username: " + connFactory.getUsername() + " | Password: ****** | Virtual Host: "
            + connFactory.getVirtualHost() + " | Host: " + connFactory.getHost() + " | Port: "
            + connFactory.getPort() + " ]");
}

From source file:zipkin2.autoconfigure.collector.rabbitmq.ZipkinRabbitMQCollectorPropertiesTest.java

License:Apache License

@Test
public void uriProperlyParsedAndIgnoresOtherProperties_whenUriSet() throws Exception {
    properties.setUri(URI.create("amqp://admin:admin@localhost:5678/myv"));
    properties.setAddresses(Collections.singletonList("will_not^work!"));
    properties.setUsername("bob");
    properties.setPassword("letmein");
    properties.setVirtualHost("drwho");

    assertThat(properties.toBuilder()).extracting("connectionFactory").allSatisfy(object -> {
        ConnectionFactory connFactory = (ConnectionFactory) object;
        assertThat(connFactory.getHost()).isEqualTo("localhost");
        assertThat(connFactory.getPort()).isEqualTo(5678);
        assertThat(connFactory.getUsername()).isEqualTo("admin");
        assertThat(connFactory.getPassword()).isEqualTo("admin");
        assertThat(connFactory.getVirtualHost()).isEqualTo("myv");
    });//from  w  w w . j  a v a  2s .  c o m
}