This is an automated email from the ASF dual-hosted git repository.
ycai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-sidecar.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2dcbca6 CASSANDRASC-103 Automated yaml type binding for
deserialization
2dcbca6 is described below
commit 2dcbca66a9f6a1e6b7cf4bd2c4f1368cc2ede86a
Author: Yifan Cai <[email protected]>
AuthorDate: Sat Feb 10 20:13:13 2024 -0800
CASSANDRASC-103 Automated yaml type binding for deserialization
patch by Yifan Cai; reviewed by Francisco Guerrero for CASSANDRASC-103
---
CHANGES.txt | 1 +
spotbugs-exclude.xml | 5 +
.../CassandraInputValidationConfigurationImpl.java | 20 ++--
.../config/yaml/HealthCheckConfigurationImpl.java | 6 +-
.../config/yaml/KeyStoreConfigurationImpl.java | 8 +-
.../config/yaml/RestoreJobConfigurationImpl.java | 20 ++--
.../config/yaml/S3ClientConfigurationImpl.java | 12 +--
.../yaml/SSTableImportConfigurationImpl.java | 4 +-
.../yaml/SSTableUploadConfigurationImpl.java | 8 +-
.../yaml/SchemaKeyspaceConfigurationImpl.java | 16 +--
.../config/yaml/ServiceConfigurationImpl.java | 32 +++---
.../config/yaml/SidecarConfigurationImpl.java | 111 ++++++++++++---------
.../sidecar/config/yaml/SslConfigurationImpl.java | 12 +--
.../config/yaml/ThrottleConfigurationImpl.java | 12 +--
.../yaml/TrafficShapingConfigurationImpl.java | 26 +++--
.../sidecar/config/SidecarConfigurationTest.java | 16 +++
... => sidecar_schema_keyspace_configuration.yaml} | 5 +
.../resources/config/sidecar_single_instance.yaml | 5 +
18 files changed, 182 insertions(+), 137 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 43b7652..c12d3ca 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
1.0.0
-----
+ * Automated yaml type binding for deserialization (CASSANDRASC-103)
* Upgrade Vert.x version in Sidecar to 4.5 (CASSANDRASC-101)
* Break restore job into stage and import phases and persist restore slice
status on phase completion (CASSANDRASC-99)
* Improve logging for traffic shaping / rate limiting configuration
(CASSANDRASC-98)
diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
index 03be65c..75f0517 100644
--- a/spotbugs-exclude.xml
+++ b/spotbugs-exclude.xml
@@ -85,4 +85,9 @@
<Class name="org.apache.cassandra.sidecar.common.ResourceUtils" />
</Match>
+ <Match>
+ <Bug pattern="UWF_UNWRITTEN_FIELD" />
+ <Class
name="org.apache.cassandra.sidecar.config.yaml.DriverConfigurationImpl" />
+ </Match>
+
</FindBugsFilter>
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/CassandraInputValidationConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/CassandraInputValidationConfigurationImpl.java
index b382a58..1538fac 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/CassandraInputValidationConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/CassandraInputValidationConfigurationImpl.java
@@ -55,18 +55,16 @@ public class CassandraInputValidationConfigurationImpl
implements CassandraInput
@JsonProperty(FORBIDDEN_KEYSPACES_PROPERTY)
protected final Set<String> forbiddenKeyspaces;
- @JsonProperty(value = ALLOWED_CHARS_FOR_NAME_PROPERTY, defaultValue =
DEFAULT_ALLOWED_CHARS_FOR_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_NAME_PROPERTY)
protected final String allowedPatternForName;
- @JsonProperty(value = ALLOWED_CHARS_FOR_QUOTED_NAME_PROPERTY, defaultValue
= DEFAULT_ALLOWED_CHARS_FOR_QUOTED_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_QUOTED_NAME_PROPERTY)
protected final String allowedPatternForQuotedName;
- @JsonProperty(value = ALLOWED_CHARS_FOR_COMPONENT_NAME_PROPERTY,
- defaultValue = DEFAULT_ALLOWED_CHARS_FOR_COMPONENT_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_COMPONENT_NAME_PROPERTY)
protected final String allowedPatternForComponentName;
- @JsonProperty(value = ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME_PROPERTY,
- defaultValue = DEFAULT_ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME_PROPERTY)
protected final String allowedPatternForRestrictedComponentName;
public CassandraInputValidationConfigurationImpl()
@@ -105,7 +103,7 @@ public class CassandraInputValidationConfigurationImpl
implements CassandraInput
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ALLOWED_CHARS_FOR_NAME_PROPERTY, defaultValue =
DEFAULT_ALLOWED_CHARS_FOR_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_NAME_PROPERTY)
public String allowedPatternForName()
{
return allowedPatternForName;
@@ -115,7 +113,7 @@ public class CassandraInputValidationConfigurationImpl
implements CassandraInput
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ALLOWED_CHARS_FOR_QUOTED_NAME_PROPERTY, defaultValue
= DEFAULT_ALLOWED_CHARS_FOR_QUOTED_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_QUOTED_NAME_PROPERTY)
public String allowedPatternForQuotedName()
{
return allowedPatternForQuotedName;
@@ -125,8 +123,7 @@ public class CassandraInputValidationConfigurationImpl
implements CassandraInput
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ALLOWED_CHARS_FOR_COMPONENT_NAME_PROPERTY,
- defaultValue = DEFAULT_ALLOWED_CHARS_FOR_COMPONENT_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_COMPONENT_NAME_PROPERTY)
public String allowedPatternForComponentName()
{
return allowedPatternForComponentName;
@@ -136,8 +133,7 @@ public class CassandraInputValidationConfigurationImpl
implements CassandraInput
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME_PROPERTY,
- defaultValue = DEFAULT_ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME)
+ @JsonProperty(value = ALLOWED_CHARS_FOR_RESTRICTED_COMPONENT_NAME_PROPERTY)
public String allowedPatternForRestrictedComponentName()
{
return allowedPatternForRestrictedComponentName;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/HealthCheckConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/HealthCheckConfigurationImpl.java
index 2298bb5..47c7fb8 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/HealthCheckConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/HealthCheckConfigurationImpl.java
@@ -33,10 +33,10 @@ public class HealthCheckConfigurationImpl implements
HealthCheckConfiguration
public static final String POLL_FREQ_MILLIS_PROPERTY = "poll_freq_millis";
public static final int DEFAULT_CHECK_INTERVAL_MILLIS = 30000;
- @JsonProperty(value = INITIAL_DELAY_MILLIS_PROPERTY, defaultValue =
DEFAULT_INITIAL_DELAY_MILLIS + "")
+ @JsonProperty(value = INITIAL_DELAY_MILLIS_PROPERTY)
protected final int initialDelayMillis;
- @JsonProperty(value = POLL_FREQ_MILLIS_PROPERTY, defaultValue =
DEFAULT_CHECK_INTERVAL_MILLIS + "")
+ @JsonProperty(value = POLL_FREQ_MILLIS_PROPERTY)
protected final int checkIntervalMillis;
public HealthCheckConfigurationImpl()
@@ -64,7 +64,7 @@ public class HealthCheckConfigurationImpl implements
HealthCheckConfiguration
* @return the interval, in milliseconds, in which the health checks will
be performed
*/
@Override
- @JsonProperty(value = POLL_FREQ_MILLIS_PROPERTY, defaultValue =
DEFAULT_CHECK_INTERVAL_MILLIS + "")
+ @JsonProperty(value = POLL_FREQ_MILLIS_PROPERTY)
public int checkIntervalMillis()
{
return checkIntervalMillis;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/KeyStoreConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/KeyStoreConfigurationImpl.java
index 84a5fcb..bd2b350 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/KeyStoreConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/KeyStoreConfigurationImpl.java
@@ -32,10 +32,10 @@ public class KeyStoreConfigurationImpl implements
KeyStoreConfiguration
@JsonProperty("password")
protected final String password;
- @JsonProperty(value = "type", defaultValue = DEFAULT_TYPE)
+ @JsonProperty(value = "type")
protected final String type;
- @JsonProperty(value = "check_interval_sec", defaultValue =
DEFAULT_CHECK_INTERVAL_SECONDS + "")
+ @JsonProperty(value = "check_interval_sec")
protected final int checkIntervalInSeconds;
public KeyStoreConfigurationImpl()
@@ -80,7 +80,7 @@ public class KeyStoreConfigurationImpl implements
KeyStoreConfiguration
* @return the type of the store
*/
@Override
- @JsonProperty(value = "type", defaultValue = DEFAULT_TYPE)
+ @JsonProperty(value = "type")
public String type()
{
return type;
@@ -90,7 +90,7 @@ public class KeyStoreConfigurationImpl implements
KeyStoreConfiguration
* @return the interval, in seconds, in which the key store will be
checked for changes in the filesystem
*/
@Override
- @JsonProperty(value = "check_interval_sec", defaultValue =
DEFAULT_CHECK_INTERVAL_SECONDS + "")
+ @JsonProperty(value = "check_interval_sec")
public int checkIntervalInSeconds()
{
return checkIntervalInSeconds;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/RestoreJobConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/RestoreJobConfigurationImpl.java
index 9ce5efb..3e00311 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/RestoreJobConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/RestoreJobConfigurationImpl.java
@@ -37,19 +37,19 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
public static final int DEFAULT_PROCESS_MAX_CONCURRENCY = 20; // process
at most 20 slices concurrently
public static final long DEFAULT_RESTORE_JOB_TABLES_TTL_SECONDS =
TimeUnit.DAYS.toSeconds(90);
- @JsonProperty(value = "job_discovery_active_loop_delay_millis",
defaultValue = "5")
+ @JsonProperty(value = "job_discovery_active_loop_delay_millis")
protected final long jobDiscoveryActiveLoopDelayMillis;
- @JsonProperty(value = "job_discovery_idle_loop_delay_millis", defaultValue
= "10")
+ @JsonProperty(value = "job_discovery_idle_loop_delay_millis")
protected final long jobDiscoveryIdleLoopDelayMillis;
- @JsonProperty(value = "job_discovery_recency_days", defaultValue = "5")
+ @JsonProperty(value = "job_discovery_recency_days")
protected final int jobDiscoveryRecencyDays;
- @JsonProperty(value = "slice_process_max_concurrency", defaultValue = "20")
+ @JsonProperty(value = "slice_process_max_concurrency")
protected final int processMaxConcurrency;
- @JsonProperty(value = "restore_job_tables_ttl_seconds", defaultValue =
"90")
+ @JsonProperty(value = "restore_job_tables_ttl_seconds")
protected final long restoreJobTablesTtlSeconds;
protected RestoreJobConfigurationImpl()
@@ -86,7 +86,7 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "job_discovery_active_loop_delay_millis",
defaultValue = "5")
+ @JsonProperty(value = "job_discovery_active_loop_delay_millis")
public long jobDiscoveryActiveLoopDelayMillis()
{
return jobDiscoveryActiveLoopDelayMillis;
@@ -96,7 +96,7 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "job_discovery_idle_loop_delay_millis", defaultValue
= "10")
+ @JsonProperty(value = "job_discovery_idle_loop_delay_millis")
public long jobDiscoveryIdleLoopDelayMillis()
{
return jobDiscoveryActiveLoopDelayMillis;
@@ -106,7 +106,7 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "job_discovery_recency_days", defaultValue = "5")
+ @JsonProperty(value = "job_discovery_recency_days")
public int jobDiscoveryRecencyDays()
{
return jobDiscoveryRecencyDays;
@@ -116,7 +116,7 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "slice_process_max_concurrency", defaultValue = "20")
+ @JsonProperty(value = "slice_process_max_concurrency")
public int processMaxConcurrency()
{
return processMaxConcurrency;
@@ -126,7 +126,7 @@ public class RestoreJobConfigurationImpl implements
RestoreJobConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "restore_job_tables_ttl_seconds", defaultValue =
"90")
+ @JsonProperty(value = "restore_job_tables_ttl_seconds")
public long restoreJobTablesTtlSeconds()
{
return restoreJobTablesTtlSeconds;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/S3ClientConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/S3ClientConfigurationImpl.java
index 2f3ba4f..d5bf576 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/S3ClientConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/S3ClientConfigurationImpl.java
@@ -34,13 +34,13 @@ public class S3ClientConfigurationImpl implements
S3ClientConfiguration
public static final long DEFAULT_THREAD_KEEP_ALIVE_SECONDS = 60;
public static final int DEFAULT_S3_CLIENT_CONCURRENCY = 4;
- @JsonProperty(value = "thread_name_prefix", defaultValue = "s3-client")
+ @JsonProperty(value = "thread_name_prefix")
protected final String threadNamePrefix;
- @JsonProperty(value = "concurrency", defaultValue = "4")
+ @JsonProperty(value = "concurrency")
protected final int concurrency;
- @JsonProperty(value = "thread_keep_alive_seconds", defaultValue = "60")
+ @JsonProperty(value = "thread_keep_alive_seconds")
protected final long threadKeepAliveSeconds;
@JsonProperty(value = PROXY_PROPERTY)
@@ -70,7 +70,7 @@ public class S3ClientConfigurationImpl implements
S3ClientConfiguration
*/
@NotNull
@Override
- @JsonProperty(value = "thread_name_prefix", defaultValue = "s3-client")
+ @JsonProperty(value = "thread_name_prefix")
public String threadNamePrefix()
{
return threadNamePrefix;
@@ -80,7 +80,7 @@ public class S3ClientConfigurationImpl implements
S3ClientConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "concurrency", defaultValue = "4")
+ @JsonProperty(value = "concurrency")
public int concurrency()
{
return concurrency;
@@ -90,7 +90,7 @@ public class S3ClientConfigurationImpl implements
S3ClientConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "thread_keep_alive_seconds", defaultValue = "60")
+ @JsonProperty(value = "thread_keep_alive_seconds")
public long threadKeepAliveSeconds()
{
return threadKeepAliveSeconds;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableImportConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableImportConfigurationImpl.java
index c82d09d..523978d 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableImportConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableImportConfigurationImpl.java
@@ -35,7 +35,7 @@ public class SSTableImportConfigurationImpl implements
SSTableImportConfiguratio
protected static final CacheConfiguration DEFAULT_CACHE_CONFIGURATION =
new CacheConfigurationImpl(TimeUnit.HOURS.toMillis(2), 10_000);
- @JsonProperty(value = POLL_INTERVAL_MILLIS_PROPERTY, defaultValue =
DEFAULT_POLL_INTERVAL_MILLIS + "")
+ @JsonProperty(value = POLL_INTERVAL_MILLIS_PROPERTY)
protected final int importIntervalMillis;
@JsonProperty(value = CACHE_PROPERTY)
@@ -67,7 +67,7 @@ public class SSTableImportConfigurationImpl implements
SSTableImportConfiguratio
* @return the interval in milliseconds in which the SSTable Importer will
process pending imports
*/
@Override
- @JsonProperty(value = POLL_INTERVAL_MILLIS_PROPERTY, defaultValue =
DEFAULT_POLL_INTERVAL_MILLIS + "")
+ @JsonProperty(value = POLL_INTERVAL_MILLIS_PROPERTY)
public int importIntervalMillis()
{
return importIntervalMillis;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableUploadConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableUploadConfigurationImpl.java
index 68a8a45..2f69352 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableUploadConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SSTableUploadConfigurationImpl.java
@@ -37,10 +37,10 @@ public class SSTableUploadConfigurationImpl implements
SSTableUploadConfiguratio
public static final String FILE_PERMISSIONS_PROPERTY = "file_permissions";
public static final String DEFAULT_FILE_PERMISSIONS = "rw-r--r--";
- @JsonProperty(value = CONCURRENT_UPLOAD_LIMIT_PROPERTY, defaultValue =
DEFAULT_CONCURRENT_UPLOAD_LIMIT + "")
+ @JsonProperty(value = CONCURRENT_UPLOAD_LIMIT_PROPERTY)
protected final int concurrentUploadsLimit;
- @JsonProperty(value = MIN_FREE_SPACE_PERCENT_PROPERTY, defaultValue =
DEFAULT_MIN_FREE_SPACE_PERCENT + "")
+ @JsonProperty(value = MIN_FREE_SPACE_PERCENT_PROPERTY)
protected final float minimumSpacePercentageRequired;
protected String filePermissions;
@@ -78,7 +78,7 @@ public class SSTableUploadConfigurationImpl implements
SSTableUploadConfiguratio
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = CONCURRENT_UPLOAD_LIMIT_PROPERTY, defaultValue =
DEFAULT_CONCURRENT_UPLOAD_LIMIT + "")
+ @JsonProperty(value = CONCURRENT_UPLOAD_LIMIT_PROPERTY)
public int concurrentUploadsLimit()
{
return concurrentUploadsLimit;
@@ -88,7 +88,7 @@ public class SSTableUploadConfigurationImpl implements
SSTableUploadConfiguratio
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = MIN_FREE_SPACE_PERCENT_PROPERTY, defaultValue =
DEFAULT_MIN_FREE_SPACE_PERCENT + "")
+ @JsonProperty(value = MIN_FREE_SPACE_PERCENT_PROPERTY)
public float minimumSpacePercentageRequired()
{
return minimumSpacePercentageRequired;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SchemaKeyspaceConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SchemaKeyspaceConfigurationImpl.java
index 12ef36f..9c7b611 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SchemaKeyspaceConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SchemaKeyspaceConfigurationImpl.java
@@ -32,16 +32,16 @@ public class SchemaKeyspaceConfigurationImpl implements
SchemaKeyspaceConfigurat
public static final String DEFAULT_REPLICATION_STRATEGY = "SimpleStrategy";
public static final int DEFAULT_REPLICATION_FACTOR = 1;
- @JsonProperty(value = "is_enabled", defaultValue = "false")
+ @JsonProperty(value = "is_enabled")
protected final boolean isEnabled;
- @JsonProperty(value = "keyspace", defaultValue = "sidecar_internal")
+ @JsonProperty(value = "keyspace")
protected final String keyspace;
- @JsonProperty(value = "replication_strategy", defaultValue =
"SimpleStrategy")
+ @JsonProperty(value = "replication_strategy")
protected final String replicationStrategy;
- @JsonProperty(value = "replication_factor", defaultValue = "1")
+ @JsonProperty(value = "replication_factor")
protected final int replicationFactor;
protected SchemaKeyspaceConfigurationImpl()
@@ -61,7 +61,7 @@ public class SchemaKeyspaceConfigurationImpl implements
SchemaKeyspaceConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "is_enabled", defaultValue = "false")
+ @JsonProperty(value = "is_enabled")
public boolean isEnabled()
{
return isEnabled;
@@ -71,7 +71,7 @@ public class SchemaKeyspaceConfigurationImpl implements
SchemaKeyspaceConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "keyspace", defaultValue = "sidecar_internal")
+ @JsonProperty(value = "keyspace")
public String keyspace()
{
return keyspace;
@@ -81,7 +81,7 @@ public class SchemaKeyspaceConfigurationImpl implements
SchemaKeyspaceConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "replication_strategy", defaultValue =
"SimpleStrategy")
+ @JsonProperty(value = "replication_strategy")
public String replicationStrategy()
{
return replicationStrategy;
@@ -91,7 +91,7 @@ public class SchemaKeyspaceConfigurationImpl implements
SchemaKeyspaceConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "replication_factor", defaultValue = "1")
+ @JsonProperty(value = "replication_factor")
public int replicationFactor()
{
return replicationFactor;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/ServiceConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/ServiceConfigurationImpl.java
index 4dccae4..3b38dca 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/ServiceConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/ServiceConfigurationImpl.java
@@ -97,16 +97,16 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
@JsonProperty(value = SERVER_VERTICLE_INSTANCES_PROPERTY, defaultValue =
DEFAULT_SERVER_VERTICLE_INSTANCES + "")
protected final int serverVerticleInstances;
- @JsonProperty(value = THROTTLE_PROPERTY, required = true)
+ @JsonProperty(value = THROTTLE_PROPERTY)
protected final ThrottleConfiguration throttleConfiguration;
- @JsonProperty(value = SSTABLE_UPLOAD_PROPERTY, required = true)
+ @JsonProperty(value = SSTABLE_UPLOAD_PROPERTY)
protected final SSTableUploadConfiguration ssTableUploadConfiguration;
- @JsonProperty(value = SSTABLE_IMPORT_PROPERTY, required = true)
+ @JsonProperty(value = SSTABLE_IMPORT_PROPERTY)
protected final SSTableImportConfiguration ssTableImportConfiguration;
- @JsonProperty(value = WORKER_POOLS_PROPERTY, required = true)
+ @JsonProperty(value = WORKER_POOLS_PROPERTY)
protected final Map<String, ? extends WorkerPoolConfiguration>
workerPoolsConfiguration;
@JsonProperty(value = JMX_PROPERTY)
@@ -154,7 +154,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = HOST_PROPERTY, defaultValue = DEFAULT_HOST)
+ @JsonProperty(value = HOST_PROPERTY)
public String host()
{
return host;
@@ -164,7 +164,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = PORT_PROPERTY, defaultValue = DEFAULT_PORT + "")
+ @JsonProperty(value = PORT_PROPERTY)
public int port()
{
return port;
@@ -174,7 +174,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = REQUEST_IDLE_TIMEOUT_MILLIS_PROPERTY, defaultValue =
DEFAULT_REQUEST_IDLE_TIMEOUT_MILLIS + "")
+ @JsonProperty(value = REQUEST_IDLE_TIMEOUT_MILLIS_PROPERTY)
public int requestIdleTimeoutMillis()
{
return requestIdleTimeoutMillis;
@@ -184,7 +184,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = REQUEST_TIMEOUT_MILLIS_PROPERTY, defaultValue =
DEFAULT_REQUEST_TIMEOUT_MILLIS + "")
+ @JsonProperty(value = REQUEST_TIMEOUT_MILLIS_PROPERTY)
public long requestTimeoutMillis()
{
return requestTimeoutMillis;
@@ -194,7 +194,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = TCP_KEEP_ALIVE_PROPERTY, defaultValue =
DEFAULT_TCP_KEEP_ALIVE + "")
+ @JsonProperty(value = TCP_KEEP_ALIVE_PROPERTY)
public boolean tcpKeepAlive()
{
return tcpKeepAlive;
@@ -204,7 +204,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ACCEPT_BACKLOG_PROPERTY, defaultValue =
DEFAULT_ACCEPT_BACKLOG + "")
+ @JsonProperty(value = ACCEPT_BACKLOG_PROPERTY)
public int acceptBacklog()
{
return acceptBacklog;
@@ -214,7 +214,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = ALLOWABLE_SKEW_IN_MINUTES_PROPERTY, defaultValue =
DEFAULT_ALLOWABLE_SKEW_IN_MINUTES + "")
+ @JsonProperty(value = ALLOWABLE_SKEW_IN_MINUTES_PROPERTY)
public int allowableSkewInMinutes()
{
return allowableSkewInMinutes;
@@ -224,7 +224,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = SERVER_VERTICLE_INSTANCES_PROPERTY, defaultValue =
DEFAULT_SERVER_VERTICLE_INSTANCES + "")
+ @JsonProperty(value = SERVER_VERTICLE_INSTANCES_PROPERTY)
public int serverVerticleInstances()
{
return serverVerticleInstances;
@@ -234,7 +234,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = THROTTLE_PROPERTY, required = true)
+ @JsonProperty(value = THROTTLE_PROPERTY)
public ThrottleConfiguration throttleConfiguration()
{
return throttleConfiguration;
@@ -244,7 +244,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = SSTABLE_UPLOAD_PROPERTY, required = true)
+ @JsonProperty(value = SSTABLE_UPLOAD_PROPERTY)
public SSTableUploadConfiguration ssTableUploadConfiguration()
{
return ssTableUploadConfiguration;
@@ -254,7 +254,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = SSTABLE_IMPORT_PROPERTY, required = true)
+ @JsonProperty(value = SSTABLE_IMPORT_PROPERTY)
public SSTableImportConfiguration ssTableImportConfiguration()
{
return ssTableImportConfiguration;
@@ -264,7 +264,7 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = WORKER_POOLS_PROPERTY, required = true)
+ @JsonProperty(value = WORKER_POOLS_PROPERTY)
public Map<String, ? extends WorkerPoolConfiguration>
workerPoolsConfiguration()
{
return workerPoolsConfiguration;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SidecarConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SidecarConfigurationImpl.java
index 697554c..d2c2ef4 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SidecarConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SidecarConfigurationImpl.java
@@ -24,7 +24,13 @@ import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.Sets;
+import com.google.common.reflect.ClassPath;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -32,23 +38,15 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import org.apache.cassandra.sidecar.common.DataObjectBuilder;
-import org.apache.cassandra.sidecar.config.CacheConfiguration;
import
org.apache.cassandra.sidecar.config.CassandraInputValidationConfiguration;
import org.apache.cassandra.sidecar.config.DriverConfiguration;
import org.apache.cassandra.sidecar.config.HealthCheckConfiguration;
import org.apache.cassandra.sidecar.config.InstanceConfiguration;
-import org.apache.cassandra.sidecar.config.JmxConfiguration;
-import org.apache.cassandra.sidecar.config.KeyStoreConfiguration;
import org.apache.cassandra.sidecar.config.RestoreJobConfiguration;
import org.apache.cassandra.sidecar.config.S3ClientConfiguration;
-import org.apache.cassandra.sidecar.config.SSTableImportConfiguration;
-import org.apache.cassandra.sidecar.config.SSTableUploadConfiguration;
import org.apache.cassandra.sidecar.config.ServiceConfiguration;
import org.apache.cassandra.sidecar.config.SidecarConfiguration;
import org.apache.cassandra.sidecar.config.SslConfiguration;
-import org.apache.cassandra.sidecar.config.ThrottleConfiguration;
-import org.apache.cassandra.sidecar.config.TrafficShapingConfiguration;
-import org.apache.cassandra.sidecar.config.WorkerPoolConfiguration;
/**
* Configuration for this Sidecar process
@@ -65,8 +63,9 @@ public class SidecarConfigurationImpl implements
SidecarConfiguration
@JsonProperty(value = "driver_parameters")
protected final DriverConfiguration driverConfiguration;
- @JsonProperty(value = "sidecar", required = true)
+ @JsonProperty(value = "sidecar")
protected final ServiceConfiguration serviceConfiguration;
+
@JsonProperty("ssl")
protected final SslConfiguration sslConfiguration;
@@ -211,51 +210,71 @@ public class SidecarConfigurationImpl implements
SidecarConfiguration
public static SidecarConfigurationImpl readYamlConfiguration(Path
yamlConfigurationPath) throws IOException
{
- SimpleModule simpleModule = new SimpleModule()
-
.addAbstractTypeMapping(CacheConfiguration.class,
-
CacheConfigurationImpl.class)
-
.addAbstractTypeMapping(CassandraInputValidationConfiguration.class,
-
CassandraInputValidationConfigurationImpl.class)
-
.addAbstractTypeMapping(HealthCheckConfiguration.class,
-
HealthCheckConfigurationImpl.class)
-
.addAbstractTypeMapping(InstanceConfiguration.class,
-
InstanceConfigurationImpl.class)
-
.addAbstractTypeMapping(KeyStoreConfiguration.class,
-
KeyStoreConfigurationImpl.class)
-
.addAbstractTypeMapping(SSTableImportConfiguration.class,
-
SSTableImportConfigurationImpl.class)
-
.addAbstractTypeMapping(SSTableUploadConfiguration.class,
-
SSTableUploadConfigurationImpl.class)
-
.addAbstractTypeMapping(ServiceConfiguration.class,
-
ServiceConfigurationImpl.class)
-
.addAbstractTypeMapping(SidecarConfiguration.class,
-
SidecarConfigurationImpl.class)
-
.addAbstractTypeMapping(SslConfiguration.class,
-
SslConfigurationImpl.class)
-
.addAbstractTypeMapping(ThrottleConfiguration.class,
-
ThrottleConfigurationImpl.class)
-
.addAbstractTypeMapping(WorkerPoolConfiguration.class,
-
WorkerPoolConfigurationImpl.class)
-
.addAbstractTypeMapping(JmxConfiguration.class,
-
JmxConfigurationImpl.class)
-
.addAbstractTypeMapping(TrafficShapingConfiguration.class,
-
TrafficShapingConfigurationImpl.class)
-
.addAbstractTypeMapping(DriverConfiguration.class,
-
DriverConfigurationImpl.class)
-
.addAbstractTypeMapping(RestoreJobConfiguration.class,
-
RestoreJobConfigurationImpl.class)
-
.addAbstractTypeMapping(S3ClientConfiguration.class,
-
S3ClientConfigurationImpl.class);
-
ObjectMapper mapper = new ObjectMapper(new YAMLFactory())
.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true)
.configure(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS, true)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
- .registerModule(simpleModule);
+ .registerModule(resolveYamlTypeMappings());
return mapper.readValue(yamlConfigurationPath.toFile(),
SidecarConfigurationImpl.class);
}
+ private static SimpleModule resolveYamlTypeMappings() throws IOException
+ {
+ String packageName =
SidecarConfigurationImpl.class.getPackage().getName();
+ String outerPackageName =
SidecarConfiguration.class.getPackage().getName();
+ SimpleModule module = new SimpleModule();
+ ClassPath path = ClassPath.from(ClassLoader.getSystemClassLoader());
+ Set<Class> declared = path.getTopLevelClasses(outerPackageName)
+ .stream()
+ .filter(c -> c.getName().endsWith("Configuration"))
+ .map(ClassPath.ClassInfo::load)
+ .collect(Collectors.toSet());
+ Set<Class> implemented = new HashSet<>();
+
ClassPath.from(ClassLoader.getSystemClassLoader()).getTopLevelClasses(packageName)
+ .stream()
+ .map(ClassPath.ClassInfo::load)
+ .forEach(clazz -> {
+ if (clazz.isInterface())
+ {
+ return;
+ }
+ // find the configuration interface it implements
+ // note: it assumes that the concrete implementation
implement one and only one
+ // configuration interface, and the name of the
configuration interface ends
+ // with "Configuration"
+ Class[] interfaces = clazz.getInterfaces();
+ Class configurationInterface = null;
+ for (Class c : interfaces)
+ {
+ if (c.getPackage().getName().equals(outerPackageName)
&& c.getName().endsWith("Configuration"))
+ {
+ configurationInterface = c;
+ if (!implemented.add(configurationInterface))
+ {
+ throw new IllegalStateException("Multiple
implementations found for " +
+ "configuration
interface: " + configurationInterface);
+ }
+ break;
+ }
+ }
+ // it does not implement any configuration interface
+ if (configurationInterface == null)
+ {
+ return;
+ }
+
+ module.addAbstractTypeMapping(configurationInterface,
clazz);
+ });
+
+ Set<Class> unimplemented = Sets.difference(declared, implemented);
+ if (!unimplemented.isEmpty())
+ {
+ throw new IllegalStateException("Found unimplemented configuration
class(es): " + unimplemented);
+ }
+ return module;
+ }
+
public static Builder builder()
{
return new Builder();
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SslConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SslConfigurationImpl.java
index 0239121..20b457d 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/SslConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/SslConfigurationImpl.java
@@ -46,10 +46,10 @@ public class SslConfigurationImpl implements
SslConfiguration
@JsonProperty("enabled")
protected final boolean enabled;
- @JsonProperty(value = "use_openssl", defaultValue = "true")
+ @JsonProperty(value = "use_openssl")
protected final boolean useOpenSsl;
- @JsonProperty(value = "handshake_timeout_sec", defaultValue = "10")
+ @JsonProperty(value = "handshake_timeout_sec")
protected final long handshakeTimeoutInSeconds;
protected String clientAuth;
@@ -97,7 +97,7 @@ public class SslConfigurationImpl implements SslConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "use_openssl", defaultValue = "true")
+ @JsonProperty(value = "use_openssl")
public boolean preferOpenSSL()
{
return useOpenSsl;
@@ -107,7 +107,7 @@ public class SslConfigurationImpl implements
SslConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "handshake_timeout_sec", defaultValue = "10")
+ @JsonProperty(value = "handshake_timeout_sec")
public long handshakeTimeoutInSeconds()
{
return handshakeTimeoutInSeconds;
@@ -117,13 +117,13 @@ public class SslConfigurationImpl implements
SslConfiguration
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "client_auth", defaultValue = "NONE")
+ @JsonProperty(value = "client_auth")
public String clientAuth()
{
return clientAuth;
}
- @JsonProperty(value = "client_auth", defaultValue = "NONE")
+ @JsonProperty(value = "client_auth")
public void setClientAuth(String clientAuth)
{
this.clientAuth = clientAuth;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/ThrottleConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/ThrottleConfigurationImpl.java
index b4b840f..24f45ce 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/ThrottleConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/ThrottleConfigurationImpl.java
@@ -33,11 +33,11 @@ public class ThrottleConfigurationImpl implements
ThrottleConfiguration
public static final String TIMEOUT_SEC_PROPERTY = "timeout_sec";
public static final String DELAY_SEC_PROPERTY = "delay_sec";
- @JsonProperty(value = STREAM_REQUESTS_PER_SEC_PROPERTY, defaultValue =
DEFAULT_STREAM_REQUESTS_PER_SEC + "")
+ @JsonProperty(value = STREAM_REQUESTS_PER_SEC_PROPERTY)
protected final long rateLimitStreamRequestsPerSecond;
- @JsonProperty(value = TIMEOUT_SEC_PROPERTY, defaultValue =
DEFAULT_TIMEOUT_SEC + "")
+ @JsonProperty(value = TIMEOUT_SEC_PROPERTY)
protected final long timeoutInSeconds;
- @JsonProperty(value = DELAY_SEC_PROPERTY, defaultValue = DEFAULT_DELAY_SEC
+ "")
+ @JsonProperty(value = DELAY_SEC_PROPERTY)
protected final long delayInSeconds;
public ThrottleConfigurationImpl()
@@ -64,21 +64,21 @@ public class ThrottleConfigurationImpl implements
ThrottleConfiguration
}
@Override
- @JsonProperty(value = STREAM_REQUESTS_PER_SEC_PROPERTY, defaultValue =
DEFAULT_STREAM_REQUESTS_PER_SEC + "")
+ @JsonProperty(value = STREAM_REQUESTS_PER_SEC_PROPERTY)
public long rateLimitStreamRequestsPerSecond()
{
return rateLimitStreamRequestsPerSecond;
}
@Override
- @JsonProperty(value = TIMEOUT_SEC_PROPERTY, defaultValue =
DEFAULT_TIMEOUT_SEC + "")
+ @JsonProperty(value = TIMEOUT_SEC_PROPERTY)
public long timeoutInSeconds()
{
return timeoutInSeconds;
}
@Override
- @JsonProperty(value = DELAY_SEC_PROPERTY, defaultValue = DEFAULT_DELAY_SEC
+ "")
+ @JsonProperty(value = DELAY_SEC_PROPERTY)
public long delayInSeconds()
{
return delayInSeconds;
diff --git
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/TrafficShapingConfigurationImpl.java
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/TrafficShapingConfigurationImpl.java
index f14573b..73d67e0 100644
---
a/src/main/java/org/apache/cassandra/sidecar/config/yaml/TrafficShapingConfigurationImpl.java
+++
b/src/main/java/org/apache/cassandra/sidecar/config/yaml/TrafficShapingConfigurationImpl.java
@@ -64,23 +64,22 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
*/
public static final long DEFAULT_INBOUND_FILE_GLOBAL_BANDWIDTH_LIMIT = 0;
- @JsonProperty(value = "inbound_global_bandwidth_bps", defaultValue = "0")
+ @JsonProperty(value = "inbound_global_bandwidth_bps")
protected final long inboundGlobalBandwidthBytesPerSecond;
- @JsonProperty(value = "outbound_global_bandwidth_bps", defaultValue = "0")
+ @JsonProperty(value = "outbound_global_bandwidth_bps")
protected final long outboundGlobalBandwidthBytesPerSecond;
- @JsonProperty(value = "peak_outbound_global_bandwidth_bps",
- defaultValue = DEFAULT_PEAK_OUTBOUND_GLOBAL_BANDWIDTH_LIMIT + "")
+ @JsonProperty(value = "peak_outbound_global_bandwidth_bps")
protected final long peakOutboundGlobalBandwidthBytesPerSecond;
- @JsonProperty(value = "max_delay_to_wait_millis", defaultValue =
DEFAULT_MAX_DELAY_TIME + "")
+ @JsonProperty(value = "max_delay_to_wait_millis")
protected final long maxDelayToWaitMillis;
- @JsonProperty(value = "check_interval_for_stats_millis", defaultValue =
DEFAULT_CHECK_INTERVAL + "")
+ @JsonProperty(value = "check_interval_for_stats_millis")
protected final long checkIntervalForStatsMillis;
- @JsonProperty(value = "inbound_global_file_bandwidth_bps", defaultValue =
"0")
+ @JsonProperty(value = "inbound_global_file_bandwidth_bps")
protected final long inboundGlobalFileBandwidthBytesPerSecond;
public TrafficShapingConfigurationImpl()
@@ -113,7 +112,7 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "inbound_global_bandwidth_bps", defaultValue = "0")
+ @JsonProperty(value = "inbound_global_bandwidth_bps")
public long inboundGlobalBandwidthBytesPerSecond()
{
return inboundGlobalBandwidthBytesPerSecond;
@@ -123,7 +122,7 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "outbound_global_bandwidth_bps", defaultValue = "0")
+ @JsonProperty(value = "outbound_global_bandwidth_bps")
public long outboundGlobalBandwidthBytesPerSecond()
{
return outboundGlobalBandwidthBytesPerSecond;
@@ -133,8 +132,7 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "peak_outbound_global_bandwidth_bps",
- defaultValue = DEFAULT_PEAK_OUTBOUND_GLOBAL_BANDWIDTH_LIMIT + "")
+ @JsonProperty(value = "peak_outbound_global_bandwidth_bps")
public long peakOutboundGlobalBandwidthBytesPerSecond()
{
return peakOutboundGlobalBandwidthBytesPerSecond;
@@ -144,7 +142,7 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "max_delay_to_wait_millis", defaultValue =
DEFAULT_MAX_DELAY_TIME + "")
+ @JsonProperty(value = "max_delay_to_wait_millis")
public long maxDelayToWaitMillis()
{
return maxDelayToWaitMillis;
@@ -154,14 +152,14 @@ public class TrafficShapingConfigurationImpl implements
TrafficShapingConfigurat
* {@inheritDoc}
*/
@Override
- @JsonProperty(value = "check_interval_for_stats_millis", defaultValue =
DEFAULT_CHECK_INTERVAL + "")
+ @JsonProperty(value = "check_interval_for_stats_millis")
public long checkIntervalForStatsMillis()
{
return checkIntervalForStatsMillis;
}
@Override
- @JsonProperty(value = "inbound_global_file_bandwidth_bps", defaultValue =
"0")
+ @JsonProperty(value = "inbound_global_file_bandwidth_bps")
public long inboundGlobalFileBandwidthBytesPerSecond()
{
return inboundGlobalFileBandwidthBytesPerSecond;
diff --git
a/src/test/java/org/apache/cassandra/sidecar/config/SidecarConfigurationTest.java
b/src/test/java/org/apache/cassandra/sidecar/config/SidecarConfigurationTest.java
index 62b2ac9..8775c67 100644
---
a/src/test/java/org/apache/cassandra/sidecar/config/SidecarConfigurationTest.java
+++
b/src/test/java/org/apache/cassandra/sidecar/config/SidecarConfigurationTest.java
@@ -190,6 +190,22 @@ class SidecarConfigurationTest
assertThat(driverConfiguration.numConnections()).isEqualTo(6);
}
+ @Test
+ void testReadCustomSchemaKeyspaceConfiguration() throws IOException
+ {
+ Path yamlPath =
yaml("config/sidecar_schema_keyspace_configuration.yaml");
+ SidecarConfiguration config =
SidecarConfigurationImpl.readYamlConfiguration(yamlPath);
+
+ SchemaKeyspaceConfiguration configuration =
config.serviceConfiguration().schemaKeyspaceConfiguration();
+ assertThat(configuration).isNotNull();
+ assertThat(configuration.isEnabled()).isTrue();
+ assertThat(configuration.keyspace()).isEqualTo("sidecar_internal");
+
assertThat(configuration.replicationStrategy()).isEqualTo("SimpleStrategy");
+ assertThat(configuration.replicationFactor()).isEqualTo(3);
+ assertThat(configuration.createReplicationStrategyString())
+ .isEqualTo("{'class':'SimpleStrategy', 'replication_factor':'3'}");
+ }
+
void validateSingleInstanceSidecarConfiguration(SidecarConfiguration
config)
{
assertThat(config.cassandraInstances()).isNotNull().hasSize(1);
diff --git a/src/test/resources/config/sidecar_single_instance.yaml
b/src/test/resources/config/sidecar_schema_keyspace_configuration.yaml
similarity index 95%
copy from src/test/resources/config/sidecar_single_instance.yaml
copy to src/test/resources/config/sidecar_schema_keyspace_configuration.yaml
index c2d3a85..a1f45c3 100644
--- a/src/test/resources/config/sidecar_single_instance.yaml
+++ b/src/test/resources/config/sidecar_schema_keyspace_configuration.yaml
@@ -56,6 +56,11 @@ sidecar:
jmx:
max_retries: 42
retry_delay_millis: 1234
+ schema:
+ is_enabled: true
+ keyspace: sidecar_internal
+ replication_strategy: SimpleStrategy
+ replication_factor: 3
#
# Enable SSL configuration (Disabled by default)
diff --git a/src/test/resources/config/sidecar_single_instance.yaml
b/src/test/resources/config/sidecar_single_instance.yaml
index c2d3a85..a04fe3d 100644
--- a/src/test/resources/config/sidecar_single_instance.yaml
+++ b/src/test/resources/config/sidecar_single_instance.yaml
@@ -56,6 +56,11 @@ sidecar:
jmx:
max_retries: 42
retry_delay_millis: 1234
+ schema:
+ is_enabled: false
+ keyspace: sidecar_internal
+ replication_strategy: SimpleStrategy
+ replication_factor: 1
#
# Enable SSL configuration (Disabled by default)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]