DATACASS-834 - Default to datacenter1 in AbstractSessionConfiguration.getLocalDataCenter.

Align with Cassandra defaults when starting a new server. Also, improve Javadoc explaining when the localDataCenter setting is required.
This commit is contained in:
Mark Paluch
2020-12-07 14:41:29 +01:00
parent 836025451d
commit d7f42f15b3
3 changed files with 5 additions and 13 deletions

View File

@@ -90,7 +90,7 @@ public abstract class AbstractSessionConfiguration implements BeanFactoryAware {
/**
* Gets a required bean of the provided {@link Class type} from the {@link BeanFactory}.
*
* @param <T> {@link Class parameterized clas type} of the bean.
* @param <T> {@link Class parameterized class type} of the bean.
* @param beanType {@link Class type} of the bean.
* @return a required bean of the given {@link Class type} from the {@link BeanFactory}.
* @see org.springframework.beans.factory.BeanFactory#getBean(Class)
@@ -122,13 +122,14 @@ public abstract class AbstractSessionConfiguration implements BeanFactoryAware {
/**
* Returns the local data center name used for
* {@link com.datastax.oss.driver.api.core.loadbalancing.LoadBalancingPolicy}.
* {@link com.datastax.oss.driver.api.core.loadbalancing.LoadBalancingPolicy}, defaulting to {@code datacenter1}.
* Typically required when connecting a Cassandra cluster. Not required when using an Astra connection bundle.
*
* @return the local data center name.
* @return the local data center name. Can be {@literal null} when using an Astra connection bundle.
*/
@Nullable
protected String getLocalDataCenter() {
return null;
return "datacenter1";
}
/**

View File

@@ -46,11 +46,6 @@ public class CqlTemplateConfigIntegrationTests extends AbstractEmbeddedCassandra
return "system";
}
@Override
protected String getLocalDataCenter() {
return "datacenter1";
}
@Override
protected int getPort() {
return cassandraEnvironment.getPort();

View File

@@ -34,8 +34,4 @@ public abstract class AbstractTestJavaConfig extends AbstractSessionConfiguratio
return PROPERTIES.getCassandraPort();
}
@Override
protected String getLocalDataCenter() {
return "datacenter1";
}
}