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:
@@ -93,7 +93,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)
|
||||
@@ -125,13 +125,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";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,12 +68,6 @@ class AbstractSessionConfigurationIntegrationTests {
|
||||
return "system";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getLocalDataCenter() {
|
||||
return "datacenter1";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPort() {
|
||||
return new CassandraConnectionProperties().getCassandraPort();
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.cassandra.core.cql.CqlTemplate;
|
||||
import org.springframework.data.cassandra.test.util.IntegrationTestsSupport;
|
||||
import org.springframework.data.cassandra.test.util.CassandraExtension;
|
||||
import org.springframework.data.cassandra.test.util.IntegrationTestsSupport;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
|
||||
@@ -47,11 +47,6 @@ class CqlTemplateConfigIntegrationTests extends IntegrationTestsSupport {
|
||||
return "system";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLocalDataCenter() {
|
||||
return "datacenter1";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPort() {
|
||||
return CassandraExtension.getResources().getPort();
|
||||
|
||||
@@ -34,8 +34,4 @@ public abstract class AbstractTestJavaConfig extends AbstractSessionConfiguratio
|
||||
return PROPERTIES.getCassandraPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLocalDataCenter() {
|
||||
return "datacenter1";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user