DATACASS-263 - Fix authentication configuration in CassandraCqlClusterFactoryBean.
Configuring username/password authentication does no longer require setting of an AuthProvider which would be overwritten by the username/password authenticator.
This commit is contained in:
@@ -173,27 +173,31 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-226
|
||||
* @see DATACASS-263
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void doesNotSetPlainTextAuthenticationUnlessAuthProviderIsSet() throws Exception {
|
||||
public void shouldSetAuthenticationProvider() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
bean.setUsername("user");
|
||||
bean.setPassword("password");
|
||||
bean.afterPropertiesSet();
|
||||
|
||||
AuthProvider result = getConfiguration(bean).getProtocolOptions().getAuthProvider();
|
||||
assertThat(result, is(AuthProvider.NONE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldSetAuthentication() throws Exception {
|
||||
|
||||
PlainTextAuthProvider authProvider = new PlainTextAuthProvider("x", "y");
|
||||
AuthProvider authProvider = new PlainTextAuthProvider("x", "y");
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
bean.setAuthProvider(authProvider);
|
||||
bean.afterPropertiesSet();
|
||||
|
||||
AuthProvider result = getConfiguration(bean).getProtocolOptions().getAuthProvider();
|
||||
assertThat(result, is(equalTo(authProvider)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-226
|
||||
* @see DATACASS-263
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void shouldSetAuthentication() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
bean.setUsername("user");
|
||||
bean.setPassword("password");
|
||||
bean.afterPropertiesSet();
|
||||
|
||||
Reference in New Issue
Block a user