diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java index c32394f1..720797dc 100644 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java b/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java index c677dc5d..39a6aee6 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java +++ b/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java @@ -41,4 +41,4 @@ public class ScriptableTestConfiguration { return new BinderTestPropertiesInitializer(context, properties); } -} \ No newline at end of file +} diff --git a/applications/processor/bridge-processor/src/main/java/org/springframework/cloud/stream/app/BridgeProcessorConfiguration.java b/applications/processor/bridge-processor/src/main/java/org/springframework/cloud/stream/app/BridgeProcessorConfiguration.java index 22bf47ef..59284d61 100644 --- a/applications/processor/bridge-processor/src/main/java/org/springframework/cloud/stream/app/BridgeProcessorConfiguration.java +++ b/applications/processor/bridge-processor/src/main/java/org/springframework/cloud/stream/app/BridgeProcessorConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/processor/bridge-processor/src/test/java/org/springframework/cloud/stream/app/BridgeProcessorTests.java b/applications/processor/bridge-processor/src/test/java/org/springframework/cloud/stream/app/BridgeProcessorTests.java index fa011636..1c722ebb 100644 --- a/applications/processor/bridge-processor/src/test/java/org/springframework/cloud/stream/app/BridgeProcessorTests.java +++ b/applications/processor/bridge-processor/src/test/java/org/springframework/cloud/stream/app/BridgeProcessorTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/processor/filter-processor/src/test/java/org/springframework/cloud/stream/app/filter/processor/FilterProcessorTests.java b/applications/processor/filter-processor/src/test/java/org/springframework/cloud/stream/app/filter/processor/FilterProcessorTests.java index 51e8f5d6..c8d18fdd 100644 --- a/applications/processor/filter-processor/src/test/java/org/springframework/cloud/stream/app/filter/processor/FilterProcessorTests.java +++ b/applications/processor/filter-processor/src/test/java/org/springframework/cloud/stream/app/filter/processor/FilterProcessorTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/processor/splitter-processor/src/test/java/org/springframework/cloud/stream/app/splitter/processor/SplitterProcessorTests.java b/applications/processor/splitter-processor/src/test/java/org/springframework/cloud/stream/app/splitter/processor/SplitterProcessorTests.java index e36d4a45..213bb967 100644 --- a/applications/processor/splitter-processor/src/test/java/org/springframework/cloud/stream/app/splitter/processor/SplitterProcessorTests.java +++ b/applications/processor/splitter-processor/src/test/java/org/springframework/cloud/stream/app/splitter/processor/SplitterProcessorTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/processor/transform-processor/src/test/java/org/springframework/cloud/stream/app/transform/processor/TransformProcessorTests.java b/applications/processor/transform-processor/src/test/java/org/springframework/cloud/stream/app/transform/processor/TransformProcessorTests.java index b2198dd8..f65c2c82 100644 --- a/applications/processor/transform-processor/src/test/java/org/springframework/cloud/stream/app/transform/processor/TransformProcessorTests.java +++ b/applications/processor/transform-processor/src/test/java/org/springframework/cloud/stream/app/transform/processor/TransformProcessorTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/sink/counter-sink/src/test/java/org/springframework/cloud/stream/app/counter/sink/CounterSinkTests.java b/applications/sink/counter-sink/src/test/java/org/springframework/cloud/stream/app/counter/sink/CounterSinkTests.java index 320cb591..56a38de8 100644 --- a/applications/sink/counter-sink/src/test/java/org/springframework/cloud/stream/app/counter/sink/CounterSinkTests.java +++ b/applications/sink/counter-sink/src/test/java/org/springframework/cloud/stream/app/counter/sink/CounterSinkTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/sink/file-sink/src/test/java/org/springframework/cloud/stream/app/FileSinkTests.java b/applications/sink/file-sink/src/test/java/org/springframework/cloud/stream/app/FileSinkTests.java index 189d18cb..a6774579 100644 --- a/applications/sink/file-sink/src/test/java/org/springframework/cloud/stream/app/FileSinkTests.java +++ b/applications/sink/file-sink/src/test/java/org/springframework/cloud/stream/app/FileSinkTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/sink/jdbc-sink/src/test/java/org/springframework/cloud/stream/app/jdbc/sink/JdbcSinkTests.java b/applications/sink/jdbc-sink/src/test/java/org/springframework/cloud/stream/app/jdbc/sink/JdbcSinkTests.java index f75156ea..a363889a 100644 --- a/applications/sink/jdbc-sink/src/test/java/org/springframework/cloud/stream/app/jdbc/sink/JdbcSinkTests.java +++ b/applications/sink/jdbc-sink/src/test/java/org/springframework/cloud/stream/app/jdbc/sink/JdbcSinkTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/sink/log-sink/src/test/java/org/springframework/cloud/stream/app/LogSinkTests.java b/applications/sink/log-sink/src/test/java/org/springframework/cloud/stream/app/LogSinkTests.java index 9539e5c4..1a45314c 100644 --- a/applications/sink/log-sink/src/test/java/org/springframework/cloud/stream/app/LogSinkTests.java +++ b/applications/sink/log-sink/src/test/java/org/springframework/cloud/stream/app/LogSinkTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkInvalidConfigTests.java b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkInvalidConfigTests.java index a47cf909..c7ee1e2a 100644 --- a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkInvalidConfigTests.java +++ b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkInvalidConfigTests.java @@ -80,4 +80,4 @@ public class RabbitSinkInvalidConfigTests { } -} \ No newline at end of file +} diff --git a/applications/source/file-source/src/test/java/org.springframework.cloud.stream.app/FileSourceTests.java b/applications/source/file-source/src/test/java/org.springframework.cloud.stream.app/FileSourceTests.java index a8554648..426ca24b 100644 --- a/applications/source/file-source/src/test/java/org.springframework.cloud.stream.app/FileSourceTests.java +++ b/applications/source/file-source/src/test/java/org.springframework.cloud.stream.app/FileSourceTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/source/http-source/src/test/java/org/springframework/cloud/stream/app/HttpSourceTests.java b/applications/source/http-source/src/test/java/org/springframework/cloud/stream/app/HttpSourceTests.java index c357a759..083e19ab 100644 --- a/applications/source/http-source/src/test/java/org/springframework/cloud/stream/app/HttpSourceTests.java +++ b/applications/source/http-source/src/test/java/org/springframework/cloud/stream/app/HttpSourceTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/JdbcSourceIntegrationTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/JdbcSourceIntegrationTests.java index a1871098..44fe0871 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/JdbcSourceIntegrationTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/JdbcSourceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllNoSplitTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllNoSplitTests.java index e04dde44..1ffbf7d0 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllNoSplitTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllNoSplitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/applications/source/time-source/src/test/java/org/springframework/cloud/stream/app/TimeSourceTests.java b/applications/source/time-source/src/test/java/org/springframework/cloud/stream/app/TimeSourceTests.java index 9565462c..87573cf7 100644 --- a/applications/source/time-source/src/test/java/org/springframework/cloud/stream/app/TimeSourceTests.java +++ b/applications/source/time-source/src/test/java/org/springframework/cloud/stream/app/TimeSourceTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerConfiguration.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerConfiguration.java index f458f4fb..449b8f82 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerConfiguration.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerConfiguration.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,9 +24,16 @@ import java.util.Map; import java.util.UUID; import java.util.function.Function; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.util.StdDateFormat; +import reactor.core.publisher.Mono; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.fn.consumer.cassandra.query.ColumnNameExtractor; import org.springframework.cloud.fn.consumer.cassandra.query.InsertQueryColumnNameExtractor; +import org.springframework.cloud.fn.consumer.cassandra.query.UpdateQueryColumnNameExtractor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.cassandra.core.InsertOptions; @@ -43,13 +50,6 @@ import org.springframework.integration.transformer.AbstractPayloadTransformer; import org.springframework.messaging.MessageHandler; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.util.StdDateFormat; -import org.springframework.cloud.fn.consumer.cassandra.query.ColumnNameExtractor; -import org.springframework.cloud.fn.consumer.cassandra.query.UpdateQueryColumnNameExtractor; -import reactor.core.publisher.Mono; - /** * @author Artem Bilan * @author Thomas Risberg @@ -65,7 +65,7 @@ public class CassandraConsumerConfiguration { @Bean public IntegrationFlow cassandraConsumerFlow(MessageHandler cassandraSinkMessageHandler, - ObjectMapper objectMapper) { + ObjectMapper objectMapper) { IntegrationFlowBuilder integrationFlowBuilder = IntegrationFlows.from(CassandraConsumerFunction.class); if (StringUtils.hasText(this.cassandraSinkProperties.getIngestQuery())) { diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerProperties.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerProperties.java index 1af4094d..13869726 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerProperties.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerProperties.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,12 +16,12 @@ package org.springframework.cloud.fn.consumer.cassandra; +import com.datastax.oss.driver.api.core.ConsistencyLevel; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.expression.Expression; import org.springframework.integration.cassandra.outbound.CassandraMessageHandler; -import com.datastax.oss.driver.api.core.ConsistencyLevel; - /** * @author Artem Bilan * @author Thomas Risberg diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraAppClusterConfiguration.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraAppClusterConfiguration.java index 06e60ab4..77c04e5e 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraAppClusterConfiguration.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraAppClusterConfiguration.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,6 +23,10 @@ import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Scanner; +import com.datastax.oss.driver.api.core.CqlSession; +import com.datastax.oss.driver.api.core.CqlSessionBuilder; +import reactor.core.publisher.Flux; + import org.springframework.beans.factory.BeanInitializationException; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.boot.autoconfigure.cassandra.CassandraProperties; @@ -49,10 +53,6 @@ import org.springframework.data.cassandra.core.cql.generator.CreateKeyspaceCqlGe import org.springframework.data.cassandra.core.cql.keyspace.CreateKeyspaceSpecification; import org.springframework.util.StringUtils; -import com.datastax.oss.driver.api.core.CqlSession; -import com.datastax.oss.driver.api.core.CqlSessionBuilder; -import reactor.core.publisher.Flux; - /** * @author Artem Bilan * @author Thomas Risberg diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraClusterProperties.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraClusterProperties.java index 67e7e549..0d2f46aa 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraClusterProperties.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/CassandraClusterProperties.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -40,7 +40,7 @@ public class CassandraClusterProperties { private Resource initScript; /** - * Flag to validate the Servers' SSL certs + * Flag to validate the Servers' SSL certs. */ private boolean skipSslValidation; diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/TrustAllSSLContextFactory.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/TrustAllSSLContextFactory.java index 97535139..5987b88b 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/TrustAllSSLContextFactory.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/cluster/TrustAllSSLContextFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -35,7 +35,11 @@ import javax.net.ssl.X509TrustManager; * @author Rob Hardt * @author Artem Bilan */ -class TrustAllSSLContextFactory { +final class TrustAllSSLContextFactory { + + private TrustAllSSLContextFactory() { + + } static SSLContext getSslContext() throws NoSuchAlgorithmException, KeyManagementException { diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/ColumnNameExtractor.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/ColumnNameExtractor.java index 19d0d769..92bb70b9 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/ColumnNameExtractor.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/ColumnNameExtractor.java @@ -1,10 +1,11 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/InsertQueryColumnNameExtractor.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/InsertQueryColumnNameExtractor.java index 967fcd0f..befdc6ca 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/InsertQueryColumnNameExtractor.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/InsertQueryColumnNameExtractor.java @@ -1,10 +1,11 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/UpdateQueryColumnNameExtractor.java b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/UpdateQueryColumnNameExtractor.java index 462478b5..7352f961 100644 --- a/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/UpdateQueryColumnNameExtractor.java +++ b/functions/consumer/cassandra-consumer/src/main/java/org/springframework/cloud/fn/consumer/cassandra/query/UpdateQueryColumnNameExtractor.java @@ -1,10 +1,11 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerApplicationTests.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerApplicationTests.java index df0652bd..c140bbd5 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerApplicationTests.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraConsumerApplicationTests.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.UUID; import java.util.function.Function; -import org.springframework.cloud.fn.consumer.cassandra.domain.Book; import org.cassandraunit.spring.CassandraUnitDependencyInjectionIntegrationTestExecutionListener; import org.cassandraunit.spring.EmbeddedCassandra; import org.cassandraunit.utils.EmbeddedCassandraServerHelper; @@ -34,6 +33,7 @@ import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.fn.consumer.cassandra.domain.Book; import org.springframework.data.cassandra.core.CassandraOperations; import org.springframework.data.cassandra.core.WriteResult; import org.springframework.test.annotation.DirtiesContext; @@ -98,6 +98,8 @@ abstract class CassandraConsumerApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + + } } diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraEntityInsertTests.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraEntityInsertTests.java index 9ea74e77..4159262a 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraEntityInsertTests.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraEntityInsertTests.java @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.cassandra; -import static org.assertj.core.api.Assertions.assertThat; - import java.time.LocalDate; import java.util.UUID; @@ -25,13 +23,14 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import org.springframework.cloud.fn.consumer.cassandra.domain.Book; import org.springframework.data.cassandra.core.WriteResult; import org.springframework.test.context.TestPropertySource; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestInsertTests.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestInsertTests.java index dd3cdabd..5556aaed 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestInsertTests.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestInsertTests.java @@ -16,13 +16,14 @@ package org.springframework.cloud.fn.consumer.cassandra; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.fn.consumer.cassandra.domain.Book; @@ -30,9 +31,7 @@ import org.springframework.data.cassandra.core.WriteResult; import org.springframework.integration.support.json.Jackson2JsonObjectMapper; import org.springframework.test.context.TestPropertySource; -import com.fasterxml.jackson.databind.ObjectMapper; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestNamedParamsTests.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestNamedParamsTests.java index 844a12cc..43aee559 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestNamedParamsTests.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestNamedParamsTests.java @@ -16,13 +16,14 @@ package org.springframework.cloud.fn.consumer.cassandra; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.fn.consumer.cassandra.domain.Book; @@ -31,9 +32,7 @@ import org.springframework.integration.support.json.Jackson2JsonObjectMapper; import org.springframework.test.context.TestPropertySource; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestUpdateTests.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestUpdateTests.java index 2f64956c..3ff21add 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestUpdateTests.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/CassandraIngestUpdateTests.java @@ -16,13 +16,14 @@ package org.springframework.cloud.fn.consumer.cassandra; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.fn.consumer.cassandra.domain.Book; @@ -30,9 +31,7 @@ import org.springframework.data.cassandra.core.WriteResult; import org.springframework.integration.support.json.Jackson2JsonObjectMapper; import org.springframework.test.context.TestPropertySource; -import com.fasterxml.jackson.databind.ObjectMapper; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/domain/Book.java b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/domain/Book.java index f1d30388..43432dbe 100644 --- a/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/domain/Book.java +++ b/functions/consumer/cassandra-consumer/src/test/java/org/springframework/cloud/fn/consumer/cassandra/domain/Book.java @@ -1,11 +1,11 @@ /* - * Copyright 2015-2020 the original author or authors + * Copyright 2019-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerConfiguration.java b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerConfiguration.java index 09bd9f0d..08ea8ad2 100644 --- a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerConfiguration.java +++ b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -48,11 +48,10 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** - * * @author Christian Tzolov */ @Configuration -@EnableConfigurationProperties({ CounterConsumerProperties.class }) +@EnableConfigurationProperties({CounterConsumerProperties.class}) public class CounterConsumerConfiguration { @Bean @@ -73,7 +72,7 @@ public class CounterConsumerConfiguration { @Bean(name = "counterConsumer") public Consumer> counterConsumer(CounterConsumerProperties properties, MeterRegistry[] meterRegistries, - @Qualifier(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME) EvaluationContext context) { + @Qualifier(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME) EvaluationContext context) { return message -> { @@ -104,6 +103,7 @@ public class CounterConsumerConfiguration { /** * Converts a key/value Map into Tag(key,value) list. Filters out the empty key/value pairs. + * * @param keyValueMap key/value map to convert into tags. * @return Returns Tags list representing every non-empty key/value pair. */ @@ -119,6 +119,7 @@ public class CounterConsumerConfiguration { * Converts the input value into an list of values. If the value is not a collection/array type the result * is a single element list. For collection/array input value the result is the list of stringifie content of * this collection. + * * @param value input value can be array, collection or single value. * @return Returns value list. */ diff --git a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerProperties.java b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerProperties.java index a3442fd8..52de6eef 100644 --- a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerProperties.java +++ b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -34,7 +34,7 @@ import org.springframework.validation.annotation.Validated; public class CounterConsumerProperties { /** - * The default name of the increment + * The default name of the increment. */ @Value("${spring.application.name:counts}") private String defaultName; @@ -68,47 +68,6 @@ public class CounterConsumerProperties { */ private MetricsTag tag = new MetricsTag(); - public static class MetricsTag { - - /** - * Custom tags assigned to every counter increment measurements. - * This is a map so the property convention fixed tags is: counter.tag.fixed.[tag-name]=[tag-value] - */ - private Map fixed; - - /** - * Computes tags from SpEL expression. - * Single SpEL expression can produce an array of values, which in turn means distinct name/value tags. - * Every name/value tag will produce a separate counter increment. - * Tag expression format is: counter.tag.expression.[tag-name]=[SpEL expression] - */ - private Map expression; - - public Map getFixed() { - return fixed; - } - - public void setFixed(Map fixed) { - this.fixed = fixed; - } - - public Map getExpression() { - return expression; - } - - public void setExpression(Map expression) { - this.expression = expression; - } - - @Override - public String toString() { - return "MetricsTag{" + - "fixed=" + fixed + - ", expression=" + expression + - '}'; - } - } - public MetricsTag getTag() { return tag; } @@ -169,4 +128,45 @@ public class CounterConsumerProperties { ", tag=" + tag + '}'; } + + public static class MetricsTag { + + /** + * Custom tags assigned to every counter increment measurements. + * This is a map so the property convention fixed tags is: counter.tag.fixed.[tag-name]=[tag-value] + */ + private Map fixed; + + /** + * Computes tags from SpEL expression. + * Single SpEL expression can produce an array of values, which in turn means distinct name/value tags. + * Every name/value tag will produce a separate counter increment. + * Tag expression format is: counter.tag.expression.[tag-name]=[SpEL expression] + */ + private Map expression; + + public Map getFixed() { + return fixed; + } + + public void setFixed(Map fixed) { + this.fixed = fixed; + } + + public Map getExpression() { + return expression; + } + + public void setExpression(Map expression) { + this.expression = expression; + } + + @Override + public String toString() { + return "MetricsTag{" + + "fixed=" + fixed + + ", expression=" + expression + + '}'; + } + } } diff --git a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/StringToSpelConversionFunction.java b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/StringToSpelConversionFunction.java index a8a5e99f..2f7e21e1 100644 --- a/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/StringToSpelConversionFunction.java +++ b/functions/consumer/counter-consumer/src/main/java/org/springframework/cloud/fn/consumer/counter/StringToSpelConversionFunction.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -26,7 +26,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser; /** * Converter from String to Spring Expression. - * + *

* TODO: This could be a top level project. */ public class StringToSpelConversionFunction implements Function { diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ConverterFunctionAdapter.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ConverterFunctionAdapter.java index 14f21775..f41ae10e 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ConverterFunctionAdapter.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ConverterFunctionAdapter.java @@ -1,3 +1,19 @@ +/* + * Copyright 2020-2020 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.fn.consumer.counter; import java.util.function.Function; @@ -7,7 +23,7 @@ import org.springframework.core.convert.converter.Converter; /** * @author Christian Tzolov */ -public class ConverterFunctionAdapter implements Converter { +public class ConverterFunctionAdapter implements Converter { private Function function; diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CountWithAmountTest.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CountWithAmountTest.java index 92ef115c..7652db41 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CountWithAmountTest.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CountWithAmountTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerParentTest.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerParentTest.java index 78f4790f..eb20a78f 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerParentTest.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/CounterConsumerParentTest.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -42,5 +42,6 @@ public class CounterConsumerParentTest { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/EmptyTagsTests.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/EmptyTagsTests.java index 898e67ac..d2a0d9be 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/EmptyTagsTests.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/EmptyTagsTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; "counter.name=counter666", "counter.tag.fixed.foo=", "counter.tag.expression.tag666=#jsonPath(payload,'$..noField')", - "counter.tag.expression.test=#jsonPath(payload,'$..test')", + "counter.tag.expression.test=#jsonPath(payload,'$..test')" }) class EmptyTagsTests extends CounterConsumerParentTest { diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ExpressionCounterNameTests.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ExpressionCounterNameTests.java index 99d5c881..67c9ea72 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ExpressionCounterNameTests.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/ExpressionCounterNameTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/FixedTagsTests.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/FixedTagsTests.java index a2debb41..7274df87 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/FixedTagsTests.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/FixedTagsTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/LiteralTagExpressionsTests.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/LiteralTagExpressionsTests.java index 63a783e8..2d3231e6 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/LiteralTagExpressionsTests.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/LiteralTagExpressionsTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/NullTagsTests.java b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/NullTagsTests.java index 79c75708..420c1536 100644 --- a/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/NullTagsTests.java +++ b/functions/consumer/counter-consumer/src/test/java/org/springframework/cloud/fn/consumer/counter/NullTagsTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; "counter.name=counter666", "counter.tag.fixed.foo=", "counter.tag.expression.tag666=#jsonPath(payload,'$..noField')", - "counter.tag.expression.test=#jsonPath(payload,'$..test')", + "counter.tag.expression.test=#jsonPath(payload,'$..test')" }) public class NullTagsTests extends CounterConsumerParentTest { diff --git a/functions/consumer/file-consumer/src/main/java/org/springframework/cloud/fn/consumer/file/FileConsumerProperties.java b/functions/consumer/file-consumer/src/main/java/org/springframework/cloud/fn/consumer/file/FileConsumerProperties.java index eb861a61..58f5d45a 100644 --- a/functions/consumer/file-consumer/src/main/java/org/springframework/cloud/fn/consumer/file/FileConsumerProperties.java +++ b/functions/consumer/file-consumer/src/main/java/org/springframework/cloud/fn/consumer/file/FileConsumerProperties.java @@ -119,14 +119,14 @@ public class FileConsumerProperties { this.mode = mode; } - public void setName(String name) { - this.name = name; - } - public String getName() { return name; } + public void setName(String name) { + this.name = name; + } + public String getNameExpression() { return (nameExpression != null) ? nameExpression + " + '" + getSuffix() + "'" diff --git a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/AbstractFileConsumerTests.java b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/AbstractFileConsumerTests.java index e886e5ec..5a97e081 100644 --- a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/AbstractFileConsumerTests.java +++ b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/AbstractFileConsumerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -22,6 +22,7 @@ import java.util.function.Consumer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; diff --git a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/BinaryFileTests.java b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/BinaryFileTests.java index 15b4ac02..ef6b2bdc 100644 --- a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/BinaryFileTests.java +++ b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/BinaryFileTests.java @@ -19,6 +19,7 @@ package org.springframework.cloud.fn.consumer.file; import java.io.File; import org.junit.jupiter.api.Test; + import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.TestPropertySource; import org.springframework.util.FileCopyUtils; diff --git a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/ExpressionTests.java b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/ExpressionTests.java index 5eeb4cfd..91138ff5 100644 --- a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/ExpressionTests.java +++ b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/ExpressionTests.java @@ -23,6 +23,7 @@ import java.util.function.Consumer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.integration.support.MessageBuilder; @@ -36,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Mark Fisher * @author Artem Bilan * @author Soby Chacko - * + *

* We don't need a separate SpringBootApplication for this test as there is already one available in this package. * {@link AbstractFileConsumerTests}. */ diff --git a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/TextFileTests.java b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/TextFileTests.java index 38aa77a0..60a9b218 100644 --- a/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/TextFileTests.java +++ b/functions/consumer/file-consumer/src/test/java/org/springframework/cloud/fn/consumer/file/TextFileTests.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileReader; import org.junit.jupiter.api.Test; + import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.TestPropertySource; import org.springframework.util.FileCopyUtils; diff --git a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/DefaultInitializationScriptResource.java b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/DefaultInitializationScriptResource.java index 90d671c4..df838db3 100644 --- a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/DefaultInitializationScriptResource.java +++ b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/DefaultInitializationScriptResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerConfiguration.java b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerConfiguration.java index ebe29278..9470fbbf 100644 --- a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerConfiguration.java +++ b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -27,7 +27,6 @@ import java.util.stream.StreamSupport; import javax.sql.DataSource; import com.fasterxml.jackson.databind.JsonNode; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -72,7 +71,6 @@ import org.springframework.util.MimeTypeUtils; import org.springframework.util.MultiValueMap; /** - * * @author Eric Bottard * @author Thomas Risberg * @author Robert St. John @@ -102,9 +100,36 @@ public class JdbcConsumerConfiguration { standardEvaluationContext.addPropertyAccessor(new JsonPropertyAccessor()); } + @Bean + public static ShorthandMapConverter shorthandMapConverter() { + return new ShorthandMapConverter(); + } + + private static boolean convertibleContentType(String contentType) { + return contentType.contains("text") || contentType.contains("json") || contentType.contains("x-spring-tuple"); + } + + private static String generateSql(String tableName, Set columns) { + StringBuilder builder = new StringBuilder("INSERT INTO "); + StringBuilder questionMarks = new StringBuilder(") VALUES ("); + builder.append(tableName).append("("); + int i = 0; + + for (String column : columns) { + if (i++ > 0) { + builder.append(", "); + questionMarks.append(", "); + } + builder.append(column); + questionMarks.append(':').append(column); + } + builder.append(questionMarks).append(")"); + return builder.toString(); + } + @Bean IntegrationFlow jdbcConsumerFlow(@Qualifier("aggregator") MessageHandler aggregator, - JdbcMessageHandler jdbcMessageHandler) { + JdbcMessageHandler jdbcMessageHandler) { final IntegrationFlowBuilder builder = IntegrationFlows.from(Consumer.class, gateway -> gateway.beanName("jdbcConsumer")); @@ -216,33 +241,6 @@ public class JdbcConsumerConfiguration { return dataSourceInitializer; } - @Bean - public static ShorthandMapConverter shorthandMapConverter() { - return new ShorthandMapConverter(); - } - - private static boolean convertibleContentType(String contentType) { - return contentType.contains("text") || contentType.contains("json") || contentType.contains("x-spring-tuple"); - } - - private static String generateSql(String tableName, Set columns) { - StringBuilder builder = new StringBuilder("INSERT INTO "); - StringBuilder questionMarks = new StringBuilder(") VALUES ("); - builder.append(tableName).append("("); - int i = 0; - - for (String column : columns) { - if (i++ > 0) { - builder.append(", "); - questionMarks.append(", "); - } - builder.append(column); - questionMarks.append(':').append(column); - } - builder.append(questionMarks).append(")"); - return builder.toString(); - } - private static final class ParameterFactory implements SqlParameterSourceFactory { private final MultiValueMap columnExpressions; diff --git a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerProperties.java b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerProperties.java index 3afae4a1..a3c5d3f1 100644 --- a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerProperties.java +++ b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/ShorthandMapConverter.java b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/ShorthandMapConverter.java index ec925b85..78534e99 100644 --- a/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/ShorthandMapConverter.java +++ b/functions/consumer/jdbc-consumer/src/main/java/org/springframework/cloud/fn/consumer/jdbc/ShorthandMapConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/BatchInsertTimeoutTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/BatchInsertTimeoutTests.java index f0f64056..2c171599 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/BatchInsertTimeoutTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/BatchInsertTimeoutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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,12 +18,11 @@ package org.springframework.cloud.fn.consumer.jdbc; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; + import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; -import static org.assertj.core.api.Assertions.assertThat; - /** * @author Eric Bottard * @author Thomas Risberg @@ -33,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Soby Chacko * @author Szabolcs Stremler */ -@TestPropertySource(properties = { "jdbc.consumer.batchSize=1000", "jdbc.consumer.idleTimeout=100" }) +@TestPropertySource(properties = {"jdbc.consumer.batchSize=1000", "jdbc.consumer.idleTimeout=100"}) public class BatchInsertTimeoutTests extends JdbcConsumerApplicationTests { @Test diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/DataReceivedAsByteArrayTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/DataReceivedAsByteArrayTests.java index f7857f93..e4e9b9df 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/DataReceivedAsByteArrayTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/DataReceivedAsByteArrayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,14 +16,14 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ExplicitTableCreationTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ExplicitTableCreationTests.java index 375db87a..bba4fb4e 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ExplicitTableCreationTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ExplicitTableCreationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -34,9 +34,9 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Soby Chacko * @author Szabolcs Stremler */ -@TestPropertySource(properties = { "jdbc.consumer.tableName=foobar", +@TestPropertySource(properties = {"jdbc.consumer.tableName=foobar", "jdbc.consumer.initialize=classpath:explicit-script.sql", - "jdbc.consumer.columns=a,b" }) + "jdbc.consumer.columns=a,b"}) public class ExplicitTableCreationTests extends JdbcConsumerApplicationTests { @Test diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/HeaderInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/HeaderInsertTests.java index c5cc13f8..b8c1ceaf 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/HeaderInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/HeaderInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -17,6 +17,7 @@ package org.springframework.cloud.fn.consumer.jdbc; import org.junit.jupiter.api.Test; + import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ImplicitTableCreationTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ImplicitTableCreationTests.java index 3915f29f..0d79c476 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ImplicitTableCreationTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/ImplicitTableCreationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; @TestPropertySource(properties = { "jdbc.consumer.tableName=no_script", "jdbc.consumer.initialize=true", - "jdbc.consumer.columns=a,b" }) + "jdbc.consumer.columns=a,b"}) public class ImplicitTableCreationTests extends JdbcConsumerApplicationTests { @Test diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerApplicationTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerApplicationTests.java index e4bff00a..fe88a485 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerApplicationTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JdbcConsumerApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -55,10 +55,10 @@ public class JdbcConsumerApplicationTests { private Integer b; - public Payload() { + Payload() { } - public Payload(String a, Integer b) { + Payload(String a, Integer b) { this.a = a; this.b = b; } @@ -67,14 +67,14 @@ public class JdbcConsumerApplicationTests { return a; } - public Integer getB() { - return b; - } - public void setA(String a) { this.a = a; } + public Integer getB() { + return b; + } + public void setB(Integer b) { this.b = b; } @@ -87,6 +87,7 @@ public class JdbcConsumerApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JsonStringPayloadInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JsonStringPayloadInsertTests.java index 0ffcc35e..c167e70e 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JsonStringPayloadInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/JsonStringPayloadInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,14 +16,14 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/MapPayloadInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/MapPayloadInsertTests.java index e5b38384..9ecce9cf 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/MapPayloadInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/MapPayloadInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.HashMap; import java.util.Map; @@ -29,6 +27,8 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleBatchInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleBatchInsertTests.java index ecf8e287..29d52b6f 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleBatchInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleBatchInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,14 +16,14 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleInsertTests.java index f0826573..66566f96 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,13 +16,13 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleMappingTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleMappingTests.java index 428a266b..3efbe4b4 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleMappingTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SimpleMappingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; @@ -25,6 +23,8 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SpELTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SpELTests.java index 9eb8fd9b..8ec1ddf0 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SpELTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/SpELTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; @@ -25,6 +23,8 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/UnqualifiableColumnExpressionTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/UnqualifiableColumnExpressionTests.java index 9fb69a97..3f5f829a 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/UnqualifiableColumnExpressionTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/UnqualifiableColumnExpressionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,13 +16,13 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Eric Bottard * @author Thomas Risberg diff --git a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/VaryingInsertTests.java b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/VaryingInsertTests.java index bb48f807..8fafda2b 100644 --- a/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/VaryingInsertTests.java +++ b/functions/consumer/jdbc-consumer/src/test/java/org/springframework/cloud/fn/consumer/jdbc/VaryingInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.jdbc; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import org.assertj.core.api.Assertions; diff --git a/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerConfiguration.java b/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerConfiguration.java index 3b17411e..96be80ab 100644 --- a/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerConfiguration.java +++ b/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -47,6 +47,8 @@ public class LogConsumerConfiguration { .get(); } - private interface MessageConsumer extends Consumer> {} + private interface MessageConsumer extends Consumer> { + + } } diff --git a/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerProperties.java b/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerProperties.java index ff9b9528..d87d44d3 100644 --- a/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerProperties.java +++ b/functions/consumer/log-consumer/src/main/java/org/springframework/cloud/fn/consumer/log/LogConsumerProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.consumer.log; -import static org.springframework.integration.handler.LoggingHandler.Level.INFO; - import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -26,6 +24,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.integration.handler.LoggingHandler; import org.springframework.validation.annotation.Validated; +import static org.springframework.integration.handler.LoggingHandler.Level.INFO; + /** * Configuration properties for the Log Sink app. * diff --git a/functions/consumer/log-consumer/src/test/java/org/springframework/cloud/fn/consumer/log/LogConsumerApplicationTests.java b/functions/consumer/log-consumer/src/test/java/org/springframework/cloud/fn/consumer/log/LogConsumerApplicationTests.java index cf2b837f..ca7fedf1 100644 --- a/functions/consumer/log-consumer/src/test/java/org/springframework/cloud/fn/consumer/log/LogConsumerApplicationTests.java +++ b/functions/consumer/log-consumer/src/test/java/org/springframework/cloud/fn/consumer/log/LogConsumerApplicationTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -87,5 +87,6 @@ class LogConsumerApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/consumer/mongodb-consumer/src/main/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerProperties.java b/functions/consumer/mongodb-consumer/src/main/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerProperties.java index 838cbf4c..00346cde 100644 --- a/functions/consumer/mongodb-consumer/src/main/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerProperties.java +++ b/functions/consumer/mongodb-consumer/src/main/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerProperties.java @@ -17,8 +17,6 @@ package org.springframework.cloud.fn.consumer.mongo; import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.expression.Expression; @@ -34,12 +32,12 @@ import org.springframework.validation.annotation.Validated; public class MongoDbConsumerProperties { /** - * The MongoDB collection to store data + * The MongoDB collection to store data. */ private String collection; /** - * The SpEL expression to evaluate MongoDB collection + * The SpEL expression to evaluate MongoDB collection. */ private Expression collectionExpression; diff --git a/functions/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java b/functions/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java index d3c1a3fa..260aabad 100644 --- a/functions/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java +++ b/functions/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java @@ -20,16 +20,16 @@ import java.time.Duration; import java.util.Comparator; import java.util.HashMap; import java.util.Map; - import java.util.function.Function; + import org.bson.Document; import org.junit.jupiter.api.Test; -import org.springframework.boot.autoconfigure.SpringBootApplication; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.messaging.Message; @@ -76,16 +76,17 @@ class MongoDbConsumerApplicationTests { .assertNext(document -> { assertThat(document.get("foo")).isEqualTo("bar"); }) - .assertNext(document-> { + .assertNext(document -> { assertThat(document.get("firstName")).isEqualTo("Foo"); assertThat(document.get("lastName")).isEqualTo("Bar"); }) - .assertNext(document-> { + .assertNext(document -> { assertThat(document.get("my_data")).isEqualTo("THE DATA"); }) .verifyComplete(); } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/consumer/rabbit-consumer/src/main/java/org/springframework/cloud/fn/consumer/rabbit/RabbitConsumerProperties.java b/functions/consumer/rabbit-consumer/src/main/java/org/springframework/cloud/fn/consumer/rabbit/RabbitConsumerProperties.java index 654a9c2b..df1a15eb 100644 --- a/functions/consumer/rabbit-consumer/src/main/java/org/springframework/cloud/fn/consumer/rabbit/RabbitConsumerProperties.java +++ b/functions/consumer/rabbit-consumer/src/main/java/org/springframework/cloud/fn/consumer/rabbit/RabbitConsumerProperties.java @@ -26,6 +26,9 @@ import org.springframework.validation.annotation.Validated; @Validated public class RabbitConsumerProperties { + /** + * JSON Converter. + */ public static final String JSON_CONVERTER = "jsonConverter"; /** @@ -139,4 +142,4 @@ public class RabbitConsumerProperties { this.ownConnection = ownConnection; } -} \ No newline at end of file +} diff --git a/functions/function/filter-function/pom.xml b/functions/function/filter-function/pom.xml index 5e5b72d5..28132cf0 100644 --- a/functions/function/filter-function/pom.xml +++ b/functions/function/filter-function/pom.xml @@ -1,36 +1,36 @@ - - 4.0.0 - filter-function - 1.0.0.BUILD-SNAPSHOT - filter-function - Spring Native Function for applying filter SpEL expressions + + 4.0.0 + filter-function + 1.0.0.BUILD-SNAPSHOT + filter-function + Spring Native Function for applying filter SpEL expressions - - org.springframework.cloud.fn - spring-functions-parent - 1.0.0.BUILD-SNAPSHOT - ../../spring-functions-parent - + + org.springframework.cloud.fn + spring-functions-parent + 1.0.0.BUILD-SNAPSHOT + ../../spring-functions-parent + - - - org.springframework.cloud.fn - spel-function - 1.0.0.BUILD-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - + + + org.springframework.cloud.fn + spel-function + 1.0.0.BUILD-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + diff --git a/functions/function/filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java b/functions/function/filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java index 9859446c..0fc5ebb6 100644 --- a/functions/function/filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java +++ b/functions/function/filter-function/src/main/java/org/springframework/cloud/fn/filter/FilterFunctionConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/function/filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java b/functions/function/filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java index 23afb9be..88f26c30 100644 --- a/functions/function/filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java +++ b/functions/function/filter-function/src/test/java/org/springframework/cloud/fn/filter/FilterFunctionApplicationTests.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.filter; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.function.Function; import org.junit.jupiter.api.Test; @@ -30,6 +28,8 @@ import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(properties = "spel.function.expression=payload.length() > 5") @DirtiesContext public class FilterFunctionApplicationTests { @@ -49,5 +49,6 @@ public class FilterFunctionApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/function/payload-converter-function/src/main/java/functions/ByteArrayTextToString.java b/functions/function/payload-converter-function/src/main/java/functions/ByteArrayTextToString.java index 2aecc905..d087db26 100644 --- a/functions/function/payload-converter-function/src/main/java/functions/ByteArrayTextToString.java +++ b/functions/function/payload-converter-function/src/main/java/functions/ByteArrayTextToString.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/function/payload-converter-function/src/test/java/functions/ByteArrayTextToStringTests.java b/functions/function/payload-converter-function/src/test/java/functions/ByteArrayTextToStringTests.java index 24b8a93e..f6492f0e 100644 --- a/functions/function/payload-converter-function/src/test/java/functions/ByteArrayTextToStringTests.java +++ b/functions/function/payload-converter-function/src/test/java/functions/ByteArrayTextToStringTests.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java b/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java index 9e682b1e..c3279d13 100644 --- a/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java +++ b/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java b/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java index 89bfec3f..36ba3da9 100644 --- a/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java +++ b/functions/function/spel-function/src/main/java/org/springframework/cloud/fn/spel/SpelFunctionProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,12 +36,12 @@ public class SpelFunctionProperties { */ private String expression = DEFAULT_EXPRESSION.getExpressionString(); - public void setExpression(String expression) { - this.expression = expression; - } - public String getExpression() { return this.expression; } + public void setExpression(String expression) { + this.expression = expression; + } + } diff --git a/functions/function/spel-function/src/test/java/org/springframework/cloud/fn/spel/SpelFunctionApplicationTests.java b/functions/function/spel-function/src/test/java/org/springframework/cloud/fn/spel/SpelFunctionApplicationTests.java index 1ef016c3..b3a66186 100644 --- a/functions/function/spel-function/src/test/java/org/springframework/cloud/fn/spel/SpelFunctionApplicationTests.java +++ b/functions/function/spel-function/src/test/java/org/springframework/cloud/fn/spel/SpelFunctionApplicationTests.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionConfiguration.java b/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionConfiguration.java index 7d1897c7..11f3e3b6 100644 --- a/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionConfiguration.java +++ b/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2011-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,6 +21,7 @@ import java.util.List; import java.util.function.Function; import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -38,15 +39,13 @@ import org.springframework.integration.splitter.ExpressionEvaluatingSplitter; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import reactor.core.publisher.Flux; - @Configuration @EnableConfigurationProperties(SplitterFunctionProperties.class) public class SplitterFunctionConfiguration { @Bean public Function, List>> splitterFunction(AbstractMessageSplitter messageSplitter, - SplitterFunctionProperties splitterFunctionProperties) { + SplitterFunctionProperties splitterFunctionProperties) { messageSplitter.setApplySequence(splitterFunctionProperties.isApplySequence()); ThreadLocalFluxSinkMessageChannel outputChannel = new ThreadLocalFluxSinkMessageChannel(); @@ -97,10 +96,12 @@ public class SplitterFunctionConfiguration { } @ConditionalOnProperty(prefix = "splitter", name = "charset") - static class Charset { } + static class Charset { + } @ConditionalOnProperty(prefix = "splitter", name = "fileMarkers") - static class FileMarkers { } + static class FileMarkers { + } } diff --git a/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionProperties.java b/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionProperties.java index 9749f95f..54fd3f70 100644 --- a/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionProperties.java +++ b/functions/function/splitter-function/src/main/java/org/springframework/cloud/fn/splitter/SplitterFunctionProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -67,14 +67,14 @@ public class SplitterFunctionProperties { */ private boolean applySequence = true; - public void setExpression(String expression) { - this.expression = expression; - } - public String getExpression() { return this.expression; } + public void setExpression(String expression) { + this.expression = expression; + } + public String getDelimiters() { return this.delimiters; } diff --git a/functions/function/splitter-function/src/test/java/org/springframework/cloud/fn/splitter/SplitterFunctionApplicationTests.java b/functions/function/splitter-function/src/test/java/org/springframework/cloud/fn/splitter/SplitterFunctionApplicationTests.java index 6a8a5f94..42a9d0d1 100644 --- a/functions/function/splitter-function/src/test/java/org/springframework/cloud/fn/splitter/SplitterFunctionApplicationTests.java +++ b/functions/function/splitter-function/src/test/java/org/springframework/cloud/fn/splitter/SplitterFunctionApplicationTests.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2020 Pivotal Software Inc, All Rights Reserved. + * Copyright 2011-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,8 +16,6 @@ package org.springframework.cloud.fn.splitter; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.function.Function; @@ -30,6 +28,8 @@ import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(properties = "splitter.expression=payload.split(',')") @DirtiesContext public class SplitterFunctionApplicationTests { @@ -44,5 +44,6 @@ public class SplitterFunctionApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/pom.xml b/functions/pom.xml index cfd3fd98..b0f4bfb2 100644 --- a/functions/pom.xml +++ b/functions/pom.xml @@ -17,6 +17,26 @@ UTF-8 ${java.version} ${java.version} + 3.0.1 + 3.1.0 + false + true + true + true + 8.29 + + https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml + + + https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/nohttp-checkstyle.xml + + + https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml + + 0.0.2.RELEASE + true + 0.0.7 + 3.0.0-SNAPSHOT @@ -113,6 +133,77 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + com.puppycrawl.tools + checkstyle + ${puppycrawl-tools-checkstyle.version} + + + io.spring.javaformat + spring-javaformat-checkstyle + ${spring-javaformat-checkstyle.version} + + + org.springframework.cloud + spring-cloud-build-tools + ${spring-cloud-build.version} + + + io.spring.nohttp + nohttp-checkstyle + ${nohttp-checkstyle.version} + + + + + checkstyle-validation + validate + true + + ${disable.checks} + checkstyle.xml + checkstyle-header.txt + + checkstyle.build.directory=${project.build.directory} + checkstyle.suppressions.file=${checkstyle.suppressions.file} + checkstyle.additional.suppressions.file=${checkstyle.additional.suppressions.file} + + true + + ${maven-checkstyle-plugin.includeTestSourceDirectory} + + ${maven-checkstyle-plugin.failsOnError} + + + ${maven-checkstyle-plugin.failOnViolation} + + + + check + + + + no-http-checkstyle-validation + validate + true + + ${disable.nohttp.checks} + ${checkstyle.nohttp.file} + **/* + **/.idea/**/*,**/.git/**/*,**/target/**/*,**/*.log + ./ + + + check + + + + diff --git a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileConsumerProperties.java b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileConsumerProperties.java index b5c08234..c878cb04 100644 --- a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileConsumerProperties.java +++ b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileConsumerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -41,8 +41,8 @@ public class FileConsumerProperties { private FileReadingMode mode = FileReadingMode.contents; /** - * Set to true to emit start of file/end of file marker messages before/after the data. - * Only valid with FileReadingMode 'lines'. + * Set to true to emit start of file/end of file marker messages before/after the data. + * Only valid with FileReadingMode 'lines'. */ private Boolean withMarkers = null; diff --git a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileReadingMode.java b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileReadingMode.java index 3d357733..bf807da2 100644 --- a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileReadingMode.java +++ b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileReadingMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -23,7 +23,16 @@ package org.springframework.cloud.fn.supplier.file; * @author David Turanski */ public enum FileReadingMode { + /** + * ref mode. + */ ref, + /** + * lines mode. + */ lines, + /** + * contents mode. + */ contents; } diff --git a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierConfiguration.java b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierConfiguration.java index ff4139a6..3261c4fe 100644 --- a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierConfiguration.java +++ b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -19,6 +19,10 @@ package org.springframework.cloud.fn.supplier.file; import java.util.function.Supplier; import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; @@ -33,9 +37,6 @@ import org.springframework.integration.file.dsl.FileInboundChannelAdapterSpec; import org.springframework.integration.file.dsl.Files; import org.springframework.messaging.Message; import org.springframework.util.StringUtils; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; /** * @author Artem Bilan @@ -55,7 +56,7 @@ public class FileSupplierConfiguration { private FileReadingMessageSource fileMessageSource; public FileSupplierConfiguration(FileSupplierProperties fileSupplierProperties, - FileConsumerProperties fileConsumerProperties) { + FileConsumerProperties fileConsumerProperties) { this.fileSupplierProperties = fileSupplierProperties; this.fileConsumerProperties = fileConsumerProperties; } diff --git a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierProperties.java b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierProperties.java index 3e14582b..d0870b64 100644 --- a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierProperties.java +++ b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileSupplierProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileUtils.java b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileUtils.java index 7e1e04e0..163d8699 100644 --- a/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileUtils.java +++ b/functions/supplier/file-supplier/src/main/java/org/springframework/cloud/fn/supplier/file/FileUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -29,19 +29,23 @@ import org.springframework.util.MimeTypeUtils; * @author Gary Russell * @author Artem Bilan * @author Christian Tzolov - * */ -public class FileUtils { +public final class FileUtils { + + private FileUtils() { + + } /** * Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on * {@link FileConsumerProperties}. - * @param flowBuilder the flow builder. + * + * @param flowBuilder the flow builder. * @param fileConsumerProperties the properties. * @return the updated flow builder. */ public static IntegrationFlowBuilder enhanceFlowForReadingMode(IntegrationFlowBuilder flowBuilder, - FileConsumerProperties fileConsumerProperties) { + FileConsumerProperties fileConsumerProperties) { switch (fileConsumerProperties.getMode()) { case contents: flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, @@ -71,12 +75,13 @@ public class FileUtils { /** * Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on * {@link FileConsumerProperties}; used for streaming sources. - * @param flowBuilder the flow builder. + * + * @param flowBuilder the flow builder. * @param fileConsumerProperties the properties. * @return the updated flow builder. */ public static IntegrationFlowBuilder enhanceStreamFlowForReadingMode(IntegrationFlowBuilder flowBuilder, - FileConsumerProperties fileConsumerProperties) { + FileConsumerProperties fileConsumerProperties) { switch (fileConsumerProperties.getMode()) { case contents: flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/AbstractFileSupplierTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/AbstractFileSupplierTests.java index 56c3f4e8..fd048d62 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/AbstractFileSupplierTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/AbstractFileSupplierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -22,12 +22,13 @@ import java.util.function.Supplier; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; +import reactor.core.publisher.Flux; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.messaging.Message; import org.springframework.test.annotation.DirtiesContext; -import reactor.core.publisher.Flux; /** * @author Gary Russell diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/DefaultFileSupplierTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/DefaultFileSupplierTests.java index b933e9a3..d908a211 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/DefaultFileSupplierTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/DefaultFileSupplierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -21,11 +21,12 @@ import java.nio.file.Files; import java.nio.file.Path; import org.junit.jupiter.api.Test; -import org.springframework.integration.file.FileHeaders; -import org.springframework.messaging.Message; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import org.springframework.integration.file.FileHeaders; +import org.springframework.messaging.Message; + import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FileModeRefTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FileModeRefTests.java index c420f74b..493705fb 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FileModeRefTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FileModeRefTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -21,11 +21,12 @@ import java.nio.file.Files; import java.nio.file.Path; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + import org.springframework.integration.file.FileHeaders; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithPatternTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithPatternTests.java index e1c81697..7a7e1e61 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithPatternTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithPatternTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -23,11 +23,12 @@ import java.nio.file.Path; import java.time.Duration; import org.junit.jupiter.api.Test; -import org.springframework.messaging.Message; -import org.springframework.test.context.TestPropertySource; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import org.springframework.messaging.Message; +import org.springframework.test.context.TestPropertySource; + import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithRegexTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithRegexTests.java index 0bf999c1..136ebf76 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithRegexTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/FilePayloadWithRegexTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -23,11 +23,12 @@ import java.nio.file.Path; import java.time.Duration; import org.junit.jupiter.api.Test; -import org.springframework.messaging.Message; -import org.springframework.test.context.TestPropertySource; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import org.springframework.messaging.Message; +import org.springframework.test.context.TestPropertySource; + import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesAndMarkersAsJsonPayloadTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesAndMarkersAsJsonPayloadTests.java index f03bea85..bc34cd4b 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesAndMarkersAsJsonPayloadTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesAndMarkersAsJsonPayloadTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -22,13 +22,14 @@ import java.nio.file.Path; import java.nio.file.StandardOpenOption; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + import org.springframework.integration.file.splitter.FileSplitter; import org.springframework.integration.json.JsonPathUtils; import org.springframework.integration.support.json.JsonObjectMapperProvider; import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; @@ -53,7 +54,8 @@ public class LinesAndMarkersAsJsonPayloadTests extends AbstractFileSupplierTests try { final Object evaluate = JsonPathUtils.evaluate(message.getPayload(), "$.mark"); assertThat(evaluate).isEqualTo(FileSplitter.FileMarker.Mark.START.name()); - } catch (IOException e) { + } + catch (IOException e) { // passt through } } @@ -69,7 +71,8 @@ public class LinesAndMarkersAsJsonPayloadTests extends AbstractFileSupplierTests assertThat(FileSplitter.FileMarker.Mark.END).isEqualTo(fileMarker1.getMark()); assertThat(firstFile.toAbsolutePath()).isEqualTo(fileMarker1.getFilePath()); assertThat(fileMarker1.getLineCount()).isEqualTo(2); - } catch (IOException e) { + } + catch (IOException e) { // passt through } } diff --git a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesPayloadTests.java b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesPayloadTests.java index a70a0841..dd222c16 100644 --- a/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesPayloadTests.java +++ b/functions/supplier/file-supplier/src/test/java/org/springframework/cloud/fn/supplier/file/LinesPayloadTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -22,11 +22,12 @@ import java.nio.file.Path; import java.nio.file.StandardOpenOption; import org.junit.jupiter.api.Test; -import org.springframework.messaging.Message; -import org.springframework.test.context.TestPropertySource; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import org.springframework.messaging.Message; +import org.springframework.test.context.TestPropertySource; + import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/functions/supplier/http-supplier/pom.xml b/functions/supplier/http-supplier/pom.xml index 0e4ab57b..3e54c799 100644 --- a/functions/supplier/http-supplier/pom.xml +++ b/functions/supplier/http-supplier/pom.xml @@ -1,55 +1,55 @@ - - 4.0.0 - http-supplier - 1.0.0.BUILD-SNAPSHOT - http-supplier - HTTP Supplier + + 4.0.0 + http-supplier + 1.0.0.BUILD-SNAPSHOT + http-supplier + HTTP Supplier - - org.springframework.cloud.fn - spring-functions-parent - 1.0.0.BUILD-SNAPSHOT - ../../spring-functions-parent - + + org.springframework.cloud.fn + spring-functions-parent + 1.0.0.BUILD-SNAPSHOT + ../../spring-functions-parent + - - - org.springframework.boot - spring-boot-starter-webflux - + + + org.springframework.boot + spring-boot-starter-webflux + - - org.springframework.integration - spring-integration-webflux - + + org.springframework.integration + spring-integration-webflux + - - org.springframework.boot - spring-boot-configuration-processor - provided - + + org.springframework.boot + spring-boot-configuration-processor + provided + - - org.springframework.boot - spring-boot-starter-test - test - - - io.projectreactor - reactor-test - test - - - javax.validation - validation-api - - - org.hibernate.validator - hibernate-validator - 6.1.0.Final - - + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + javax.validation + validation-api + + + org.hibernate.validator + hibernate-validator + 6.1.0.Final + + diff --git a/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSourceProperties.java b/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSourceProperties.java index 4210d5bb..ef1a7ecb 100644 --- a/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSourceProperties.java +++ b/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSourceProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -40,7 +40,7 @@ public class HttpSourceProperties { /** * Headers that will be mapped. */ - private String[] mappedRequestHeaders = { DefaultHttpHeaderMapper.HTTP_REQUEST_HEADER_NAME_PATTERN }; + private String[] mappedRequestHeaders = {DefaultHttpHeaderMapper.HTTP_REQUEST_HEADER_NAME_PATTERN}; /** * CORS properties. @@ -75,14 +75,14 @@ public class HttpSourceProperties { public static class Cors { /** - * List of allowed origins, e.g. "http://domain1.com". + * List of allowed origins, e.g. "https://domain1.com". */ - private String[] allowedOrigins = { CorsConfiguration.ALL }; + private String[] allowedOrigins = {CorsConfiguration.ALL}; /** * List of request headers that can be used during the actual request. */ - private String[] allowedHeaders = { CorsConfiguration.ALL }; + private String[] allowedHeaders = {CorsConfiguration.ALL}; /** * Whether the browser should include any cookies associated with the domain of the request being annotated. diff --git a/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java b/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java index a59bd7d6..f1325438 100644 --- a/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java +++ b/functions/supplier/http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011-2018 Pivotal Software Inc, All Rights Reserved. + * Copyright 2011-2020 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. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -19,6 +19,7 @@ package org.springframework.cloud.fn.supplier.http; import java.util.function.Supplier; import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -33,8 +34,6 @@ import org.springframework.integration.webflux.dsl.WebFlux; import org.springframework.integration.webflux.inbound.WebFluxInboundEndpoint; import org.springframework.messaging.Message; -import reactor.core.publisher.Flux; - /** * Configuration for the HTTP Supplier. * diff --git a/functions/supplier/http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java b/functions/supplier/http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java index c7d229c7..37f0bdce 100644 --- a/functions/supplier/http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java +++ b/functions/supplier/http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java @@ -1,12 +1,32 @@ -package org.springframework.cloud.fn.supplier.http; +/* + * Copyright 2020-2020 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -import static org.assertj.core.api.Assertions.assertThat; +package org.springframework.cloud.fn.supplier.http; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.function.Supplier; +import io.netty.handler.ssl.SslContextBuilder; +import io.netty.handler.ssl.SslProvider; +import io.netty.handler.ssl.util.InsecureTrustManagerFactory; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.netty.http.client.HttpClient; +import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -19,12 +39,7 @@ import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; import org.springframework.web.reactive.function.client.WebClient; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.SslProvider; -import io.netty.handler.ssl.util.InsecureTrustManagerFactory; -import reactor.core.publisher.Flux; -import reactor.netty.http.client.HttpClient; -import reactor.test.StepVerifier; +import static org.assertj.core.api.Assertions.assertThat; /** * The test for HTTP Supplier. @@ -100,10 +115,10 @@ public class HttpSupplierApplicationTests { private String name; - public TestPojo() { + TestPojo() { } - public TestPojo(String name) { + TestPojo(String name) { this.name = name; } @@ -118,6 +133,7 @@ public class HttpSupplierApplicationTests { } @SpringBootApplication - static class TestApplication { } + static class TestApplication { + } } diff --git a/functions/supplier/jdbc-supplier/pom.xml b/functions/supplier/jdbc-supplier/pom.xml index ac7d52be..f10e0054 100644 --- a/functions/supplier/jdbc-supplier/pom.xml +++ b/functions/supplier/jdbc-supplier/pom.xml @@ -1,66 +1,67 @@ - - 4.0.0 - jdbc-supplier - 1.0.0.BUILD-SNAPSHOT - jdbc-supplier - JDBC supplier + + 4.0.0 + jdbc-supplier + 1.0.0.BUILD-SNAPSHOT + jdbc-supplier + JDBC supplier - - org.springframework.cloud.fn - spring-functions-parent - 1.0.0.BUILD-SNAPSHOT - ../../spring-functions-parent - + + org.springframework.cloud.fn + spring-functions-parent + 1.0.0.BUILD-SNAPSHOT + ../../spring-functions-parent + - - - org.springframework.integration - spring-integration-jdbc - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.cloud - spring-cloud-function-context - ${spring-cloud-function.version} - - - io.pivotal.java.function - splitter-function - ${project.version} - - - org.springframework.boot - spring-boot-configuration-processor - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - com.h2database - h2 - test - - - io.projectreactor - reactor-test - test - - + + + org.springframework.integration + spring-integration-jdbc + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.cloud + spring-cloud-function-context + ${spring-cloud-function.version} + + + io.pivotal.java.function + splitter-function + ${project.version} + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + com.h2database + h2 + test + + + io.projectreactor + reactor-test + test + + diff --git a/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierConfiguration.java b/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierConfiguration.java index ec6a59ee..a0d9fda0 100644 --- a/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierConfiguration.java +++ b/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierConfiguration.java @@ -16,12 +16,15 @@ package org.springframework.cloud.fn.supplier.jdbc; -import io.pivotal.java.function.splitter.function.SplitterFunctionConfiguration; - import java.util.List; import java.util.function.Function; import java.util.function.Supplier; + import javax.sql.DataSource; + +import io.pivotal.java.function.splitter.function.SplitterFunctionConfiguration; +import reactor.core.publisher.Flux; + import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cloud.function.context.PollableBean; @@ -31,7 +34,6 @@ import org.springframework.context.annotation.Import; import org.springframework.integration.core.MessageSource; import org.springframework.integration.jdbc.JdbcPollingChannelAdapter; import org.springframework.messaging.Message; -import reactor.core.publisher.Flux; /** * @author Soby Chacko diff --git a/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierProperties.java b/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierProperties.java index 6b6d14fc..68a29059 100644 --- a/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierProperties.java +++ b/functions/supplier/jdbc-supplier/src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierProperties.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/DefaultJdbcSupplierTests.java b/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/DefaultJdbcSupplierTests.java index 49e3a24a..f3cd2dcc 100644 --- a/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/DefaultJdbcSupplierTests.java +++ b/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/DefaultJdbcSupplierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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,13 +20,14 @@ import java.util.Map; import java.util.function.Supplier; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.messaging.Message; import org.springframework.test.annotation.DirtiesContext; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; @@ -48,7 +49,7 @@ public class DefaultJdbcSupplierTests { .satisfies((msg) -> assertThat(msg) .extracting(Message::getPayload) .matches(o -> { - Map map = (Map)o; + Map map = (Map) o; return map.get("ID").equals(1L) && map.get("NAME").equals("Bob"); }) )) @@ -57,7 +58,7 @@ public class DefaultJdbcSupplierTests { .satisfies((msg) -> assertThat(msg) .extracting(Message::getPayload) .matches(o -> { - Map map = (Map)o; + Map map = (Map) o; return map.get("ID").equals(2L) && map.get("NAME").equals("Jane"); }) )) @@ -66,7 +67,7 @@ public class DefaultJdbcSupplierTests { .satisfies((msg) -> assertThat(msg) .extracting(Message::getPayload) .matches(o -> { - Map map = (Map)o; + Map map = (Map) o; return map.get("ID").equals(3L) && map.get("NAME").equals("John"); }) )) diff --git a/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/NonSplitJdbcSupplierTests.java b/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/NonSplitJdbcSupplierTests.java index 60e000b0..0a24fab3 100644 --- a/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/NonSplitJdbcSupplierTests.java +++ b/functions/supplier/jdbc-supplier/src/test/java/org/springframework/cloud/fn/supplier/jdbc/NonSplitJdbcSupplierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.fn.supplier.jdbc; import java.util.List; @@ -20,6 +21,7 @@ import java.util.Map; import java.util.function.Supplier; import org.junit.jupiter.api.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; diff --git a/functions/supplier/mongodb-supplier/pom.xml b/functions/supplier/mongodb-supplier/pom.xml index 15845cc1..2083adc9 100644 --- a/functions/supplier/mongodb-supplier/pom.xml +++ b/functions/supplier/mongodb-supplier/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 mongodb-supplier diff --git a/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierConfiguration.java b/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierConfiguration.java index a82a8c68..80c38c7b 100644 --- a/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierConfiguration.java +++ b/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2020 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,14 +20,14 @@ import java.util.List; import java.util.function.Function; import java.util.function.Supplier; -import org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration; -import org.springframework.context.annotation.Configuration; import reactor.core.publisher.Flux; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration; import org.springframework.cloud.function.context.PollableBean; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.expression.Expression; @@ -43,10 +43,9 @@ import org.springframework.messaging.Message; * @author Adam Zwickey * @author Artem Bilan * @author David Turanski - * */ @Configuration -@EnableConfigurationProperties({ MongodbSupplierProperties.class }) +@EnableConfigurationProperties({MongodbSupplierProperties.class}) @Import(SplitterFunctionConfiguration.class) public class MongodbSupplierConfiguration { @@ -82,7 +81,8 @@ public class MongodbSupplierConfiguration { /** * The inheritors can consider to override this method for their purpose or just adjust - * options for the returned instance + * options for the returned instance. + * * @return a {@link MongoDbMessageSource} instance */ @Bean diff --git a/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierProperties.java b/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierProperties.java index 31ba05e6..1d993ab7 100644 --- a/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierProperties.java +++ b/functions/supplier/mongodb-supplier/src/main/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierProperties.java @@ -28,24 +28,23 @@ import org.springframework.validation.annotation.Validated; * @author Artem Bilan * @author Chris Schaefer * @author David Turanski - * */ @ConfigurationProperties("mongodb.supplier") @Validated public class MongodbSupplierProperties { /** - * The MongoDB collection to query + * The MongoDB collection to query. */ private String collection; /** - * The MongoDB query + * The MongoDB query. */ private String query = "{ }"; /** - * The SpEL expression in MongoDB query DSL style + * The SpEL expression in MongoDB query DSL style. */ private Expression queryExpression; @@ -71,15 +70,15 @@ public class MongodbSupplierProperties { this.queryExpression = queryExpression; } - public void setCollection(String collection) { - this.collection = collection; - } - @NotBlank(message = "Collection name is required") public String getCollection() { return collection; } + public void setCollection(String collection) { + this.collection = collection; + } + public boolean isSplit() { return split; } diff --git a/functions/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java b/functions/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java index 0c332137..890d6f3c 100644 --- a/functions/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java +++ b/functions/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java @@ -27,13 +27,13 @@ import com.mongodb.client.MongoDatabase; import org.bson.Document; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.messaging.Message; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; @@ -67,23 +67,23 @@ class MongodbSupplierApplicationTests { @Test void testMongodbSupplier() { Flux> messageFlux = this.mongodbSupplier.get(); - StepVerifier.create(messageFlux) - .assertNext((message) -> + StepVerifier.create(messageFlux) + .assertNext((message) -> assertThat(payload(message)).contains( - entry("greeting","hello"), + entry("greeting", "hello"), entry("name", "foo"))) - .assertNext((message) -> - assertThat(payload(message)).contains( - entry("greeting","hola"), - entry("name", "bar"))) - .thenCancel() - .verify(); + .assertNext((message) -> + assertThat(payload(message)).contains( + entry("greeting", "hola"), + entry("name", "bar"))) + .thenCancel() + .verify(); } - private Map payload(Message message) { - Map map = null; + private Map payload(Message message) { + Map map = null; try { - map = objectMapper.readValue(message.getPayload().toString(),HashMap.class); + map = objectMapper.readValue(message.getPayload().toString(), HashMap.class); } catch (Exception e) { e.printStackTrace(); @@ -92,5 +92,6 @@ class MongodbSupplierApplicationTests { } @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/supplier/time-supplier/pom.xml b/functions/supplier/time-supplier/pom.xml index 6b871e62..0fbae9c5 100644 --- a/functions/supplier/time-supplier/pom.xml +++ b/functions/supplier/time-supplier/pom.xml @@ -1,45 +1,46 @@ - - 4.0.0 - time-supplier - 1.0.0.BUILD-SNAPSHOT - time-supplier - time supplier + + 4.0.0 + time-supplier + 1.0.0.BUILD-SNAPSHOT + time-supplier + time supplier - - org.springframework.cloud.fn - spring-functions-parent - 1.0.0.BUILD-SNAPSHOT - ../../spring-functions-parent - + + org.springframework.cloud.fn + spring-functions-parent + 1.0.0.BUILD-SNAPSHOT + ../../spring-functions-parent + - - - org.springframework.boot - spring-boot-starter - - - org.apache.commons - commons-lang3 - + + + org.springframework.boot + spring-boot-starter + + + org.apache.commons + commons-lang3 + - - org.hibernate.validator - hibernate-validator - true - + + org.hibernate.validator + hibernate-validator + true + - - org.springframework.boot - spring-boot-configuration-processor - provided - + + org.springframework.boot + spring-boot-configuration-processor + provided + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + diff --git a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/DateFormat.java b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/DateFormat.java index 77ff2986..cd20d0e1 100644 --- a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/DateFormat.java +++ b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/DateFormat.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -34,22 +34,25 @@ import javax.validation.Payload; * @author Eric Bottard * @author Soby Chacko */ -@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, - ElementType.PARAMETER }) +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, + ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented -@Constraint(validatedBy = { DateFormat.DateFormatValidator.class }) +@Constraint(validatedBy = {DateFormat.DateFormatValidator.class}) public @interface DateFormat { + /** + * Default message for validation. + */ String DEFAULT_MESSAGE = ""; String message() default DEFAULT_MESSAGE; - Class[] groups() default { }; + Class[] groups() default {}; - Class[] payload() default { }; + Class[] payload() default {}; - public static class DateFormatValidator implements ConstraintValidator { + class DateFormatValidator implements ConstraintValidator { private String message; diff --git a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeProperties.java b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeProperties.java index 3c59377c..0bb70167 100644 --- a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeProperties.java +++ b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeSupplierConfiguration.java b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeSupplierConfiguration.java index 40224405..c0cb9e56 100644 --- a/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeSupplierConfiguration.java +++ b/functions/supplier/time-supplier/src/main/java/org/springframework/cloud/fn/supplier/time/TimeSupplierConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/SimpleTimeSupplierTests.java b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/SimpleTimeSupplierTests.java index 4e426863..1a0a4a2f 100644 --- a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/SimpleTimeSupplierTests.java +++ b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/SimpleTimeSupplierTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,14 +16,14 @@ package org.springframework.cloud.fn.supplier.time; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; - import java.text.SimpleDateFormat; import java.util.Date; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; + /** * @author Soby Chacko * @author Artem Bilan diff --git a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/TimeSupplierApplicationTests.java b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/TimeSupplierApplicationTests.java index df379308..41fcacd4 100644 --- a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/TimeSupplierApplicationTests.java +++ b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/TimeSupplierApplicationTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,5 +38,6 @@ public abstract class TimeSupplierApplicationTests { protected abstract void testTimeSupplier(); @SpringBootApplication - static class TestApplication {} + static class TestApplication { + } } diff --git a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/VariationToSimpleTests.java b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/VariationToSimpleTests.java index bcbe99d8..125c76e4 100644 --- a/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/VariationToSimpleTests.java +++ b/functions/supplier/time-supplier/src/test/java/org/springframework/cloud/fn/supplier/time/VariationToSimpleTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,10 +16,6 @@ package org.springframework.cloud.fn.supplier.time; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; - import java.text.SimpleDateFormat; import java.util.Date; @@ -27,11 +23,15 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; + /** * @author Soby Chacko * @author Artem Bilan */ -@SpringBootTest({ "time.dateFormat=MMddyyyy HH:mm:ss" }) +@SpringBootTest({"time.dateFormat=MMddyyyy HH:mm:ss"}) public class VariationToSimpleTests extends TimeSupplierApplicationTests { @Test