Arsnael commented on code in PR #1409:
URL: https://github.com/apache/james-project/pull/1409#discussion_r1088646670
##########
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:
Confused with the name of the test, as it seems it's basic auth and not
token auth that is being tested here
Also a blank line between each test would help visibility :)
##########
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:
I don't see the test that it returns successfully the conf if token auth
params are valid
--
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]