Fix Checkstyle violations for spring-metadata-store-common

* Move `org.apache.curator:curator-test` to the `dependencies.gradle`
and include it into a `dev` group for Dependabot
This commit is contained in:
Artem Bilan
2024-01-04 16:50:39 -05:00
parent bf35cee6fc
commit 0ea8b8afa0
7 changed files with 34 additions and 18 deletions

View File

@@ -20,3 +20,4 @@ updates:
- "org.ajoberstar.grgit"
- "com.icegreen:greenmail"
- "org.mock-server*"
- "org.apache.curator*"

View File

@@ -9,8 +9,8 @@ dependencies {
optionalApi 'org.springframework.integration:spring-integration-zookeeper'
optionalApi 'org.springframework.integration:spring-integration-hazelcast'
optionalApi springIntegrationAws
api 'software.amazon.awssdk:dynamodb'
optionalApi 'software.amazon.awssdk:dynamodb'
testImplementation 'org.hsqldb:hsqldb'
testImplementation 'org.apache.curator:curator-test:5.5.0'
testImplementation apacheCuratorTest
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.fn.common.metadata.store;
import com.hazelcast.core.HazelcastInstance;
import io.awspring.cloud.autoconfigure.core.AwsClientBuilderConfigurer;
import io.awspring.cloud.autoconfigure.dynamodb.DynamoDbAutoConfiguration;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryForever;
@@ -28,6 +29,10 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.core.MongoTemplate;
@@ -44,12 +49,15 @@ import org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore
import org.springframework.jdbc.core.JdbcTemplate;
/**
* The auto-configuration for metadata store.
*
* @author Artem Bilan
* @author David Turanski
* @author Corneil du Plessis
* @since 2.0.2
*/
@AutoConfiguration
@AutoConfiguration(after = { RedisAutoConfiguration.class, MongoAutoConfiguration.class,
HazelcastAutoConfiguration.class, JdbcTemplateAutoConfiguration.class, DynamoDbAutoConfiguration.class })
@ConditionalOnClass(ConcurrentMetadataStore.class)
@EnableConfigurationProperties(MetadataStoreProperties.class)
public class MetadataStoreAutoConfiguration {
@@ -66,7 +74,7 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore redisMetadataStore(RedisTemplate<String, ?> redisTemplate,
ConcurrentMetadataStore redisMetadataStore(RedisTemplate<String, ?> redisTemplate,
MetadataStoreProperties metadataStoreProperties) {
return new RedisMetadataStore(redisTemplate, metadataStoreProperties.getRedis().getKey());
@@ -79,7 +87,7 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore mongoDbMetadataStore(MongoTemplate mongoTemplate,
ConcurrentMetadataStore mongoDbMetadataStore(MongoTemplate mongoTemplate,
MetadataStoreProperties metadataStoreProperties) {
return new MongoDbMetadataStore(mongoTemplate, metadataStoreProperties.getMongoDb().getCollection());
@@ -92,13 +100,13 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public HazelcastInstance hazelcastInstance() {
HazelcastInstance hazelcastInstance() {
return com.hazelcast.core.Hazelcast.newHazelcastInstance();
}
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore hazelcastMetadataStore(HazelcastInstance hazelcastInstance,
ConcurrentMetadataStore hazelcastMetadataStore(HazelcastInstance hazelcastInstance,
ObjectProvider<MetadataStoreListener> metadataStoreListenerObjectProvider) {
HazelcastMetadataStore hazelcastMetadataStore = new HazelcastMetadataStore(hazelcastInstance);
@@ -113,7 +121,7 @@ public class MetadataStoreAutoConfiguration {
@Bean(initMethod = "start")
@ConditionalOnMissingBean
public CuratorFramework curatorFramework(MetadataStoreProperties metadataStoreProperties) {
CuratorFramework curatorFramework(MetadataStoreProperties metadataStoreProperties) {
MetadataStoreProperties.Zookeeper zookeeperProperties = metadataStoreProperties.getZookeeper();
return CuratorFrameworkFactory.newClient(zookeeperProperties.getConnectString(),
new RetryForever(zookeeperProperties.getRetryInterval()));
@@ -121,7 +129,7 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore zookeeperMetadataStore(CuratorFramework curatorFramework,
ConcurrentMetadataStore zookeeperMetadataStore(CuratorFramework curatorFramework,
MetadataStoreProperties metadataStoreProperties,
ObjectProvider<MetadataStoreListener> metadataStoreListenerObjectProvider) {
@@ -140,13 +148,13 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public DynamoDbAsyncClient dynamoDB(AwsClientBuilderConfigurer awsClientBuilderConfigurer) {
DynamoDbAsyncClient dynamoDB(AwsClientBuilderConfigurer awsClientBuilderConfigurer) {
return awsClientBuilderConfigurer.configure(DynamoDbAsyncClient.builder()).build();
}
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore dynamoDbMetadataStore(DynamoDbAsyncClient dynamoDB,
ConcurrentMetadataStore dynamoDbMetadataStore(DynamoDbAsyncClient dynamoDB,
MetadataStoreProperties metadataStoreProperties) {
MetadataStoreProperties.DynamoDb dynamoDbProperties = metadataStoreProperties.getDynamoDb();
@@ -172,7 +180,7 @@ public class MetadataStoreAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ConcurrentMetadataStore jdbcMetadataStore(JdbcTemplate jdbcTemplate,
ConcurrentMetadataStore jdbcMetadataStore(JdbcTemplate jdbcTemplate,
MetadataStoreProperties metadataStoreProperties) {
MetadataStoreProperties.Jdbc jdbcProperties = metadataStoreProperties.getJdbc();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ import org.springframework.integration.jdbc.metadata.JdbcMetadataStore;
import org.springframework.integration.redis.metadata.RedisMetadataStore;
/**
* The properties for metadata store.
*
* @author Artem Bilan
* @author David Turanski
* @author Corneil du Plessis
@@ -252,7 +254,7 @@ public class MetadataStoreProperties {
private String root = "/SpringIntegration-MetadataStore";
public String getConnectString() {
return connectString;
return this.connectString;
}
public void setConnectString(String connectString) {

View File

@@ -0,0 +1,4 @@
/**
* The metadata store auto-configuration support.
*/
package org.springframework.cloud.fn.common.metadata.store;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ import static org.mockito.Mockito.mock;
*/
public class MetadataStoreAutoConfigurationTests {
private final static List<Class<? extends ConcurrentMetadataStore>> METADATA_STORE_CLASSES = List.of(
private static final List<Class<? extends ConcurrentMetadataStore>> METADATA_STORE_CLASSES = List.of(
RedisMetadataStore.class, MongoDbMetadataStore.class, JdbcMetadataStore.class, ZookeeperMetadataStore.class,
HazelcastMetadataStore.class, DynamoDbMetadataStore.class, SimpleMetadataStore.class);
@@ -74,7 +74,7 @@ public class MetadataStoreAutoConfigurationTests {
.toLowerCase()
.replaceFirst("simple", "memory"))
.withClassLoader(filteredClassLoaderBut(classToInclude));
contextRunner.run(context -> {
contextRunner.run((context) -> {
assertThat(context.getBeansOfType(MetadataStore.class)).hasSize(1);
assertThat(context.getBeanNamesForType(classToInclude))

View File

@@ -11,5 +11,6 @@ ext {
mockserverNetty = 'org.mock-server:mockserver-netty:5.15.0'
twitter4jStream = 'org.twitter4j:twitter4j-stream:4.0.7'
greenmail = 'com.icegreen:greenmail:2.1.0-alpha-3'
apacheCuratorTest = 'org.apache.curator:curator-test:5.5.0'
protobufJava = "com.google.protobuf:protobuf-java:$protobufVersion"
}