Skip to content

Commit 4f304bf

Browse files
committed
Bumping versions
1 parent 6321081 commit 4f304bf

File tree

68 files changed

+540
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+540
-421
lines changed

spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/ConsulInboundMessageProducer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ public void getEvents() {
100100
// headers.put(MessageHeaders.REPLY_CHANNEL, outputChannel.)
101101
String decoded = new String(decodeFromString(event.getPayload()));
102102
sendMessage(getMessageBuilderFactory().withPayload(decoded)
103-
// TODO: support headers
104-
.build());
103+
// TODO: support headers
104+
.build());
105105
}
106106
}
107107
catch (OperationException e) {

spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/EventService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public List<Event> watch(Long lastIndex) {
101101
eventTimeout = this.properties.getEventTimeout();
102102
}
103103
Response<List<Event>> watch = this.consul
104-
.eventList(EventListRequest.newBuilder().setQueryParams(new QueryParams(eventTimeout, index)).build());
104+
.eventList(EventListRequest.newBuilder().setQueryParams(new QueryParams(eventTimeout, index)).build());
105105
return filterEvents(readEvents(watch), lastIndex);
106106
}
107107

spring-cloud-consul-binder/src/test/java/org/springframework/cloud/consul/binder/config/ConsulBinderConfigurationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ public class ConsulBinderConfigurationTests {
4242
public void consulBinderDisabledWorks() {
4343
this.exception.expectMessage(containsString("no proper implementation found"));
4444
new SpringApplicationBuilder(Application.class).initializers(new ConsulTestcontainers())
45-
.properties("spring.cloud.consul.binder.enabled=false").run();
45+
.properties("spring.cloud.consul.binder.enabled=false")
46+
.run();
4647
}
4748

4849
@Test
4950
@Ignore // FIXME 2.0.0 need stream fix
5051
public void consulDisabledDisablesBinder() {
5152
this.exception.expectMessage(containsString("no proper implementation found"));
5253
new SpringApplicationBuilder(Application.class).initializers(new ConsulTestcontainers())
53-
.properties("spring.cloud.consul.enabled=false").run();
54+
.properties("spring.cloud.consul.enabled=false")
55+
.run();
5456
}
5557

5658
interface Events {

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConfigWatch.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ public int hashCode() {
252252

253253
@Override
254254
public String toString() {
255-
return new ToStringCreator(this).append("context", this.context).append("prevIndex", this.prevIndex)
256-
.append("newIndex", this.newIndex).toString();
255+
return new ToStringCreator(this).append("context", this.context)
256+
.append("prevIndex", this.prevIndex)
257+
.append("newIndex", this.newIndex)
258+
.toString();
257259
}
258260

259261
}

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public ConfigData doLoad(ConfigDataLoaderContext context, ConsulConfigDataResour
6464
ConsulConfigIndexes indexes = getBean(context, ConsulConfigIndexes.class);
6565

6666
ConsulPropertySource propertySource = resource.getConsulPropertySources()
67-
.createPropertySource(resource.getContext(), consul, indexes.getIndexes()::put);
67+
.createPropertySource(resource.getContext(), consul, indexes.getIndexes()::put);
6868
if (propertySource == null) {
6969
return null;
7070
}

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolver.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class ConsulConfigDataLocationResolver implements ConfigDataLocationResol
6060
protected static final List<String> DIR_SUFFIXES = Collections.singletonList("/");
6161

6262
protected static final List<String> FILES_SUFFIXES = Collections
63-
.unmodifiableList(Arrays.asList(".yml", ".yaml", ".properties"));
63+
.unmodifiableList(Arrays.asList(".yml", ".yaml", ".properties"));
6464

6565
private final Log log;
6666

@@ -75,8 +75,9 @@ public boolean isResolvable(ConfigDataLocationResolverContext context, ConfigDat
7575
}
7676
// only bind if correct prefix
7777
boolean enabled = context.getBinder().bind(ConsulProperties.PREFIX + ".enabled", Boolean.class).orElse(true);
78-
boolean configEnabled = context.getBinder().bind(ConsulConfigProperties.PREFIX + ".enabled", Boolean.class)
79-
.orElse(true);
78+
boolean configEnabled = context.getBinder()
79+
.bind(ConsulConfigProperties.PREFIX + ".enabled", Boolean.class)
80+
.orElse(true);
8081
return configEnabled && enabled;
8182
}
8283

@@ -110,10 +111,10 @@ public List<ConsulConfigDataResource> resolveProfileSpecific(ConfigDataLocationR
110111
registerAndPromoteBean(resolverContext, ConsulConfigIndexes.class,
111112
InstanceSupplier.from(ConsulConfigDataIndexes::new));
112113

113-
return contexts
114-
.stream().map(propertySourceContext -> new ConsulConfigDataResource(propertySourceContext.getPath(),
115-
properties, consulPropertySources, propertySourceContext.getProfile()))
116-
.collect(Collectors.toList());
114+
return contexts.stream()
115+
.map(propertySourceContext -> new ConsulConfigDataResource(propertySourceContext.getPath(), properties,
116+
consulPropertySources, propertySourceContext.getProfile()))
117+
.collect(Collectors.toList());
117118
}
118119

119120
private BindHandler getBindHandler(ConfigDataLocationResolverContext context) {
@@ -192,8 +193,8 @@ protected ConsulProperties loadProperties(ConfigDataLocationResolverContext reso
192193
UriComponents location) {
193194
Binder binder = resolverContext.getBinder();
194195
ConsulProperties consulProperties = binder
195-
.bind(ConsulProperties.PREFIX, Bindable.of(ConsulProperties.class), getBindHandler(resolverContext))
196-
.orElseGet(ConsulProperties::new);
196+
.bind(ConsulProperties.PREFIX, Bindable.of(ConsulProperties.class), getBindHandler(resolverContext))
197+
.orElseGet(ConsulProperties::new);
197198

198199
if (location != null) {
199200
if (StringUtils.hasText(location.getHost())) {
@@ -211,16 +212,16 @@ protected ConsulConfigProperties loadConfigProperties(ConfigDataLocationResolver
211212
Binder binder = resolverContext.getBinder();
212213
BindHandler bindHandler = getBindHandler(resolverContext);
213214
ConsulConfigProperties properties = binder
214-
.bind(ConsulConfigProperties.PREFIX, Bindable.of(ConsulConfigProperties.class), bindHandler)
215-
.orElseGet(ConsulConfigProperties::new);
215+
.bind(ConsulConfigProperties.PREFIX, Bindable.of(ConsulConfigProperties.class), bindHandler)
216+
.orElseGet(ConsulConfigProperties::new);
216217

217218
if (!StringUtils.hasText(properties.getName())) {
218219
properties.setName(binder.bind("spring.application.name", String.class).orElse("application"));
219220
}
220221

221222
if (!StringUtils.hasText(properties.getAclToken())) {
222223
properties.setAclToken(binder.bind("spring.cloud.consul.token", String.class)
223-
.orElse(binder.bind("consul.token", String.class).orElse(null)));
224+
.orElse(binder.bind("consul.token", String.class).orElse(null)));
224225
}
225226
return properties;
226227
}

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigDataResource.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ public int hashCode() {
9999

100100
@Override
101101
public String toString() {
102-
return new ToStringCreator(this).append("context", context).append("optional", optional)
103-
.append("properties", properties).append("profile", profile).toString();
102+
return new ToStringCreator(this).append("context", context)
103+
.append("optional", optional)
104+
.append("properties", properties)
105+
.append("profile", profile)
106+
.toString();
104107

105108
}
106109

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulConfigProperties.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,17 @@ public void setName(String name) {
191191

192192
@Override
193193
public String toString() {
194-
return new ToStringCreator(this).append("enabled", this.enabled).append("prefixes", this.prefixes)
195-
.append("defaultContext", this.defaultContext).append("profileSeparator", this.profileSeparator)
196-
.append("format", this.format).append("dataKey", this.dataKey).append("aclToken", this.aclToken)
197-
.append("watch", this.watch).append("failFast", this.failFast).append("name", this.name).toString();
194+
return new ToStringCreator(this).append("enabled", this.enabled)
195+
.append("prefixes", this.prefixes)
196+
.append("defaultContext", this.defaultContext)
197+
.append("profileSeparator", this.profileSeparator)
198+
.append("format", this.format)
199+
.append("dataKey", this.dataKey)
200+
.append("aclToken", this.aclToken)
201+
.append("watch", this.watch)
202+
.append("failFast", this.failFast)
203+
.append("name", this.name)
204+
.toString();
198205
}
199206

200207
/**
@@ -295,8 +302,10 @@ public void setDelay(int delay) {
295302

296303
@Override
297304
public String toString() {
298-
return new ToStringCreator(this).append("waitTime", this.waitTime).append("enabled", this.enabled)
299-
.append("delay", this.delay).toString();
305+
return new ToStringCreator(this).append("waitTime", this.waitTime)
306+
.append("enabled", this.enabled)
307+
.append("delay", this.delay)
308+
.toString();
300309
}
301310

302311
}

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySources.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class ConsulPropertySources {
3838
protected static final List<String> DIR_SUFFIXES = Collections.singletonList("/");
3939

4040
protected static final List<String> FILES_SUFFIXES = Collections
41-
.unmodifiableList(Arrays.asList(".yml", ".yaml", ".properties"));
41+
.unmodifiableList(Arrays.asList(".yml", ".yaml", ".properties"));
4242

4343
private final ConsulConfigProperties properties;
4444

spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulRetryBootstrapper.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,27 @@ public void initialize(BootstrapRegistry registry) {
4141
return;
4242
}
4343

44-
registry.registerIfAbsent(RetryProperties.class, context -> context.get(Binder.class)
45-
.bind(RetryProperties.PREFIX, RetryProperties.class).orElseGet(RetryProperties::new));
44+
registry.registerIfAbsent(RetryProperties.class,
45+
context -> context.get(Binder.class)
46+
.bind(RetryProperties.PREFIX, RetryProperties.class)
47+
.orElseGet(RetryProperties::new));
4648

4749
registry.registerIfAbsent(RetryTemplate.class, context -> {
4850
RetryProperties properties = context.get(RetryProperties.class);
4951
if (properties.isEnabled()) {
50-
return RetryTemplate.builder().maxAttempts(properties.getMaxAttempts())
51-
.exponentialBackoff(properties.getInitialInterval(), properties.getMultiplier(),
52-
properties.getMaxInterval())
53-
.build();
52+
return RetryTemplate.builder()
53+
.maxAttempts(properties.getMaxAttempts())
54+
.exponentialBackoff(properties.getInitialInterval(), properties.getMultiplier(),
55+
properties.getMaxInterval())
56+
.build();
5457
}
5558
return null;
5659
});
5760
registry.registerIfAbsent(LoaderInterceptor.class, context -> {
5861
RetryTemplate retryTemplate = context.get(RetryTemplate.class);
5962
if (retryTemplate != null) {
6063
return loadContext -> retryTemplate.execute(retryContext -> loadContext.getInvocation()
61-
.apply(loadContext.getLoaderContext(), loadContext.getResource()));
64+
.apply(loadContext.getLoaderContext(), loadContext.getResource()));
6265
}
6366
// disabled
6467
return null;

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigBootstrapConfigurationTests.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ public class ConsulConfigBootstrapConfigurationTests {
3838
*/
3939
@Test
4040
public void testConfigPropsBeanBacksOff() {
41-
this.contextRunner.withUserConfiguration(TestConfig.class).withInitializer(new ConsulTestcontainers())
42-
.withUserConfiguration(ConsulConfigBootstrapConfiguration.class).run(context -> {
43-
ConsulConfigProperties config = context.getBean(ConsulConfigProperties.class);
44-
assertThat(config.getPrefixes().get(0)).as("Prefix did not match").isEqualTo("platform-config");
45-
assertThat(config.getDefaultContext()).as("Default context did not match").isEqualTo("defaults");
46-
});
41+
this.contextRunner.withUserConfiguration(TestConfig.class)
42+
.withInitializer(new ConsulTestcontainers())
43+
.withUserConfiguration(ConsulConfigBootstrapConfiguration.class)
44+
.run(context -> {
45+
ConsulConfigProperties config = context.getBean(ConsulConfigProperties.class);
46+
assertThat(config.getPrefixes().get(0)).as("Prefix did not match").isEqualTo("platform-config");
47+
assertThat(config.getDefaultContext()).as("Default context did not match").isEqualTo("defaults");
48+
});
4749
}
4850

4951
/**
@@ -53,11 +55,12 @@ public void testConfigPropsBeanBacksOff() {
5355
@Test
5456
public void testConfigPropsBeanKicksIn() {
5557
this.contextRunner.withUserConfiguration(ConsulConfigBootstrapConfiguration.class)
56-
.withInitializer(new ConsulTestcontainers()).run(context -> {
57-
ConsulConfigProperties config = context.getBean(ConsulConfigProperties.class);
58-
assertThat(config.getPrefixes().get(0)).as("Prefix did not match").isEqualTo("config");
59-
assertThat(config.getDefaultContext()).as("Default context did not match").isEqualTo("application");
60-
});
58+
.withInitializer(new ConsulTestcontainers())
59+
.run(context -> {
60+
ConsulConfigProperties config = context.getBean(ConsulConfigProperties.class);
61+
assertThat(config.getPrefixes().get(0)).as("Prefix did not match").isEqualTo("config");
62+
assertThat(config.getDefaultContext()).as("Default context did not match").isEqualTo("application");
63+
});
6164
}
6265

6366
/**

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataCustomizationIntegrationTests.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ public static void setup() {
7070
application.addBootstrapRegistryInitializer(ConsulBootstrapper.fromConsulProperties(TestConsulClient::new));
7171
application.addBootstrapRegistryInitializer(
7272
registry -> registry.register(ConsulBootstrapper.LoaderInterceptor.class, context1 -> loadContext -> {
73-
ConfigData configData = loadContext.getInvocation().apply(loadContext.getLoaderContext(),
74-
loadContext.getResource());
73+
ConfigData configData = loadContext.getInvocation()
74+
.apply(loadContext.getLoaderContext(), loadContext.getResource());
7575
assertThat(configData).as("ConfigData was null for location %s", loadContext.getResource())
76-
.isNotNull();
76+
.isNotNull();
7777
assertThat(configData.getPropertySources()).hasSize(1);
7878
PropertySource<?> propertySource = configData.getPropertySources().iterator().next();
7979
ConfigData.Options options = configData.getOptions(propertySource);
80-
assertThat(options).as("ConfigData.options was null for location %s property source %s",
81-
loadContext.getResource(), propertySource.getName()).isNotNull();
80+
assertThat(options)
81+
.as("ConfigData.options was null for location %s property source %s", loadContext.getResource(),
82+
propertySource.getName())
83+
.isNotNull();
8284
assertThat(options.contains(ConfigData.Option.IGNORE_IMPORTS)).isTrue();
8385
assertThat(options.contains(ConfigData.Option.IGNORE_PROFILES)).isTrue();
8486
boolean hasProfile = StringUtils.hasText(loadContext.getResource().getProfile());

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataFileIntegrationTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ public static void setup() {
8484
client.deleteKVValues(PREFIX);
8585
client.setKVValue(KEY1, TEST_PROP + "=" + VALUE1 + "\n" + TEST_PROP2 + "=" + VALUE2);
8686

87-
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).run(
88-
"--spring.application.name=" + APP_NAME, "--spring.cloud.consul.config.format=files",
89-
"--spring.config.import=optional:consul:" + ConsulTestcontainers.getHost() + ":"
90-
+ ConsulTestcontainers.getPort(),
91-
"--spring.cloud.consul.config.prefix=" + ROOT, "--spring.cloud.consul.config.watch.delay=10");
87+
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE)
88+
.run("--spring.application.name=" + APP_NAME, "--spring.cloud.consul.config.format=files",
89+
"--spring.config.import=optional:consul:" + ConsulTestcontainers.getHost() + ":"
90+
+ ConsulTestcontainers.getPort(),
91+
"--spring.cloud.consul.config.prefix=" + ROOT, "--spring.cloud.consul.config.watch.delay=10");
9292

9393
client = context.getBean(ConsulClient.class);
9494
environment = context.getEnvironment();

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataIntegrationTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public static void setup() {
9292
client.setKVValue(KEY2, VALUE2_DEFAULT);
9393
client.setKVValue(KEY2_APP_NAME, VALUE2);
9494

95-
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).run(
96-
"--logging.level.org.springframework.cloud.consul.config.ConfigWatch=TRACE",
97-
"--spring.application.name=" + APP_NAME,
98-
"--spring.config.import=consul:" + ConsulTestcontainers.getHost() + ":"
99-
+ ConsulTestcontainers.getPort(),
100-
"--spring.cloud.consul.config.prefix=" + ROOT, "--spring.cloud.consul.config.watch.delay=10",
101-
"--spring.cloud.consul.config.watch.wait-time=1");
95+
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE)
96+
.run("--logging.level.org.springframework.cloud.consul.config.ConfigWatch=TRACE",
97+
"--spring.application.name=" + APP_NAME,
98+
"--spring.config.import=consul:" + ConsulTestcontainers.getHost() + ":"
99+
+ ConsulTestcontainers.getPort(),
100+
"--spring.cloud.consul.config.prefix=" + ROOT, "--spring.cloud.consul.config.watch.delay=10",
101+
"--spring.cloud.consul.config.watch.wait-time=1");
102102

103103
client = context.getBean(ConsulClient.class);
104104
environment = context.getEnvironment();

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataLocationResolverTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ public void testParseLocation() {
4949
destination -> LogFactory.getLog(ConsulConfigDataLocationResolver.class));
5050
UriComponents uriComponents = resolver.parseLocation(null,
5151
ConfigDataLocation.of("consul:myhost:8501/mypath1;/mypath2;/mypath3"));
52-
assertThat(uriComponents.toUri()).hasScheme("consul").hasHost("myhost").hasPort(8501)
53-
.hasPath("/mypath1;/mypath2;/mypath3");
52+
assertThat(uriComponents.toUri()).hasScheme("consul")
53+
.hasHost("myhost")
54+
.hasPort(8501)
55+
.hasPath("/mypath1;/mypath2;/mypath3");
5456

5557
uriComponents = resolver.parseLocation(null, ConfigDataLocation.of("consul:myhost:8501"));
5658
assertThat(uriComponents.toUri()).hasScheme("consul").hasHost("myhost").hasPort(8501).hasPath("");

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataMissingEnvironmentPostProcessorTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void noSpringConfigImport() {
3636
SpringApplication app = mock(SpringApplication.class);
3737
ConsulConfigDataMissingEnvironmentPostProcessor processor = new ConsulConfigDataMissingEnvironmentPostProcessor();
3838
assertThatThrownBy(() -> processor.postProcessEnvironment(environment, app))
39-
.isInstanceOf(ConsulConfigDataMissingEnvironmentPostProcessor.ImportException.class);
39+
.isInstanceOf(ConsulConfigDataMissingEnvironmentPostProcessor.ImportException.class);
4040
}
4141

4242
@Test

spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulConfigDataMultiplePrefixesIntegrationTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ public static void setup() {
8181
client.setKVValue(KEY1, VALUE1);
8282
client.setKVValue(KEY2, VALUE2);
8383

84-
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).run(
85-
"--logging.level.org.springframework.cloud.consul.config.ConfigWatch=TRACE",
86-
"--spring.application.name=" + APP_NAME,
87-
"--spring.config.import=consul:" + ConsulTestcontainers.getHost() + ":"
88-
+ ConsulTestcontainers.getPort(),
89-
"--spring.cloud.consul.config.prefixes=" + ROOT + "," + ROOT2,
90-
"--spring.cloud.consul.config.watch.delay=10", "--spring.cloud.consul.config.watch.wait-time=1");
84+
context = new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE)
85+
.run("--logging.level.org.springframework.cloud.consul.config.ConfigWatch=TRACE",
86+
"--spring.application.name=" + APP_NAME,
87+
"--spring.config.import=consul:" + ConsulTestcontainers.getHost() + ":"
88+
+ ConsulTestcontainers.getPort(),
89+
"--spring.cloud.consul.config.prefixes=" + ROOT + "," + ROOT2,
90+
"--spring.cloud.consul.config.watch.delay=10", "--spring.cloud.consul.config.watch.wait-time=1");
9191

9292
client = context.getBean(ConsulClient.class);
9393
environment = context.getEnvironment();

0 commit comments

Comments
 (0)