@Test void fromShouldThrowWhenURIIsEmpty() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.addProperty("uri", ""); assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration)) .isInstanceOf(IllegalStateException.class) .hasMessage("You need to specify the URI of RabbitMQ"); }
public static RabbitMQConfiguration from(Configuration configuration) { String uriAsString = configuration.getString(URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ"); URI amqpUri = checkURI(uriAsString); String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ"); URI managementUri = checkURI(managementUriAsString); ManagementCredentials managementCredentials = ManagementCredentials.from(configuration); return builder() .amqpUri(amqpUri) .managementUri(managementUri) .managementCredentials(managementCredentials) .build(); }
RabbitMQConfiguration { public static RabbitMQConfiguration from(Configuration configuration) { String uriAsString = configuration.getString(URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ"); URI amqpUri = checkURI(uriAsString); String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ"); URI managementUri = checkURI(managementUriAsString); ManagementCredentials managementCredentials = ManagementCredentials.from(configuration); return builder() .amqpUri(amqpUri) .managementUri(managementUri) .managementCredentials(managementCredentials) .build(); } }
RabbitMQConfiguration { public static RabbitMQConfiguration from(Configuration configuration) { String uriAsString = configuration.getString(URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ"); URI amqpUri = checkURI(uriAsString); String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ"); URI managementUri = checkURI(managementUriAsString); ManagementCredentials managementCredentials = ManagementCredentials.from(configuration); return builder() .amqpUri(amqpUri) .managementUri(managementUri) .managementCredentials(managementCredentials) .build(); } private  RabbitMQConfiguration(URI uri, URI managementUri, ManagementCredentials managementCredentials, int maxRetries, int minDelayInMs,
                                  int connectionTimeoutInMs, int channelRpcTimeoutInMs, int handshakeTimeoutInMs, int shutdownTimeoutInMs, int networkRecoveryIntervalInMs); }
RabbitMQConfiguration { public static RabbitMQConfiguration from(Configuration configuration) { String uriAsString = configuration.getString(URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ"); URI amqpUri = checkURI(uriAsString); String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ"); URI managementUri = checkURI(managementUriAsString); ManagementCredentials managementCredentials = ManagementCredentials.from(configuration); return builder() .amqpUri(amqpUri) .managementUri(managementUri) .managementCredentials(managementCredentials) .build(); } private  RabbitMQConfiguration(URI uri, URI managementUri, ManagementCredentials managementCredentials, int maxRetries, int minDelayInMs,
                                  int connectionTimeoutInMs, int channelRpcTimeoutInMs, int handshakeTimeoutInMs, int shutdownTimeoutInMs, int networkRecoveryIntervalInMs); static RequireAmqpUri builder(); static RabbitMQConfiguration from(Configuration configuration); URI getUri(); URI getManagementUri(); int getMaxRetries(); int getMinDelayInMs(); int getConnectionTimeoutInMs(); int getChannelRpcTimeoutInMs(); int getHandshakeTimeoutInMs(); int getShutdownTimeoutInMs(); int getNetworkRecoveryIntervalInMs(); ManagementCredentials getManagementCredentials(); @Override final boolean equals(Object o); @Override final int hashCode(); }
RabbitMQConfiguration { public static RabbitMQConfiguration from(Configuration configuration) { String uriAsString = configuration.getString(URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ"); URI amqpUri = checkURI(uriAsString); String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME); Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ"); URI managementUri = checkURI(managementUriAsString); ManagementCredentials managementCredentials = ManagementCredentials.from(configuration); return builder() .amqpUri(amqpUri) .managementUri(managementUri) .managementCredentials(managementCredentials) .build(); } private  RabbitMQConfiguration(URI uri, URI managementUri, ManagementCredentials managementCredentials, int maxRetries, int minDelayInMs,
                                  int connectionTimeoutInMs, int channelRpcTimeoutInMs, int handshakeTimeoutInMs, int shutdownTimeoutInMs, int networkRecoveryIntervalInMs); static RequireAmqpUri builder(); static RabbitMQConfiguration from(Configuration configuration); URI getUri(); URI getManagementUri(); int getMaxRetries(); int getMinDelayInMs(); int getConnectionTimeoutInMs(); int getChannelRpcTimeoutInMs(); int getHandshakeTimeoutInMs(); int getShutdownTimeoutInMs(); int getNetworkRecoveryIntervalInMs(); ManagementCredentials getManagementCredentials(); @Override final boolean equals(Object o); @Override final int hashCode();  }