jeantil commented on code in PR #1409:
URL: https://github.com/apache/james-project/pull/1409#discussion_r1095456676
##########
backends-common/pulsar/src/test/java/org/apache/james/backends/pulsar/PulsarConfigurationTest.java:
##########
@@ -155,8 +158,106 @@ void
fromShouldReturnTheConfigurationWhenRequiredParametersAreGiven() {
configuration.addProperty("namespace", namespace);
assertThat(PulsarConfiguration.from(configuration))
- .isEqualTo(new PulsarConfiguration(brokerUri, adminUri, new
Namespace(namespace)));
+ .isEqualTo(new PulsarConfiguration(brokerUri, adminUri, new
Namespace(namespace), Auth.noAuth()));
}
+ @Test
+ void fromShouldThrowWithTokenAuthenticationWhenTokenIsMissing() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ String brokerUri = "pulsar://localhost.test:6650/";
+ String adminUri = "http://localhost:8090";
+ String authenticationType = "token";
+
+ configuration.addProperty("broker.uri", brokerUri);
+ configuration.addProperty("admin.uri", adminUri);
+ configuration.addProperty("authentication.type", authenticationType);
+
+ String namespace = "namespace";
+
+ configuration.addProperty("namespace", namespace);
+ assertThatThrownBy(() -> PulsarConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify a non-empty value for " +
PulsarConfiguration.AUTHENTICATION_TOKEN_PROPERTY_NAME());
+ }
+ @Test
+ void
fromShouldReturnTheConfigurationWithTokenAuthenticationWhenRequiredParametersAreGiven()
{
Review Comment:
I updated the tests, added the blank lines and added the missing tests
##########
backends-common/pulsar/src/test/java/org/apache/james/backends/pulsar/PulsarConfigurationTest.java:
##########
@@ -155,8 +158,106 @@ void
fromShouldReturnTheConfigurationWhenRequiredParametersAreGiven() {
configuration.addProperty("namespace", namespace);
assertThat(PulsarConfiguration.from(configuration))
- .isEqualTo(new PulsarConfiguration(brokerUri, adminUri, new
Namespace(namespace)));
+ .isEqualTo(new PulsarConfiguration(brokerUri, adminUri, new
Namespace(namespace), Auth.noAuth()));
}
+ @Test
+ void fromShouldThrowWithTokenAuthenticationWhenTokenIsMissing() {
Review Comment:
fixedup
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]