Add updateCopyrights Gradle task

* Fix Checkstyle violations for `spring-config-common` and `spring-aggregator-function`
This commit is contained in:
Artem Bilan
2024-01-03 14:46:20 -05:00
parent f6eafc9511
commit 8e64a131f7
7 changed files with 100 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 the original author or authors.
* Copyright 2020-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.
@@ -49,6 +49,8 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
/**
* The auto-configuration for aggregator function.
*
* @author Artem Bilan
* @author Corneil du Plessis
*/
@@ -65,7 +67,7 @@ public class AggregatorFunctionConfiguration {
@Bean
public Function<Flux<Message<?>>, Flux<Message<?>>> aggregatorFunction(FluxMessageChannel inputChannel,
FluxMessageChannel outputChannel) {
return input -> Flux.from(outputChannel)
return (input) -> Flux.from(outputChannel)
.doOnRequest((request) -> inputChannel.subscribeTo(input.map((
inputMessage) -> MessageBuilder.fromMessage(inputMessage).removeHeader("kafka_consumer").build())));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2020 the original author or authors.
* Copyright 2020-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.
@@ -57,7 +57,7 @@ class MessageStoreConfiguration {
static class Mongo {
@Bean
public MessageGroupStore messageStore(MongoTemplate mongoTemplate, AggregatorFunctionProperties properties) {
MessageGroupStore messageStore(MongoTemplate mongoTemplate, AggregatorFunctionProperties properties) {
if (StringUtils.hasText(properties.getMessageStoreEntity())) {
return new ConfigurableMongoDbMessageStore(mongoTemplate, properties.getMessageStoreEntity());
}
@@ -68,7 +68,7 @@ class MessageStoreConfiguration {
@Bean
@Primary
public MongoCustomConversions mongoDbCustomConversions() {
MongoCustomConversions mongoDbCustomConversions() {
return new MongoCustomConversions(
Arrays.asList(new MessageToBinaryConverter(), new BinaryToMessageConverter()));
}
@@ -82,7 +82,7 @@ class MessageStoreConfiguration {
static class Redis {
@Bean
public MessageGroupStore messageStore(RedisTemplate<?, ?> redisTemplate) {
MessageGroupStore messageStore(RedisTemplate<?, ?> redisTemplate) {
return new RedisMessageStore(redisTemplate.getConnectionFactory());
}
@@ -95,7 +95,7 @@ class MessageStoreConfiguration {
static class Jdbc {
@Bean
public MessageGroupStore messageStore(JdbcTemplate jdbcTemplate, AggregatorFunctionProperties properties) {
MessageGroupStore messageStore(JdbcTemplate jdbcTemplate, AggregatorFunctionProperties properties) {
JdbcMessageStore messageStore = new JdbcMessageStore(jdbcTemplate);
if (StringUtils.hasText(properties.getMessageStoreEntity())) {
messageStore.setTablePrefix(properties.getMessageStoreEntity());

View File

@@ -0,0 +1,4 @@
/**
* The aggregator function support classes.
*/
package org.springframework.cloud.fn.aggregator;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 the original author or authors.
* Copyright 2020-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.
@@ -20,8 +20,6 @@ import java.time.Duration;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
@@ -41,8 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat;
@TestPropertySource(properties = "aggregator.message-store-type=simple")
public class DefaultAggregatorTests extends AbstractAggregatorFunctionTests {
private static final Logger logger = LoggerFactory.getLogger(DefaultAggregatorTests.class);
@Test
public void test() {
Flux<Message<?>> input = Flux.just(
@@ -58,13 +54,17 @@ public class DefaultAggregatorTests extends AbstractAggregatorFunctionTests {
.build());
Flux<Message<?>> output = this.aggregatorFunction.apply(input.log("DefaultAggregatorTests:input"));
output.log("DefaultAggregatorTests:output").as(StepVerifier::create).assertNext((message) -> {
assertThat(message).extracting(Message::getPayload).asList().hasSize(2).contains("1", "2");
}).thenCancel().verify(Duration.ofSeconds(30));
output.log("DefaultAggregatorTests:output")
.as(StepVerifier::create)
.assertNext((message) -> assertThat(message).extracting(Message::getPayload)
.asList()
.hasSize(2)
.contains("1", "2"))
.thenCancel()
.verify(Duration.ofSeconds(30));
assertThat(this.messageGroupStore).isNull();
assertThat(this.aggregatingMessageHandler.getMessageStore()).isInstanceOf(SimpleMessageStore.class);
}
}