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 8f3a262e54
commit 49f75ab268
4 changed files with 6 additions and 20 deletions

View File

@@ -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";
}
/**

View File

@@ -68,12 +68,6 @@ class AbstractSessionConfigurationIntegrationTests {
return "system";
}
@Nullable
@Override
protected String getLocalDataCenter() {
return "datacenter1";
}
@Override
protected int getPort() {
return new CassandraConnectionProperties().getCassandraPort();

View File

@@ -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();

View File

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