move ConfigReloadProperties to record (#1110)

This commit is contained in:
erabii
2022-10-18 15:57:37 +03:00
committed by GitHub
parent 20c1691a13
commit 7a5cc57e3c
19 changed files with 162 additions and 180 deletions

View File

@@ -16,8 +16,6 @@
package org.springframework.cloud.kubernetes.configuration.watcher;
import java.util.Set;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
@@ -74,12 +72,10 @@ class BusEventBasedConfigMapWatcherChangeDetectorTests {
void setup() {
MockEnvironment mockEnvironment = new MockEnvironment();
mockEnvironment.setProperty(NAMESPACE_PROPERTY, "default");
ConfigReloadProperties configReloadProperties = new ConfigReloadProperties();
configReloadProperties.setNamespaces(Set.of("default"));
ConfigurationWatcherConfigurationProperties configurationWatcherConfigurationProperties = new ConfigurationWatcherConfigurationProperties();
busProperties = new BusProperties();
changeDetector = new BusEventBasedConfigMapWatcherChangeDetector(coreV1Api, mockEnvironment,
configReloadProperties, UPDATE_STRATEGY, configMapPropertySourceLocator,
ConfigReloadProperties.DEFAULT, UPDATE_STRATEGY, configMapPropertySourceLocator,
new KubernetesNamespaceProvider(mockEnvironment), configurationWatcherConfigurationProperties,
threadPoolTaskExecutor, new BusRefreshTrigger(applicationEventPublisher, busProperties.getId()));
}

View File

@@ -16,8 +16,6 @@
package org.springframework.cloud.kubernetes.configuration.watcher;
import java.util.Set;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1Secret;
@@ -74,12 +72,10 @@ class BusEventBasedSecretsWatcherChangeDetectorTests {
void setup() {
MockEnvironment mockEnvironment = new MockEnvironment();
mockEnvironment.setProperty(NAMESPACE_PROPERTY, "default");
ConfigReloadProperties configReloadProperties = new ConfigReloadProperties();
configReloadProperties.setNamespaces(Set.of("default"));
ConfigurationWatcherConfigurationProperties configurationWatcherConfigurationProperties = new ConfigurationWatcherConfigurationProperties();
busProperties = new BusProperties();
changeDetector = new BusEventBasedSecretsWatcherChangeDetector(coreV1Api, mockEnvironment,
configReloadProperties, UPDATE_STRATEGY, secretsPropertySourceLocator,
ConfigReloadProperties.DEFAULT, UPDATE_STRATEGY, secretsPropertySourceLocator,
new KubernetesNamespaceProvider(mockEnvironment), configurationWatcherConfigurationProperties,
threadPoolTaskExecutor, new BusRefreshTrigger(applicationEventPublisher, busProperties.getId()));
}

View File

@@ -104,7 +104,6 @@ class HttpBasedConfigMapWatchChangeDetectorTests {
MockEnvironment mockEnvironment = new MockEnvironment();
mockEnvironment.setProperty(NAMESPACE_PROPERTY, "default");
ConfigReloadProperties configReloadProperties = new ConfigReloadProperties();
configurationWatcherConfigurationProperties = new ConfigurationWatcherConfigurationProperties();
WebClient webClient = WebClient.builder().build();
@@ -112,10 +111,11 @@ class HttpBasedConfigMapWatchChangeDetectorTests {
});
changeDetector = new HttpBasedConfigMapWatchChangeDetector(coreV1Api, mockEnvironment, configReloadProperties,
strategy, configMapPropertySourceLocator, new KubernetesNamespaceProvider(mockEnvironment),
configurationWatcherConfigurationProperties, threadPoolTaskExecutor, new HttpRefreshTrigger(
reactiveDiscoveryClient, configurationWatcherConfigurationProperties, webClient));
changeDetector = new HttpBasedConfigMapWatchChangeDetector(coreV1Api, mockEnvironment,
ConfigReloadProperties.DEFAULT, strategy, configMapPropertySourceLocator,
new KubernetesNamespaceProvider(mockEnvironment), configurationWatcherConfigurationProperties,
threadPoolTaskExecutor, new HttpRefreshTrigger(reactiveDiscoveryClient,
configurationWatcherConfigurationProperties, webClient));
}
@Test

View File

@@ -93,13 +93,13 @@ class HttpBasedSecretsWatchChangeDetectorTests {
void setup() {
MockEnvironment mockEnvironment = new MockEnvironment();
mockEnvironment.setProperty(NAMESPACE_PROPERTY, "default");
ConfigReloadProperties configReloadProperties = new ConfigReloadProperties();
configurationWatcherConfigurationProperties = new ConfigurationWatcherConfigurationProperties();
WebClient webClient = WebClient.builder().build();
changeDetector = new HttpBasedSecretsWatchChangeDetector(coreV1Api, mockEnvironment, configReloadProperties,
updateStrategy, secretsPropertySourceLocator, new KubernetesNamespaceProvider(mockEnvironment),
configurationWatcherConfigurationProperties, threadPoolTaskExecutor, new HttpRefreshTrigger(
reactiveDiscoveryClient, configurationWatcherConfigurationProperties, webClient));
changeDetector = new HttpBasedSecretsWatchChangeDetector(coreV1Api, mockEnvironment,
ConfigReloadProperties.DEFAULT, updateStrategy, secretsPropertySourceLocator,
new KubernetesNamespaceProvider(mockEnvironment), configurationWatcherConfigurationProperties,
threadPoolTaskExecutor, new HttpRefreshTrigger(reactiveDiscoveryClient,
configurationWatcherConfigurationProperties, webClient));
}
@BeforeAll