From 9bc78ec1faeb3743ccb5cf77bf1534958b1fb8b0 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Thu, 7 May 2020 11:18:22 -0400 Subject: [PATCH] Apply checkstyle changes in stream-applications * core, source, sink and processor are now updated with latest checkstyle requirements. --- applications/apps-core/.settings.xml | 81 -------- applications/apps-core/common/pom.xml | 25 --- .../common/stream-apps-file-common/pom.xml | 21 -- .../app/file/FileConsumerProperties.java | 82 -------- .../stream/app/file/FileReadingMode.java | 30 --- .../cloud/stream/app/file/FileUtils.java | 103 ---------- .../remote/AbstractRemoteFileProperties.java | 71 ------- .../AbstractRemoteFileSinkProperties.java | 102 ---------- .../AbstractRemoteFileSourceProperties.java | 120 ------------ .../AbstractRemoteServerProperties.java | 86 --------- .../stream/app/file/remote/FilePathUtils.java | 57 ------ ...ngTransactionSynchronizationProcessor.java | 63 ------ .../common/stream-apps-ftp-common/pom.xml | 26 --- .../stream-apps-metadata-store-common/pom.xml | 152 --------------- .../app/micrometer/common/pcf-scs-info.json | 13 -- .../stream-apps-security-common/pom.xml | 52 ----- .../pom.xml | 45 ----- .../DataFlowTaskLaunchRequest.java | 64 ------- .../TaskLaunchRequestMessageProcessor.java | 70 ------- .../support/TaskLaunchRequestSupplier.java | 65 ------- .../KeyValueListParserTests.java | 97 ---------- .../common/stream-apps-test-support/pom.xml | 29 --- .../app/test/PropertiesInitializer.java | 36 ---- .../app/test/redis/RedisTestSupport.java | 43 ----- applications/pom.xml | 8 +- .../processor/bridge-processor/pom.xml | 7 +- .../stream/app/BridgeProcessorTests.java | 6 +- .../processor/filter-processor/pom.xml | 166 ++++++++-------- ...onfiguration-metadata-whitelist.properties | 2 +- .../processor/FilterProcessorTests.java | 6 +- applications/processor/pom.xml | 4 +- .../processor/splitter-processor/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../processor/SplitterProcessorTests.java | 6 +- .../processor/transform-processor/pom.xml | 3 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../processor/TransformProcessorTests.java | 6 +- applications/sink/cassandra-sink/pom.xml | 7 +- ...onfiguration-metadata-whitelist.properties | 2 +- applications/sink/counter-sink/pom.xml | 181 +++++++++--------- ...onfiguration-metadata-whitelist.properties | 1 + .../app/counter/sink/CounterSinkTests.java | 3 +- applications/sink/file-sink/pom.xml | 5 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../cloud/stream/app/FileSinkTests.java | 6 +- applications/sink/jdbc-sink/pom.xml | 7 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../stream/app/jdbc/sink/JdbcSinkTests.java | 16 +- applications/sink/log-sink/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../cloud/stream/app/LogSinkTests.java | 5 +- applications/sink/mongodb-sink/README.adoc | 4 +- applications/sink/mongodb-sink/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- applications/sink/pom.xml | 4 +- applications/sink/rabbit-sink/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../app/rabbit/sink/OwnConnectionTest.java | 9 +- .../sink/RabbitSinkIntegrationTests.java | 39 ++-- .../sink/RabbitSinkInvalidConfigTests.java | 28 +-- .../SimpleRoutingKeyAndCustomHeaderTests.java | 12 +- applications/source/file-source/pom.xml | 5 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../FileSourceTests.java | 4 +- applications/source/http-source/pom.xml | 9 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../cloud/stream/app/HttpSourceTests.java | 19 +- applications/source/jdbc-source/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../app/jdbc/source/DefaultBehaviorTests.java | 16 +- .../source/JdbcSourceIntegrationTests.java | 4 +- .../Select2PerPollNoSplitWithUpdateTests.java | 19 +- .../jdbc/source/SelectAllNoSplitTests.java | 11 +- .../jdbc/source/SelectAllWithDelayTests.java | 48 +++-- .../source/SelectAllWithMinDelayTests.java | 21 +- .../source/mongodb-source/README.adoc | 6 +- applications/source/mongodb-source/pom.xml | 6 +- ...onfiguration-metadata-whitelist.properties | 2 +- applications/source/pom.xml | 4 +- applications/source/time-source/pom.xml | 5 +- ...onfiguration-metadata-whitelist.properties | 2 +- .../cloud/stream/app/TimeSourceTests.java | 4 +- .../CODE_OF_CONDUCT.adoc | 0 .../LICENSE | 0 .../pom.xml | 0 .../release-tools/core-tag-next-version.sh | 0 .../release-tools/core-version-check.sh | 0 .../release-tools/core-version-upgrade.sh | 0 .../stream-apps-descriptor/pom.xml | 0 .../META-INF/kafka-apps-docker.properties | 0 .../kafka-apps-maven-repo-url.properties | 0 .../META-INF/kafka-apps-maven.properties | 0 .../META-INF/rabbit-apps-docker.properties | 0 .../rabbit-apps-maven-repo-url.properties | 0 .../META-INF/rabbit-apps-maven.properties | 0 .../stream-apps-docs/README.md | 0 .../stream-apps-docs/pom.xml | 0 .../src/main/asciidoc/.gitignore | 0 .../src/main/asciidoc/Guardfile | 0 .../src/main/asciidoc/appendix.adoc | 0 .../src/main/asciidoc/contributing.adoc | 0 .../images/app-starter-naming-conventions.png | Bin .../src/main/asciidoc/images/logo.png | Bin .../images/starters-pom-dependencies.png | Bin .../src/main/asciidoc/index-docinfo.xml | 0 .../src/main/asciidoc/index.adoc | 0 .../src/main/asciidoc/overview.adoc | 0 .../src/main/asciidoc/pom-dependencies.adoc | 0 .../src/main/asciidoc/processors.adoc | 0 .../src/main/asciidoc/sinks.adoc | 0 .../src/main/asciidoc/sources.adoc | 0 .../src/main/docbook/css/highlight.css | 0 .../src/main/docbook/css/manual-multipage.css | 0 .../main/docbook/css/manual-singlepage.css | 0 .../src/main/docbook/css/manual.css | 0 .../src/main/docbook/images/background.png | Bin .../src/main/docbook/images/callouts/1.png | Bin .../src/main/docbook/images/callouts/10.png | Bin .../src/main/docbook/images/callouts/11.png | Bin .../src/main/docbook/images/callouts/12.png | Bin .../src/main/docbook/images/callouts/13.png | Bin .../src/main/docbook/images/callouts/14.png | Bin .../src/main/docbook/images/callouts/15.png | Bin .../src/main/docbook/images/callouts/2.png | Bin .../src/main/docbook/images/callouts/3.png | Bin .../src/main/docbook/images/callouts/4.png | Bin .../src/main/docbook/images/callouts/5.png | Bin .../src/main/docbook/images/callouts/6.png | Bin .../src/main/docbook/images/callouts/7.png | Bin .../src/main/docbook/images/callouts/8.png | Bin .../src/main/docbook/images/callouts/9.png | Bin .../src/main/docbook/images/caution.png | Bin .../src/main/docbook/images/cover.png | Bin .../src/main/docbook/images/important.png | Bin .../src/main/docbook/images/logo.png | Bin .../src/main/docbook/images/logo.svg | 0 .../src/main/docbook/images/note.png | Bin .../src/main/docbook/images/tip.png | Bin .../src/main/docbook/images/warning.png | Bin .../src/main/docbook/xsl/common.xsl | 0 .../src/main/docbook/xsl/epub.xsl | 0 .../src/main/docbook/xsl/html-multipage.xsl | 0 .../src/main/docbook/xsl/html-singlepage.xsl | 0 .../src/main/docbook/xsl/html.xsl | 0 .../src/main/docbook/xsl/pdf.xsl | 0 .../src/main/docbook/xsl/xslthl-config.xml | 0 .../main/docbook/xsl/xslthl/asciidoc-hl.xml | 0 .../src/main/docbook/xsl/xslthl/bourne-hl.xml | 0 .../src/main/docbook/xsl/xslthl/c-hl.xml | 0 .../src/main/docbook/xsl/xslthl/cpp-hl.xml | 0 .../src/main/docbook/xsl/xslthl/csharp-hl.xml | 0 .../src/main/docbook/xsl/xslthl/css-hl.xml | 0 .../src/main/docbook/xsl/xslthl/html-hl.xml | 0 .../src/main/docbook/xsl/xslthl/ini-hl.xml | 0 .../src/main/docbook/xsl/xslthl/java-hl.xml | 0 .../main/docbook/xsl/xslthl/javascript-hl.xml | 0 .../src/main/docbook/xsl/xslthl/json-hl.xml | 0 .../src/main/docbook/xsl/xslthl/perl-hl.xml | 0 .../src/main/docbook/xsl/xslthl/php-hl.xml | 0 .../main/docbook/xsl/xslthl/properties-hl.xml | 0 .../src/main/docbook/xsl/xslthl/python-hl.xml | 0 .../src/main/docbook/xsl/xslthl/ruby-hl.xml | 0 .../main/docbook/xsl/xslthl/sql2003-hl.xml | 0 .../src/main/docbook/xsl/xslthl/yaml-hl.xml | 0 .../src/main/javadoc/spring-javadoc.css | 0 .../stream-applications-core/.settings.xml | 81 ++++++++ .../CODE_OF_CONDUCT.adoc | 0 .../LICENSE | 0 .../README.adoc | 0 .../stream-applications-core/common/pom.xml | 25 +++ .../common/stream-apps-ftp-common/pom.xml | 27 +++ .../ftp/FtpSessionFactoryConfiguration.java | 3 +- .../app/ftp/FtpSessionFactoryProperties.java | 13 +- .../README.adoc | 0 .../stream-apps-metadata-store-common/pom.xml | 152 +++++++++++++++ .../ClientCacheAutoConfiguration.java | 6 +- .../MetadataStoreAutoConfiguration.java | 49 +++-- .../app/metadata/MetadataStoreProperties.java | 4 +- .../main/resources/META-INF/spring.factories | 0 .../MetadataStoreAutoConfigurationTests.java | 38 ++-- .../stream-apps-micrometer-common/pom.xml | 4 +- .../CloudFoundryMicrometerCommonTags.java | 7 +- ...SpringCloudStreamMicrometerCommonTags.java | 5 +- ...eamMicrometerEnvironmentPostProcessor.java | 5 +- .../main/resources/META-INF/spring.factories | 0 .../common/AbstractMicrometerTagTest.java | 19 +- .../CloudFoundryMicrometerCommonTagsTest.java | 56 +++--- .../InfluxReservedKeywordHandlingTest.java | 20 +- ...ngCloudStreamMicrometerCommonTagsTest.java | 42 ++-- ...icrometerEnvironmentPostProcessorTest.java | 54 +++--- .../app/micrometer/common/pcf-scs-info.json | 18 ++ .../stream-apps-postprocessor-common/pom.xml | 2 +- .../ContentTypeEnvironmentPostProcessor.java | 33 ++-- ...tentTypeEnvironmentPostProcessorTests.java | 167 +++++++--------- .../stream-apps-security-common/README.adoc | 0 .../stream-apps-security-common/pom.xml | 52 +++++ ...arterWebFluxSecurityAutoConfiguration.java | 15 +- ...ppStarterWebSecurityAutoConfiguration.java | 3 +- ...ebSecurityAutoConfigurationProperties.java | 4 +- .../common/OnHttpCsrfOrSecurityDisabled.java | 3 +- .../main/resources/META-INF/spring.factories | 0 .../common/AbstractSecurityCommonTests.java | 0 ...isabledManagementSecurityEnabledTests.java | 27 ++- ...SecurityDisabledAuthorizedAccessTests.java | 27 ++- ...curityDisabledUnauthorizedAccessTests.java | 15 +- ...EnabledManagementSecurityEnabledTests.java | 25 ++- ...isabledManagementSecurityEnabledTests.java | 26 ++- ...SecurityDisabledAuthorizedAccessTests.java | 26 ++- ...curityDisabledUnauthorizedAccessTests.java | 25 ++- ...EnabledManagementSecurityEnabledTests.java | 27 ++- .../README.adoc | 0 .../pom.xml | 45 +++++ .../DataFlowTaskLaunchRequest.java | 65 +++++++ ...lowTaskLaunchRequestAutoConfiguration.java | 39 ++-- .../DataflowTaskLaunchRequestProperties.java | 6 +- ...essionEvaluatingTaskNameMessageMapper.java | 22 +-- .../tasklaunchrequest/KeyValueListParser.java | 2 +- .../TaskLaunchRequestFunction.java | 2 +- .../TaskLaunchRequestMessageProcessor.java | 70 +++++++ .../CommandLineArgumentsMessageMapper.java | 3 +- .../support/TaskLaunchRequestSupplier.java | 66 +++++++ .../support/TaskNameMessageMapper.java | 2 +- ...onfiguration-metadata-whitelist.properties | 0 .../main/resources/META-INF/spring.factories | 0 .../KeyValueListParserTests.java | 88 +++++++++ .../TaskLaunchRequestIntegrationTests.java | 86 ++++----- .../TaskLaunchRequestPropertiesTests.java | 8 +- .../common/stream-apps-test-support/pom.xml | 30 +++ .../test/BinderTestPropertiesInitializer.java | 3 +- .../file/remote/RemoteFileTestSupport.java | 18 +- .../app/test/ip/IpSinkTestConfiguration.java | 5 +- .../test/ip/IpSourceTestConfiguration.java | 5 +- .../script/ScriptableTestConfiguration.java | 3 +- .../pom.xml | 152 ++++++++++++++- 234 files changed, 1717 insertions(+), 2419 deletions(-) delete mode 100644 applications/apps-core/.settings.xml delete mode 100644 applications/apps-core/common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-file-common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileConsumerProperties.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileReadingMode.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileProperties.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSinkProperties.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSourceProperties.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteServerProperties.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/FilePathUtils.java delete mode 100644 applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/RemoteFileDeletingTransactionSynchronizationProcessor.java delete mode 100644 applications/apps-core/common/stream-apps-ftp-common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-metadata-store-common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json delete mode 100644 applications/apps-core/common/stream-apps-security-common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-task-launch-request-common/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java delete mode 100644 applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java delete mode 100644 applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java delete mode 100644 applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java delete mode 100644 applications/apps-core/common/stream-apps-test-support/pom.xml delete mode 100644 applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/PropertiesInitializer.java delete mode 100644 applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/redis/RedisTestSupport.java rename applications/{apps-build => stream-applications-build}/CODE_OF_CONDUCT.adoc (100%) rename applications/{apps-build => stream-applications-build}/LICENSE (100%) rename applications/{apps-build => stream-applications-build}/pom.xml (100%) rename applications/{apps-build => stream-applications-build}/release-tools/core-tag-next-version.sh (100%) rename applications/{apps-build => stream-applications-build}/release-tools/core-version-check.sh (100%) rename applications/{apps-build => stream-applications-build}/release-tools/core-version-upgrade.sh (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/pom.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-docker.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven-repo-url.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-docker.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven-repo-url.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven.properties (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/README.md (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/pom.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/.gitignore (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/Guardfile (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/appendix.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/contributing.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/images/app-starter-naming-conventions.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/images/logo.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/images/starters-pom-dependencies.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/index-docinfo.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/index.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/overview.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/pom-dependencies.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/processors.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/sinks.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/asciidoc/sources.adoc (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/css/highlight.css (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/css/manual-multipage.css (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/css/manual-singlepage.css (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/css/manual.css (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/background.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/1.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/10.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/11.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/12.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/13.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/14.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/15.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/2.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/3.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/4.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/5.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/6.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/7.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/8.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/callouts/9.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/caution.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/cover.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/important.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/logo.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/logo.svg (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/note.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/tip.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/images/warning.png (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/common.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/epub.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/html-multipage.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/html-singlepage.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/html.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/pdf.xsl (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl-config.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/asciidoc-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/bourne-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/c-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/cpp-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/csharp-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/css-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/html-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/ini-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/java-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/javascript-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/json-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/perl-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/php-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/properties-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/python-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/ruby-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/sql2003-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/docbook/xsl/xslthl/yaml-hl.xml (100%) rename applications/{apps-build => stream-applications-build}/stream-apps-docs/src/main/javadoc/spring-javadoc.css (100%) create mode 100644 applications/stream-applications-core/.settings.xml rename applications/{apps-core => stream-applications-core}/CODE_OF_CONDUCT.adoc (100%) rename applications/{apps-core => stream-applications-core}/LICENSE (100%) rename applications/{apps-core => stream-applications-core}/README.adoc (100%) create mode 100644 applications/stream-applications-core/common/pom.xml create mode 100644 applications/stream-applications-core/common/stream-apps-ftp-common/pom.xml rename applications/{apps-core => stream-applications-core}/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java (91%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/README.adoc (100%) create mode 100644 applications/stream-applications-core/common/stream-apps-metadata-store-common/pom.xml rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java (91%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java (89%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java (99%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/src/main/resources/META-INF/spring.factories (100%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java (99%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/pom.xml (91%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java (94%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/main/resources/META-INF/spring.factories (100%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java (93%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java (53%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java (79%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java (52%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java (63%) create mode 100644 applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json rename applications/{apps-core => stream-applications-core}/common/stream-apps-postprocessor-common/pom.xml (87%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java (98%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java (66%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/README.adoc (100%) create mode 100644 applications/stream-applications-core/common/stream-apps-security-common/pom.xml rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java (86%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java (96%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java (96%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java (96%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/main/resources/META-INF/spring.factories (100%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/AbstractSecurityCommonTests.java (100%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java (75%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java (81%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java (82%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java (77%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java (75%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java (81%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java (76%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java (75%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/README.adoc (100%) create mode 100644 applications/stream-applications-core/common/stream-apps-task-launch-request-common/pom.xml create mode 100644 applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java (89%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java (96%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java (65%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java (94%) create mode 100644 applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java (93%) create mode 100644 applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java (93%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring-configuration-metadata-whitelist.properties (100%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring.factories (100%) create mode 100644 applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java (79%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java (90%) create mode 100644 applications/stream-applications-core/common/stream-apps-test-support/pom.xml rename applications/{apps-core => stream-applications-core}/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java (97%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java (89%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java (89%) rename applications/{apps-core => stream-applications-core}/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java (96%) rename applications/{apps-core => stream-applications-core}/pom.xml (66%) diff --git a/applications/apps-core/.settings.xml b/applications/apps-core/.settings.xml deleted file mode 100644 index d8e1afac..00000000 --- a/applications/apps-core/.settings.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - repo.spring.io - ${env.CI_DEPLOY_USERNAME} - ${env.CI_DEPLOY_PASSWORD} - - - - - - spring - - true - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - gemstone-release - GemStone Maven Release Repository - http://dist.gemstone.com/maven/release - - true - always - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - - - diff --git a/applications/apps-core/common/pom.xml b/applications/apps-core/common/pom.xml deleted file mode 100644 index 213da9a8..00000000 --- a/applications/apps-core/common/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - stream-apps-parent - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-common - pom - stream-apps-common - - - stream-apps-file-common - stream-apps-ftp-common - stream-apps-test-support - stream-apps-postprocessor-common - stream-apps-micrometer-common - stream-apps-metadata-store-common - stream-apps-task-launch-request-common - stream-apps-security-common - - - diff --git a/applications/apps-core/common/stream-apps-file-common/pom.xml b/applications/apps-core/common/stream-apps-file-common/pom.xml deleted file mode 100644 index ac0e8a43..00000000 --- a/applications/apps-core/common/stream-apps-file-common/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-file-common - stream-apps-file-common - - - - org.springframework.integration - spring-integration-file - true - - - - diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileConsumerProperties.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileConsumerProperties.java deleted file mode 100644 index 33ff4b0c..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileConsumerProperties.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2015-2016 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.stream.app.file; - -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; - -/** - * @author David Turanski - * @author Artem Bilan - */ -@ConfigurationProperties("file.consumer") -@Validated -public class FileConsumerProperties { - - /** - * The FileReadingMode to use for file reading sources. - * Values are 'ref' - The File object, - * 'lines' - a message per line, or - * 'contents' - the contents as bytes. - */ - 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'. - */ - private Boolean withMarkers = null; - - /** - * When 'fileMarkers == true', specify if they should be produced - * as FileSplitter.FileMarker objects or JSON. - */ - private boolean markersJson = true; - - @NotNull - public FileReadingMode getMode() { - return this.mode; - } - - public void setMode(FileReadingMode mode) { - this.mode = mode; - } - - public Boolean getWithMarkers() { - return this.withMarkers; - } - - public void setWithMarkers(Boolean withMarkers) { - this.withMarkers = withMarkers; - } - - public boolean getMarkersJson() { - return this.markersJson; - } - - public void setMarkersJson(boolean markersJson) { - this.markersJson = markersJson; - } - - @AssertTrue(message = "withMarkers can only be supplied when FileReadingMode is 'lines'") - public boolean isWithMarkersValid() { - return this.withMarkers == null || FileReadingMode.lines == this.mode; - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileReadingMode.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileReadingMode.java deleted file mode 100644 index 593fc757..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileReadingMode.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2015 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.stream.app.file; - - -/** - * Defines the supported modes of reading and processing files for the - * {@code File}, {@code FTP} and {@code SFTP} sources. - * - * @author Gunnar Hillert - * @author David Turanski - */ -public enum FileReadingMode { - ref, - lines, - contents; -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java deleted file mode 100644 index 4537ee66..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2015-2018 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.stream.app.file; - -import java.util.Collections; - -import org.springframework.integration.dsl.IntegrationFlowBuilder; -import org.springframework.integration.file.splitter.FileSplitter; -import org.springframework.integration.file.transformer.FileToByteArrayTransformer; -import org.springframework.integration.transformer.StreamTransformer; -import org.springframework.messaging.MessageHeaders; -import org.springframework.util.MimeTypeUtils; - -/** - * @author Gary Russell - * @author Artem Bilan - * @author Christian Tzolov - * - */ -public class FileUtils { - - /** - * Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on - * {@link FileConsumerProperties}. - * @param flowBuilder the flow builder. - * @param fileConsumerProperties the properties. - * @return the updated flow builder. - */ - public static IntegrationFlowBuilder enhanceFlowForReadingMode(IntegrationFlowBuilder flowBuilder, - FileConsumerProperties fileConsumerProperties) { - switch (fileConsumerProperties.getMode()) { - case contents: - flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, - MimeTypeUtils.APPLICATION_OCTET_STREAM_VALUE)) - .transform(new FileToByteArrayTransformer()); - break; - case lines: - Boolean withMarkers = fileConsumerProperties.getWithMarkers(); - if (withMarkers == null) { - withMarkers = false; - } - flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, - MimeTypeUtils.TEXT_PLAIN_VALUE)) - .split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson())); - break; - case ref: - flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, - MimeTypeUtils.APPLICATION_JSON_VALUE)); - break; - default: - throw new IllegalArgumentException(fileConsumerProperties.getMode().name() + - " is not a supported file reading mode."); - } - return flowBuilder; - } - - /** - * Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on - * {@link FileConsumerProperties}; used for streaming sources. - * @param flowBuilder the flow builder. - * @param fileConsumerProperties the properties. - * @return the updated flow builder. - */ - public static IntegrationFlowBuilder enhanceStreamFlowForReadingMode(IntegrationFlowBuilder flowBuilder, - FileConsumerProperties fileConsumerProperties) { - switch (fileConsumerProperties.getMode()) { - case contents: - flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, - MimeTypeUtils.APPLICATION_OCTET_STREAM_VALUE)) - .transform(new StreamTransformer()); - break; - case lines: - Boolean withMarkers = fileConsumerProperties.getWithMarkers(); - if (withMarkers == null) { - withMarkers = false; - } - flowBuilder.enrichHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, - MimeTypeUtils.TEXT_PLAIN_VALUE)) - .split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson())); - break; - case ref: - default: - throw new IllegalArgumentException(fileConsumerProperties.getMode().name() + - " is not a supported file reading mode when streaming."); - } - return flowBuilder; - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileProperties.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileProperties.java deleted file mode 100644 index cb24e8e9..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileProperties.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2015-2017 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.stream.app.file.remote; - -import org.hibernate.validator.constraints.NotBlank; - -/** - * @deprecated - properties are flattened. - * - * @author Gary Russell - * - */ -@Deprecated -public abstract class AbstractRemoteFileProperties { - - /** - * The remote FTP directory. - */ - private String remoteDir = "/"; - - /** - * The suffix to use while the transfer is in progress. - */ - private String tmpFileSuffix = ".tmp"; - - /** - * The remote file separator. - */ - private String remoteFileSeparator = "/"; - - @NotBlank - public String getRemoteDir() { - return remoteDir; - } - - public final void setRemoteDir(String remoteDir) { - this.remoteDir = remoteDir; - } - - @NotBlank - public String getTmpFileSuffix() { - return tmpFileSuffix; - } - - public void setTmpFileSuffix(String tmpFileSuffix) { - this.tmpFileSuffix = tmpFileSuffix; - } - - @NotBlank - public String getRemoteFileSeparator() { - return remoteFileSeparator; - } - - public void setRemoteFileSeparator(String remoteFileSeparator) { - this.remoteFileSeparator = remoteFileSeparator; - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSinkProperties.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSinkProperties.java deleted file mode 100644 index b3db48dc..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSinkProperties.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2015-2016 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.stream.app.file.remote; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.NotBlank; - -import org.springframework.expression.Expression; -import org.springframework.integration.file.support.FileExistsMode; - -/** - * @deprecated - properties are flattened. - * - * @author Gary Russell - * - */ -@Deprecated -public abstract class AbstractRemoteFileSinkProperties extends AbstractRemoteFileProperties { - - /** - * A temporary directory where the file will be written if {@link #isUseTemporaryFilename()} - * is true. - */ - private String temporaryRemoteDir = "/"; - - /** - * Whether or not to create the remote directory. - */ - private boolean autoCreateDir = true; - - /** - * Action to take if the remote file already exists. - */ - private FileExistsMode mode = FileExistsMode.REPLACE; - - /** - * Whether or not to write to a temporary file and rename. - */ - private boolean useTemporaryFilename = true; - - /** - * A SpEL expression to generate the remote file name. - */ - private Expression filenameExpression; - - @NotBlank - public String getTemporaryRemoteDir() { - return this.temporaryRemoteDir; - } - - public void setTemporaryRemoteDir(String temporaryRemoteDir) { - this.temporaryRemoteDir = temporaryRemoteDir; - } - - public boolean isAutoCreateDir() { - return this.autoCreateDir; - } - - public void setAutoCreateDir(boolean autoCreateDir) { - this.autoCreateDir = autoCreateDir; - } - - @NotNull - public FileExistsMode getMode() { - return this.mode; - } - - public void setMode(FileExistsMode mode) { - this.mode = mode; - } - - public boolean isUseTemporaryFilename() { - return this.useTemporaryFilename; - } - - public void setUseTemporaryFilename(boolean useTemporaryFilename) { - this.useTemporaryFilename = useTemporaryFilename; - } - - public Expression getFilenameExpression() { - return this.filenameExpression; - } - - public void setFilenameExpression(Expression filenameExpression) { - this.filenameExpression = filenameExpression; - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSourceProperties.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSourceProperties.java deleted file mode 100644 index 73173f75..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteFileSourceProperties.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2015-2017 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.stream.app.file.remote; - -import java.io.File; -import java.util.regex.Pattern; - -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; - -/** - * Common properties for remote file sources (e.g. (S)FTP). - * - * @deprecated - properties are flattened. - * - * @author David Turanski - * @author Gary Russell - * - */ -@Deprecated -public abstract class AbstractRemoteFileSourceProperties extends AbstractRemoteFileProperties { - - /** - * Set to true to delete remote files after successful transfer. - */ - private boolean deleteRemoteFiles = false; - - /** - * The local directory to use for file transfers. - */ - private File localDir = new File(System.getProperty("java.io.tmpdir") + "/xd/ftp"); - - /** - * Set to true to create the local directory if it does not exist. - */ - private boolean autoCreateLocalDir = true; - - /** - * A filter pattern to match the names of files to transfer. - */ - private String filenamePattern; - - /** - * A filter regex pattern to match the names of files to transfer. - */ - private Pattern filenameRegex; - - /** - * Set to true to preserve the original timestamp. - */ - private boolean preserveTimestamp = true; - - public boolean isAutoCreateLocalDir() { - return autoCreateLocalDir; - } - - public void setAutoCreateLocalDir(boolean autoCreateLocalDir) { - this.autoCreateLocalDir = autoCreateLocalDir; - } - - public boolean isDeleteRemoteFiles() { - return deleteRemoteFiles; - } - - public void setDeleteRemoteFiles(boolean deleteRemoteFiles) { - this.deleteRemoteFiles = deleteRemoteFiles; - } - - @NotNull - public File getLocalDir() { - return localDir; - } - - public final void setLocalDir(File localDir) { - this.localDir = localDir; - } - - public String getFilenamePattern() { - return filenamePattern; - } - - public void setFilenamePattern(String filenamePattern) { - this.filenamePattern = filenamePattern; - } - - public Pattern getFilenameRegex() { - return filenameRegex; - } - - public void setFilenameRegex(Pattern filenameRegex) { - this.filenameRegex = filenameRegex; - } - - public boolean isPreserveTimestamp() { - return preserveTimestamp; - } - - public void setPreserveTimestamp(boolean preserveTimestamp) { - this.preserveTimestamp = preserveTimestamp; - } - - @AssertTrue(message = "filenamePattern and filenameRegex are mutually exclusive") - public boolean isExclusivePatterns() { - return !(this.filenamePattern != null && this.filenameRegex != null); - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteServerProperties.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteServerProperties.java deleted file mode 100644 index a5c3ee35..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/AbstractRemoteServerProperties.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2015-2016 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.stream.app.file.remote; - -import org.hibernate.validator.constraints.NotBlank; - -/** - * Common properties for remote servers (e.g. (S)FTP). - * - * @deprecated - properties are flattened. - * - * @author David Turanski - * @author Gary Russell - * - */ -@Deprecated -public abstract class AbstractRemoteServerProperties { - - /** - * The host name of the server. - */ - private String host = "localhost"; - - /** - * The username to use to connect to the server. - */ - - private String username; - /** - * The password to use to connect to the server. - */ - private String password; - - /** - * Cache sessions - */ - private Boolean cacheSessions; - - @NotBlank - public String getHost() { - return this.host; - } - - public void setHost(String host) { - this.host = host; - } - - @NotBlank - public String getUsername() { - return this.username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return this.password; - } - - public void setPassword(String password) { - this.password = password; - } - - public Boolean getCacheSessions() { - return this.cacheSessions; - } - - public void setCacheSessions(Boolean cacheSessions) { - this.cacheSessions = cacheSessions; - } - -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/FilePathUtils.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/FilePathUtils.java deleted file mode 100644 index f2d0306b..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/FilePathUtils.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2018 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.stream.app.file.remote; - -import java.nio.file.Paths; - -import org.springframework.integration.file.FileHeaders; -import org.springframework.lang.Nullable; -import org.springframework.messaging.Message; -import org.springframework.util.Assert; - -/** - * @author David Turanski - **/ -public abstract class FilePathUtils { - /** - * Returns a remote file path for a message with a file name as payload and {@link FileHeaders#REMOTE_DIRECTORY} - * included as a message header. - * - * @param message the message containing the header. - * @return the file path. - */ - @Nullable - public static String getRemoteFilePath(Message message) { - if (message.getHeaders().containsKey(FileHeaders.REMOTE_DIRECTORY)) { - String filename = (String) message.getPayload(); - String remoteDirectory = (String) message.getHeaders().get(FileHeaders.REMOTE_DIRECTORY); - return getPath(remoteDirectory, filename); - } - return null; - } - - public static String getLocalFilePath(String localDirectory, String filename) { - if (localDirectory != null) { - return getPath(localDirectory, filename); - } - return filename; - } - - private static String getPath(String dirName, String fileName) { - return Paths.get(dirName, fileName).toString(); - } -} diff --git a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/RemoteFileDeletingTransactionSynchronizationProcessor.java b/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/RemoteFileDeletingTransactionSynchronizationProcessor.java deleted file mode 100644 index 7c4518ef..00000000 --- a/applications/apps-core/common/stream-apps-file-common/src/main/java/org/springframework/cloud/stream/app/file/remote/RemoteFileDeletingTransactionSynchronizationProcessor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017 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.stream.app.file.remote; - -import org.springframework.integration.file.FileHeaders; -import org.springframework.integration.file.remote.RemoteFileTemplate; -import org.springframework.integration.transaction.IntegrationResourceHolder; -import org.springframework.integration.transaction.TransactionSynchronizationProcessor; - -/** - * A {@link TransactionSynchronizationProcessor} that deletes a remote file on - * success. - * - * @author Gary Russell - * - */ -public class RemoteFileDeletingTransactionSynchronizationProcessor implements TransactionSynchronizationProcessor { - - private final RemoteFileTemplate template; - - private final String remoteFileSeparator; - - /** - * Construct an instance with the provided template and separator. - * @param template the template. - * @param remoteFileSeparator the separator. - */ - public RemoteFileDeletingTransactionSynchronizationProcessor(RemoteFileTemplate template, - String remoteFileSeparator) { - this.template = template; - this.remoteFileSeparator = remoteFileSeparator; - } - - @Override - public void processBeforeCommit(IntegrationResourceHolder holder) { - } - - @Override - public void processAfterRollback(IntegrationResourceHolder holder) { - } - - @Override - public void processAfterCommit(IntegrationResourceHolder holder) { - String remoteDir = (String) holder.getMessage().getHeaders().get(FileHeaders.REMOTE_DIRECTORY); - String remoteFile = (String) holder.getMessage().getHeaders().get(FileHeaders.REMOTE_FILE); - this.template.remove(remoteDir + this.remoteFileSeparator + remoteFile); - } - -} diff --git a/applications/apps-core/common/stream-apps-ftp-common/pom.xml b/applications/apps-core/common/stream-apps-ftp-common/pom.xml deleted file mode 100644 index d1c410f5..00000000 --- a/applications/apps-core/common/stream-apps-ftp-common/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-ftp-common - stream-apps-ftp-common - - - - org.springframework.integration - spring-integration-ftp - true - - - org.springframework.cloud.stream.app - stream-apps-file-common - ${project.version} - - - - diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/pom.xml b/applications/apps-core/common/stream-apps-metadata-store-common/pom.xml deleted file mode 100644 index 37733f6a..00000000 --- a/applications/apps-core/common/stream-apps-metadata-store-common/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - 4.0.0 - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - - stream-apps-metadata-store-common - stream-apps-metadata-store-common - - - 1.11.439 - 2.0.0.RELEASE - 1.0.0.RELEASE - 4.0.1 - - - - - - org.springframework.integration - spring-integration-core - - - - - org.springframework.integration - spring-integration-redis - true - - - org.springframework.boot - spring-boot-starter-data-redis - true - - - - - org.springframework.integration - spring-integration-mongodb - true - - - org.springframework.boot - spring-boot-starter-data-mongodb - true - - - de.flapdoodle.embed - de.flapdoodle.embed.mongo - test - - - - - org.springframework.boot - spring-boot-starter-logging - true - - - org.apache.logging.log4j - log4j-to-slf4j - - - - - org.springframework.integration - spring-integration-gemfire - true - - - org.springframework.data - spring-data-gemfire - - - - - - org.springframework.data - spring-data-geode - true - - - - - - org.springframework.integration - spring-integration-jdbc - true - - - org.springframework.boot - spring-boot-starter-jdbc - true - - - org.hsqldb - hsqldb - test - - - - - org.springframework.integration - spring-integration-zookeeper - true - - - org.apache.curator - curator-test - ${curator.version} - test - - - - - org.springframework.integration - spring-integration-hazelcast - ${spring-integration-hazelcast.version} - true - - - - - org.springframework.integration - spring-integration-aws - ${spring-integration-aws.version} - true - - - com.amazonaws - aws-java-sdk-dynamodb - ${aws-java-sdk.version} - true - - - org.springframework.integration - spring-integration-test - test - - - - diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json b/applications/apps-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json deleted file mode 100644 index adede92b..00000000 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "sso":[{ - "name": "sso", - "label": "sso", - "plan": "notfree", - "tags": ["configuration"], - "credentials":{ - "uri": "https://pivotal.io", - "client_id": "fakeClientId", - "client_secret": "fakeSecret", - "access_token_uri": "token" - } - }]} diff --git a/applications/apps-core/common/stream-apps-security-common/pom.xml b/applications/apps-core/common/stream-apps-security-common/pom.xml deleted file mode 100644 index 1e3a5271..00000000 --- a/applications/apps-core/common/stream-apps-security-common/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-security-common - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - org.springframework.boot - spring-boot-autoconfigure-processor - true - - - javax.servlet - javax.servlet-api - provided - - - org.springframework.boot - spring-boot-starter-actuator - true - - - org.springframework.boot - spring-boot-starter-webflux - true - - - org.springframework.boot - spring-boot-starter-web - true - test - - - org.springframework.boot - spring-boot-starter-security - - - - diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/pom.xml b/applications/apps-core/common/stream-apps-task-launch-request-common/pom.xml deleted file mode 100644 index 4e785243..00000000 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-task-launch-request-common - stream-apps-task-launch-request-common - - - - org.springframework.cloud.stream.app - stream-apps-file-common - ${project.version} - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-stream - test-jar - test - test-binder - - - org.springframework.cloud - spring-cloud-stream - - - - org.springframework.cloud - spring-cloud-stream-test-support - test - - - - diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java b/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java deleted file mode 100644 index 199106c7..00000000 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2019 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.stream.app.tasklaunchrequest; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class DataFlowTaskLaunchRequest { - @JsonProperty("args") - private List commandlineArguments = new ArrayList<>(); - - @JsonProperty("deploymentProps") - private Map deploymentProperties = new HashMap<>(); - - @JsonProperty("name") - private String taskName; - - public void setCommandlineArguments(List commandlineArguments) { - this.commandlineArguments = new ArrayList<>(commandlineArguments); - } - - public List getCommandlineArguments() { - return this.commandlineArguments; - } - - public void setDeploymentProperties(Map deploymentProperties) { - this.deploymentProperties = deploymentProperties; - } - - public Map getDeploymentProperties() { - return this.deploymentProperties; - } - - public void setTaskName(String taskName) { - this.taskName = taskName; - } - - public String getTaskName() { - return this.taskName; - } - - public DataFlowTaskLaunchRequest addCommmandLineArguments(Collection args) { - this.commandlineArguments.addAll(args); - return this; - } -} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java b/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java deleted file mode 100644 index f53209c8..00000000 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2019 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.stream.app.tasklaunchrequest; - -import org.springframework.cloud.stream.app.tasklaunchrequest.support.CommandLineArgumentsMessageMapper; -import org.springframework.cloud.stream.app.tasklaunchrequest.support.TaskLaunchRequestSupplier; -import org.springframework.cloud.stream.app.tasklaunchrequest.support.TaskNameMessageMapper; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageHeaders; -import org.springframework.messaging.core.MessagePostProcessor; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.util.Assert; -import org.springframework.util.MimeTypeUtils; -import org.springframework.util.StringUtils; - -public class TaskLaunchRequestMessageProcessor implements MessagePostProcessor { - - private final TaskNameMessageMapper taskNameMessageMapper; - private final CommandLineArgumentsMessageMapper commandLineArgumentsMessageMapper; - private final TaskLaunchRequestSupplier taskLaunchRequestInitializer; - - public TaskLaunchRequestMessageProcessor(TaskLaunchRequestSupplier taskLaunchRequestInitializer, - TaskNameMessageMapper taskNameMessageMapper, - CommandLineArgumentsMessageMapper commandLIneArgumentsMessageMapper) { - - this.taskLaunchRequestInitializer = taskLaunchRequestInitializer; - - this.taskNameMessageMapper = taskNameMessageMapper; - - this.commandLineArgumentsMessageMapper = commandLIneArgumentsMessageMapper; - - } - - @Override - public Message postProcessMessage(Message message) { - DataFlowTaskLaunchRequest taskLaunchRequest = taskLaunchRequestInitializer.get(); - - if (!StringUtils.hasText(taskLaunchRequest.getTaskName())) { - taskLaunchRequest.setTaskName(taskNameMessageMapper.processMessage(message)); - Assert.hasText(taskLaunchRequest.getTaskName(), ()-> - "'taskName' is required in " + DataFlowTaskLaunchRequest.class.getName()); - } - - taskLaunchRequest.addCommmandLineArguments(commandLineArgumentsMessageMapper.processMessage(message)); - - MessageBuilder builder - = MessageBuilder.withPayload(taskLaunchRequest).copyHeaders(message.getHeaders()); - return adjustHeaders(builder).build(); - } - - - private MessageBuilder adjustHeaders(MessageBuilder builder) { - builder.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON); - return builder; - } -} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java b/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java deleted file mode 100644 index 9f8a3bb2..00000000 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2019 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.stream.app.tasklaunchrequest.support; - -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import org.springframework.cloud.stream.app.tasklaunchrequest.DataFlowTaskLaunchRequest; -import org.springframework.util.Assert; - -public class TaskLaunchRequestSupplier implements Supplier { - - private Supplier taskNameSupplier; - private Supplier> commandLineArgumentsSupplier; - private Supplier> deploymentPropertiesSupplier; - - - public TaskLaunchRequestSupplier taskNameSupplier(Supplier taskNameSupplier) { - this.taskNameSupplier = taskNameSupplier; - return this; - } - - public TaskLaunchRequestSupplier commandLineArgumentSupplier(Supplier> commandLineArgumentsSupplier) { - this.commandLineArgumentsSupplier = commandLineArgumentsSupplier; - return this; - } - - public TaskLaunchRequestSupplier deploymentPropertiesSupplier(Supplier> deploymentPropertiesSupplier) { - this.deploymentPropertiesSupplier = deploymentPropertiesSupplier; - return this; - } - - @Override - public DataFlowTaskLaunchRequest get() { - - Assert.notNull(this.taskNameSupplier, "'taskNameSupplier' is required."); - - DataFlowTaskLaunchRequest dataFlowTaskLaunchRequest = new DataFlowTaskLaunchRequest(); - dataFlowTaskLaunchRequest.setTaskName(this.taskNameSupplier.get()); - - if (this.commandLineArgumentsSupplier != null) { - dataFlowTaskLaunchRequest.setCommandlineArguments(this.commandLineArgumentsSupplier.get()); - } - - if (this.deploymentPropertiesSupplier != null) { - dataFlowTaskLaunchRequest.setDeploymentProperties(this.deploymentPropertiesSupplier.get()); - } - - return dataFlowTaskLaunchRequest; - } -} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java b/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java deleted file mode 100644 index abb59d0a..00000000 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2018 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.stream.app.tasklaunchrequest; - -import java.util.Map; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author Chris Schaefer - * @author David Turanski - */ -public class KeyValueListParserTests { - - @Test - public void testParseSimpleDeploymentProperty() { - Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( - "app.sftp.param=value"); - assertTrue("Invalid number of deployment properties: " + deploymentProperties.size(), - deploymentProperties.size() == 1); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.param")); - assertEquals("Invalid deployment value", "value", deploymentProperties.get("app.sftp.param")); - } - - @Test - public void testParseSimpleDeploymentPropertyMultipleValues() { - Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( - "app.sftp.param=value1,value2,value3"); - - assertTrue("Invalid number of deployment properties: " + deploymentProperties.size(), - deploymentProperties.size() == 1); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.param")); - assertEquals("Invalid deployment value", "value1,value2,value3", deploymentProperties.get("app.sftp.param")); - } - - @Test - public void testParseSpelExpressionMultipleValues() { - Map argExpressions = KeyValueListParser.parseCommaDelimitedKeyValuePairs( - "arg1=payload.substr(0,2),arg2=headers['foo'],arg3=headers['bar']==false"); - - assertTrue("Invalid number of deployment properties: " + argExpressions.size(), - argExpressions.size() == 3); - assertTrue("Expected deployment key not found", argExpressions.containsKey("arg1")); - assertEquals("Invalid deployment value", "payload.substr(0,2)", argExpressions.get("arg1")); - - assertTrue("Expected deployment key not found", argExpressions.containsKey("arg2")); - assertEquals("Invalid deployment value", "headers['foo']", argExpressions.get("arg2")); - - assertTrue("Expected deployment key not found", argExpressions.containsKey("arg3")); - assertEquals("Invalid deployment value", "headers['bar']==false", argExpressions.get("arg3")); - } - - @Test - public void testParseMultipleDeploymentPropertiesSingleValue() { - Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( - "app.sftp.param=value1,app.sftp.other.param=value2"); - - assertTrue("Invalid number of deployment properties: " + deploymentProperties.size(), - deploymentProperties.size() == 2); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.param")); - assertEquals("Invalid deployment value", "value1", deploymentProperties.get("app.sftp.param")); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.other.param")); - assertEquals("Invalid deployment value", "value2", deploymentProperties.get("app.sftp.other.param")); - } - - @Test - public void testParseMultipleDeploymentPropertiesMultipleValues() { - DataflowTaskLaunchRequestProperties taskLaunchRequestProperties = new DataflowTaskLaunchRequestProperties(); - - Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( - "app.sftp.param=value1,value2,app.sftp.other.param=other1,other2"); - - assertTrue("Invalid number of deployment properties: " + deploymentProperties.size(), - deploymentProperties.size() == 2); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.param")); - assertEquals("Invalid deployment value", "value1,value2", deploymentProperties.get("app.sftp.param")); - assertTrue("Expected deployment key not found", deploymentProperties.containsKey("app.sftp.other.param")); - assertEquals("Invalid deployment value", "other1,other2", deploymentProperties.get("app.sftp.other.param")); - } -} diff --git a/applications/apps-core/common/stream-apps-test-support/pom.xml b/applications/apps-core/common/stream-apps-test-support/pom.xml deleted file mode 100644 index 975777a2..00000000 --- a/applications/apps-core/common/stream-apps-test-support/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - stream-apps-common - org.springframework.cloud.stream.app - 3.0.0.BUILD-SNAPSHOT - - 4.0.0 - - stream-apps-test-support - - - - org.springframework.integration - spring-integration-test - - - org.springframework.integration - spring-integration-test-support - - - org.springframework.boot - spring-boot-starter-data-redis - true - - - - - diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/PropertiesInitializer.java b/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/PropertiesInitializer.java deleted file mode 100644 index 145adc5d..00000000 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/PropertiesInitializer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2014-2016 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.stream.app.test; - -import java.util.Properties; - -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.env.PropertiesPropertySource; - -/** - * @author David Turanski - */ -public class PropertiesInitializer implements ApplicationContextInitializer { - - public static Properties PROPERTIES; - - @Override - public void initialize(ConfigurableApplicationContext configurableApplicationContext) { - configurableApplicationContext.getEnvironment().getPropertySources().addLast(new - PropertiesPropertySource("applicationOptions", PROPERTIES)); - } -} diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/redis/RedisTestSupport.java b/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/redis/RedisTestSupport.java deleted file mode 100644 index 321d9499..00000000 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/redis/RedisTestSupport.java +++ /dev/null @@ -1,43 +0,0 @@ -///* -// * Copyright 2016 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.stream.app.test.redis; -// -//import org.springframework.cloud.stream.test.junit.AbstractExternalResourceTestSupport; -//import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -// -///** -// * Porting from https://github.com/spring-cloud/spring-cloud-stream/blob/1.0.x/spring-cloud-stream-test-support-internal -// * -// * @author Soby Chacko -// */ -//public class RedisTestSupport extends AbstractExternalResourceTestSupport { -// -// public RedisTestSupport() { -// super("REDIS"); -// } -// @Override -// protected void cleanupResource() throws Exception { -// resource.destroy(); -// } -// -// @Override -// protected void obtainResource() throws Exception { -// resource = new LettuceConnectionFactory(); -// resource.afterPropertiesSet(); -// resource.getConnection().close(); -// } -//} diff --git a/applications/pom.xml b/applications/pom.xml index 437137f2..2cf6e293 100644 --- a/applications/pom.xml +++ b/applications/pom.xml @@ -2,15 +2,15 @@ 4.0.0 org.springframework.cloud.stream.app - stream-apps + stream-applications-infra 3.0.0.BUILD-SNAPSHOT - stream-apps + stream-applications-infra Infrastructure for stream applications pom - apps-core - apps-build + stream-applications-core + stream-applications-build source sink processor diff --git a/applications/processor/bridge-processor/pom.xml b/applications/processor/bridge-processor/pom.xml index e3b612a0..6125d78b 100644 --- a/applications/processor/bridge-processor/pom.xml +++ b/applications/processor/bridge-processor/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 bridge-processor @@ -43,7 +43,8 @@ bridge processor ${project.version} - org.springframework.cloud.stream.app.BridgeProcessorConfiguration.class + org.springframework.cloud.stream.app.BridgeProcessorConfiguration.class + bridgeFunction 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 1c722ebb..06735e64 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 @@ -19,6 +19,7 @@ package org.springframework.cloud.stream.app; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -55,6 +56,7 @@ public class BridgeProcessorTests { } @EnableAutoConfiguration - @Import({ BridgeProcessorConfiguration.class }) - public static class BridgeTestAppConfiguration { } + @Import({BridgeProcessorConfiguration.class}) + public static class BridgeTestAppConfiguration { + } } diff --git a/applications/processor/filter-processor/pom.xml b/applications/processor/filter-processor/pom.xml index b491f6ca..6989b0cd 100644 --- a/applications/processor/filter-processor/pom.xml +++ b/applications/processor/filter-processor/pom.xml @@ -1,91 +1,91 @@ - - 4.0.0 - filter-processor - filter-processor - filter processor apps - 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + filter-processor + filter-processor + filter processor apps + 3.0.0.BUILD-SNAPSHOT - - org.springframework.cloud.stream.app - stream-apps-parent - 3.0.0.BUILD-SNAPSHOT - - + + org.springframework.cloud.stream.app + stream-apps-parent + 3.0.0.BUILD-SNAPSHOT + + - - - org.springframework.cloud.fn - filter-function - ${java-functions.version} - + + + org.springframework.cloud.fn + filter-function + ${java-functions.version} + - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - org.springframework.boot - spring-boot-starter-json - test - - + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.springframework.boot + spring-boot-starter-json + test + + - - - - org.springframework.cloud - spring-cloud-app-starter-doc-maven-plugin - - - org.springframework.cloud.stream.app.plugin - spring-cloud-stream-app-maven-plugin - - - filter - processor - ${project.version} - org.springframework.cloud.fn.filter.FilterFunctionConfiguration.class - byteArrayTextToString|filterFunction - + + + + org.springframework.cloud + spring-cloud-app-starter-doc-maven-plugin + + + org.springframework.cloud.stream.app.plugin + spring-cloud-stream-app-maven-plugin + + + filter + processor + ${project.version} + org.springframework.cloud.fn.filter.FilterFunctionConfiguration.class + byteArrayTextToString|filterFunction + - - - org.springframework.cloud.fn - filter-function - ${java-functions.version} - - - - - - + + + org.springframework.cloud.fn + filter-function + ${java-functions.version} + + + + + + - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + diff --git a/applications/processor/filter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/processor/filter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index ff1bc322..e0d1c859 100644 --- a/applications/processor/filter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/processor/filter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=SpelFunctionProperties \ No newline at end of file +configuration-properties.classes=SpelFunctionProperties 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 c8d18fdd..bcfb11f8 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 @@ -19,6 +19,7 @@ package org.springframework.cloud.stream.app.filter.processor; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -62,7 +63,8 @@ public class FilterProcessorTests { } @EnableAutoConfiguration - @Import({ FilterFunctionConfiguration.class }) - public static class FilterProcessorConfiguration {} + @Import({FilterFunctionConfiguration.class}) + public static class FilterProcessorConfiguration { + } } diff --git a/applications/processor/pom.xml b/applications/processor/pom.xml index 6390a810..ccb24d16 100644 --- a/applications/processor/pom.xml +++ b/applications/processor/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 diff --git a/applications/processor/splitter-processor/pom.xml b/applications/processor/splitter-processor/pom.xml index 8e9a3eb1..a855d4eb 100644 --- a/applications/processor/splitter-processor/pom.xml +++ b/applications/processor/splitter-processor/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 splitter-processor 3.0.0.BUILD-SNAPSHOT @@ -52,7 +53,8 @@ splitter processor ${project.version} - org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration.class + org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration.class + byteArrayTextToString|splitterFunction diff --git a/applications/processor/splitter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/processor/splitter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 70bc4605..a4df8685 100644 --- a/applications/processor/splitter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/processor/splitter-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.splitter.SplitterFunctionProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.splitter.SplitterFunctionProperties 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 213bb967..8e5235b8 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 @@ -19,6 +19,7 @@ package org.springframework.cloud.stream.app.splitter.processor; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -58,6 +59,7 @@ public class SplitterProcessorTests { } @EnableAutoConfiguration - @Import({ SplitterFunctionConfiguration.class }) - public static class SplitterProcessorConfiguration {} + @Import({SplitterFunctionConfiguration.class}) + public static class SplitterProcessorConfiguration { + } } diff --git a/applications/processor/transform-processor/pom.xml b/applications/processor/transform-processor/pom.xml index f93209e6..6c92b604 100644 --- a/applications/processor/transform-processor/pom.xml +++ b/applications/processor/transform-processor/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 transform-processor 3.0.0.BUILD-SNAPSHOT diff --git a/applications/processor/transform-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/processor/transform-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index aa9720e2..523b1d70 100644 --- a/applications/processor/transform-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/processor/transform-processor/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.spel.SpelFunctionProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.spel.SpelFunctionProperties 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 f65c2c82..837df49c 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 @@ -19,6 +19,7 @@ package org.springframework.cloud.stream.app.transform.processor; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -54,7 +55,8 @@ public class TransformProcessorTests { } @EnableAutoConfiguration - @Import({ SpelFunctionConfiguration.class }) - public static class TransformProcessorConfiguration {} + @Import({SpelFunctionConfiguration.class}) + public static class TransformProcessorConfiguration { + } } diff --git a/applications/sink/cassandra-sink/pom.xml b/applications/sink/cassandra-sink/pom.xml index 01cfde05..5a8566f0 100644 --- a/applications/sink/cassandra-sink/pom.xml +++ b/applications/sink/cassandra-sink/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 cassandra-sink 3.0.0.BUILD-SNAPSHOT @@ -41,7 +42,9 @@ cassandra sink ${project.version} - org.springframework.cloud.fn.consumer.cassandra.CassandraConsumerConfiguration.class + + org.springframework.cloud.fn.consumer.cassandra.CassandraConsumerConfiguration.class + diff --git a/applications/sink/cassandra-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/cassandra-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 38811295..5a73b4c9 100644 --- a/applications/sink/cassandra-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/cassandra-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,3 +1,3 @@ configuration-properties.classes=CassandraConsumerProperties, \ CassandraClusterProperties, \ - org.springframework.boot.autoconfigure.cassandra.CassandraProperties \ No newline at end of file + org.springframework.boot.autoconfigure.cassandra.CassandraProperties diff --git a/applications/sink/counter-sink/pom.xml b/applications/sink/counter-sink/pom.xml index d6a6ac9c..26fa6ed2 100644 --- a/applications/sink/counter-sink/pom.xml +++ b/applications/sink/counter-sink/pom.xml @@ -1,98 +1,99 @@ - - 4.0.0 - counter-sink - 3.0.0.BUILD-SNAPSHOT - counter-sink - counter sink apps - jar + + 4.0.0 + counter-sink + 3.0.0.BUILD-SNAPSHOT + counter-sink + counter sink apps + jar - - org.springframework.cloud.stream.app - stream-apps-parent - 3.0.0.BUILD-SNAPSHOT - - + + org.springframework.cloud.stream.app + stream-apps-parent + 3.0.0.BUILD-SNAPSHOT + + - - - org.springframework.cloud.fn - counter-consumer - ${java-functions.version} - + + + org.springframework.cloud.fn + counter-consumer + ${java-functions.version} + - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - org.awaitility - awaitility - test - - - junit - junit - - - - + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.awaitility + awaitility + test + + + junit + junit + + + + - - - - org.springframework.cloud - spring-cloud-app-starter-doc-maven-plugin - - - org.springframework.cloud.stream.app.plugin - spring-cloud-stream-app-maven-plugin - - - counter - sink - ${project.version} - org.springframework.cloud.fn.consumer.counter.CounterConsumerConfiguration.class - byteArrayTextToString|counterConsumer - - - - org.springframework.cloud.fn - counter-consumer - ${java-functions.version} - - - - - - + + + + org.springframework.cloud + spring-cloud-app-starter-doc-maven-plugin + + + org.springframework.cloud.stream.app.plugin + spring-cloud-stream-app-maven-plugin + + + counter + sink + ${project.version} + org.springframework.cloud.fn.consumer.counter.CounterConsumerConfiguration.class + + byteArrayTextToString|counterConsumer + + + + org.springframework.cloud.fn + counter-consumer + ${java-functions.version} + + + + + + - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + diff --git a/applications/sink/counter-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/counter-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 66583ecc..b3140c5a 100644 --- a/applications/sink/counter-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/counter-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,2 +1,3 @@ configuration-properties.classes=CounterConsumerProperties, \ CounterConsumerProperties$MetricsTag + 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 56a38de8..e938f155 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 @@ -69,6 +69,7 @@ public class CounterSinkTests { @EnableAutoConfiguration //@Import({CounterConsumerConfiguration.class, PayloadConverterConfiguration.class}) @Import({CounterConsumerConfiguration.class}) - public static class CounterSinkConfiguration {} + public static class CounterSinkConfiguration { + } } diff --git a/applications/sink/file-sink/pom.xml b/applications/sink/file-sink/pom.xml index b1a8003c..91814e48 100644 --- a/applications/sink/file-sink/pom.xml +++ b/applications/sink/file-sink/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 file-sink @@ -42,7 +42,8 @@ file sink ${project.version} - org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration.class + org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration.class + diff --git a/applications/sink/file-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/file-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 3a01d9ee..542a210f 100644 --- a/applications/sink/file-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/file-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.consumer.file.FileConsumerProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.consumer.file.FileConsumerProperties 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 a6774579..75a8b0f5 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 @@ -20,12 +20,13 @@ import java.io.File; import java.io.FileReader; import java.nio.file.Path; -import org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration; import org.springframework.cloud.stream.binder.test.InputDestination; import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; import org.springframework.context.ConfigurableApplicationContext; @@ -67,5 +68,6 @@ public class FileSinkTests { @EnableAutoConfiguration @Import(FileConsumerConfiguration.class) - public static class FileSinkConfiguration {} + public static class FileSinkConfiguration { + } } diff --git a/applications/sink/jdbc-sink/pom.xml b/applications/sink/jdbc-sink/pom.xml index a36c808d..ecc4b194 100644 --- a/applications/sink/jdbc-sink/pom.xml +++ b/applications/sink/jdbc-sink/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 jdbc-sink @@ -60,7 +60,8 @@ jdbc sink ${project.version} - org.springframework.cloud.fn.consumer.jdbc.JdbcConsumerConfiguration.class + org.springframework.cloud.fn.consumer.jdbc.JdbcConsumerConfiguration.class + diff --git a/applications/sink/jdbc-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/jdbc-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 764ba642..2f0ef975 100644 --- a/applications/sink/jdbc-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/jdbc-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -6,4 +6,4 @@ spring.datasource.username,\ spring.datasource.password,\ spring.datasource.schema,\ spring.datasource.data,\ -spring.datasource.initialization-mode \ No newline at end of file +spring.datasource.initialization-mode 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 a363889a..4e3fe5d4 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 @@ -17,6 +17,7 @@ package org.springframework.cloud.stream.app.jdbc.sink; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -53,7 +54,8 @@ public class JdbcSinkTests { @EnableAutoConfiguration @Import(JdbcConsumerConfiguration.class) - public static class JdbcSinkConfiguration {} + public static class JdbcSinkConfiguration { + } static class Payload { @@ -61,10 +63,10 @@ public class JdbcSinkTests { private Integer b; - public Payload() { + Payload() { } - public Payload(String a, Integer b) { + Payload(String a, Integer b) { this.a = a; this.b = b; } @@ -73,14 +75,14 @@ public class JdbcSinkTests { 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; } diff --git a/applications/sink/log-sink/pom.xml b/applications/sink/log-sink/pom.xml index fb24a566..82d072b4 100644 --- a/applications/sink/log-sink/pom.xml +++ b/applications/sink/log-sink/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 log-sink 3.0.0.BUILD-SNAPSHOT @@ -52,7 +53,8 @@ log sink ${project.version} - org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class + org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class + byteArrayTextToString|logConsumer diff --git a/applications/sink/log-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/log-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 89d8345b..ab4592d7 100644 --- a/applications/sink/log-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/log-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties 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 1a45314c..51e868da 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 @@ -18,7 +18,6 @@ package org.springframework.cloud.stream.app; import java.nio.charset.StandardCharsets; -import org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,6 +27,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration; import org.springframework.cloud.stream.binder.test.InputDestination; import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; import org.springframework.context.ConfigurableApplicationContext; @@ -55,5 +55,6 @@ public class LogSinkTests { @EnableAutoConfiguration @Import(LogConsumerConfiguration.class) - public static class LogSinkConfiguration {} + public static class LogSinkConfiguration { + } } diff --git a/applications/sink/mongodb-sink/README.adoc b/applications/sink/mongodb-sink/README.adoc index 1f78d259..98db6774 100644 --- a/applications/sink/mongodb-sink/README.adoc +++ b/applications/sink/mongodb-sink/README.adoc @@ -18,8 +18,8 @@ The **$$mongodb$$** $$sink$$ has the following options: //tag::configuration-properties[] -$$mongodb.consumer.collection$$:: $$The MongoDB collection to store data$$ *($$String$$, default: `$$$$`)* -$$mongodb.consumer.collection-expression$$:: $$The SpEL expression to evaluate MongoDB collection$$ *($$Expression$$, default: `$$$$`)* +$$mongodb.consumer.collection$$:: $$The MongoDB collection to store data.$$ *($$String$$, default: `$$$$`)* +$$mongodb.consumer.collection-expression$$:: $$The SpEL expression to evaluate MongoDB collection.$$ *($$Expression$$, default: `$$$$`)* //end::configuration-properties[] //end::ref-doc[] diff --git a/applications/sink/mongodb-sink/pom.xml b/applications/sink/mongodb-sink/pom.xml index 9af3540d..21a0bd66 100644 --- a/applications/sink/mongodb-sink/pom.xml +++ b/applications/sink/mongodb-sink/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 mongodb-sink 3.0.0.BUILD-SNAPSHOT @@ -41,7 +42,8 @@ mongodb sink ${project.version} - org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerConfiguration.class + org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerConfiguration.class + diff --git a/applications/sink/mongodb-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/mongodb-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 0570c896..62089217 100644 --- a/applications/sink/mongodb-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/mongodb-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerProperties diff --git a/applications/sink/pom.xml b/applications/sink/pom.xml index d02982b9..6ea9e05b 100644 --- a/applications/sink/pom.xml +++ b/applications/sink/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 diff --git a/applications/sink/rabbit-sink/pom.xml b/applications/sink/rabbit-sink/pom.xml index c3146046..17e52f3a 100644 --- a/applications/sink/rabbit-sink/pom.xml +++ b/applications/sink/rabbit-sink/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 rabbit-sink 3.0.0.BUILD-SNAPSHOT @@ -74,7 +75,8 @@ rabbit sink ${project.version} - org.springframework.cloud.fn.consumer.rabbit.RabbitConsumerConfiguration.class + org.springframework.cloud.fn.consumer.rabbit.RabbitConsumerConfiguration.class + diff --git a/applications/sink/rabbit-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/sink/rabbit-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index c052f6e5..52edb5a6 100644 --- a/applications/sink/rabbit-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/sink/rabbit-sink/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,2 +1,2 @@ configuration-properties.classes=RabbitConsumerProperties, \ - org.springframework.boot.autoconfigure.amqp.RabbitProperties \ No newline at end of file + org.springframework.boot.autoconfigure.amqp.RabbitProperties diff --git a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/OwnConnectionTest.java b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/OwnConnectionTest.java index a2e5f21f..cf899ccc 100644 --- a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/OwnConnectionTest.java +++ b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/OwnConnectionTest.java @@ -17,16 +17,16 @@ package org.springframework.cloud.stream.app.rabbit.sink; import org.junit.jupiter.api.Test; + import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Queue; import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.TestPropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; @TestPropertySource(properties = {"rabbit.routingKey=scsapp-testOwn", - "rabbit.own-connection=true"}) + "rabbit.own-connection=true"}) public class OwnConnectionTest extends RabbitSinkIntegrationTests { /** @@ -35,9 +35,6 @@ public class OwnConnectionTest extends RabbitSinkIntegrationTests { // @ClassRule // public static GenericContainer rabbitMq = new GenericContainer("rabbitmq:3.5.3") // .withExposedPorts(5672); - - - @Test public void test() { this.rabbitAdmin.declareQueue( @@ -47,7 +44,7 @@ public class OwnConnectionTest extends RabbitSinkIntegrationTests { .build()); this.rabbitTemplate.setReceiveTimeout(10000); Message received = this.rabbitTemplate.receive("scsapp-testOwn"); - assertEquals("foo", new String(received.getBody())); + assertThat(new String(received.getBody())).isEqualTo("foo"); assertThat(this.bootFactory.getCacheProperties().getProperty("localPort")).isEqualTo("0"); } } diff --git a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkIntegrationTests.java b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkIntegrationTests.java index 9077e8ca..7bd8c882 100644 --- a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkIntegrationTests.java +++ b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/RabbitSinkIntegrationTests.java @@ -22,6 +22,8 @@ import com.github.dockerjava.api.command.CreateContainerCmd; import com.github.dockerjava.api.model.ExposedPort; import com.github.dockerjava.api.model.PortBinding; import com.github.dockerjava.api.model.Ports; +import org.testcontainers.containers.GenericContainer; + import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.DirectExchange; @@ -40,7 +42,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.messaging.SubscribableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.testcontainers.containers.GenericContainer; @SpringBootTest( properties = {"spring.cloud.stream.function.definition=rabbitConsumer"}, @@ -49,25 +50,6 @@ import org.testcontainers.containers.GenericContainer; @Import(RabbitSinkIntegrationTests.FooConfiguration.class) abstract class RabbitSinkIntegrationTests { - @Qualifier("rabbitConsumer-in-0") - @Autowired - protected SubscribableChannel channels; - - @Autowired - protected RabbitConsumerProperties rabbitSinkProperties; - - @Autowired - protected RabbitTemplate rabbitTemplate; - - @Autowired - protected RabbitAdmin rabbitAdmin; - - @Autowired(required = false) - protected MessageConverter myConverter; - - @Autowired - protected CachingConnectionFactory bootFactory; - static { Consumer cmd = e -> e.withPortBindings(new PortBinding(Ports.Binding.bindPort(5672), new ExposedPort(5672))); @@ -77,6 +59,20 @@ abstract class RabbitSinkIntegrationTests { rabbitMq.start(); } + @Qualifier("rabbitConsumer-in-0") + @Autowired + protected SubscribableChannel channels; + @Autowired + protected RabbitConsumerProperties rabbitSinkProperties; + @Autowired + protected RabbitTemplate rabbitTemplate; + @Autowired + protected RabbitAdmin rabbitAdmin; + @Autowired(required = false) + protected MessageConverter myConverter; + @Autowired + protected CachingConnectionFactory bootFactory; + static class FooConfiguration { @Bean @@ -98,5 +94,6 @@ abstract class RabbitSinkIntegrationTests { @SpringBootApplication @Import({RabbitConsumerConfiguration.class}) - public static class RabbitSinkConfiguration {} + public static class RabbitSinkConfiguration { + } } 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 c7ee1e2a..861bbe35 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 @@ -1,20 +1,5 @@ /* - * Copyright 2016-2018 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. - */ -/* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-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. @@ -31,12 +16,8 @@ package org.springframework.cloud.stream.app.rabbit.sink; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.instanceOf; -import static org.junit.Assert.fail; - import org.junit.jupiter.api.Test; + import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.bind.validation.BindValidationException; @@ -46,6 +27,11 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import org.springframework.context.annotation.Configuration; import org.springframework.validation.FieldError; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.fail; + /** * Tests for RabbitSource with invalid config. * diff --git a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/SimpleRoutingKeyAndCustomHeaderTests.java b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/SimpleRoutingKeyAndCustomHeaderTests.java index 872b9ea9..05eb171f 100644 --- a/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/SimpleRoutingKeyAndCustomHeaderTests.java +++ b/applications/sink/rabbit-sink/src/test/java/org/springframework/cloud/stream/app/rabbit/sink/SimpleRoutingKeyAndCustomHeaderTests.java @@ -17,13 +17,13 @@ package org.springframework.cloud.stream.app.rabbit.sink; import org.junit.jupiter.api.Test; + import org.springframework.amqp.core.Message; import org.springframework.amqp.core.MessageDeliveryMode; import org.springframework.integration.support.MessageBuilder; import org.springframework.test.context.TestPropertySource; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.assertj.core.api.Assertions.assertThat; @TestPropertySource(properties = {"rabbit.routingKey=scsapp-testq", "rabbit.persistentDeliveryMode=true", @@ -38,9 +38,9 @@ public class SimpleRoutingKeyAndCustomHeaderTests extends RabbitSinkIntegrationT .build()); this.rabbitTemplate.setReceiveTimeout(10000); Message received = this.rabbitTemplate.receive("scsapp-testq"); - assertEquals("foo", new String(received.getBody())); - assertEquals("baz", received.getMessageProperties().getHeaders().get("bar")); - assertNull(received.getMessageProperties().getHeaders().get("qux")); - assertEquals(MessageDeliveryMode.PERSISTENT, received.getMessageProperties().getReceivedDeliveryMode()); + assertThat(new String(received.getBody())).isEqualTo("foo"); + assertThat(received.getMessageProperties().getHeaders().get("bar")).isEqualTo("baz"); + assertThat(received.getMessageProperties().getHeaders().get("qux")).isNull(); + assertThat(received.getMessageProperties().getReceivedDeliveryMode()).isEqualTo(MessageDeliveryMode.PERSISTENT); } } diff --git a/applications/source/file-source/pom.xml b/applications/source/file-source/pom.xml index 7c238071..42c791ce 100644 --- a/applications/source/file-source/pom.xml +++ b/applications/source/file-source/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 file-source @@ -42,7 +42,8 @@ file source ${project.version} - org.springframework.cloud.fn.supplier.file.FileSupplierConfiguration.class + org.springframework.cloud.fn.supplier.file.FileSupplierConfiguration.class + diff --git a/applications/source/file-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/source/file-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index f750801d..cb35d57e 100644 --- a/applications/source/file-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/source/file-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,2 +1,2 @@ configuration-properties.classes=FileSupplierProperties,\ - FileConsumerProperties \ No newline at end of file + FileConsumerProperties 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 426ca24b..70c59fc2 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 @@ -19,6 +19,7 @@ import java.nio.file.Path; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -59,5 +60,6 @@ public class FileSourceTests { @EnableAutoConfiguration @Import(FileSupplierConfiguration.class) - public static class FileSourceConfiguration {} + public static class FileSourceConfiguration { + } } diff --git a/applications/source/http-source/pom.xml b/applications/source/http-source/pom.xml index b5f0674e..343d3811 100644 --- a/applications/source/http-source/pom.xml +++ b/applications/source/http-source/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 http-source 3.0.0.BUILD-SNAPSHOT @@ -51,7 +52,8 @@ http source ${project.version} - org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class + org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class + @@ -65,7 +67,8 @@ spring.main.web-application-type=reactive spring.cloud.streamapp.security.enabled=false - spring.cloud.streamapp.security.csrf-enabled=false + spring.cloud.streamapp.security.csrf-enabled=false + diff --git a/applications/source/http-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/source/http-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 81cfa8ee..26d8b848 100644 --- a/applications/source/http-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/source/http-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,3 +1,3 @@ configuration-properties.classes=HttpSourceProperties,\ HttpSourceProperties$Cors -configuration-properties.names=server.port \ No newline at end of file +configuration-properties.names=server.port 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 083e19ab..c7002b84 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 @@ -17,6 +17,7 @@ package org.springframework.cloud.stream.app; 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; @@ -34,24 +35,24 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Soby Chacko */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = {"spring.cloud.function.definition=httpSupplier","debug=true"}) + properties = {"spring.cloud.function.definition=httpSupplier", "debug=true"}) public class HttpSourceTests { - @Autowired - private TestRestTemplate testRestTemplate; - @Autowired OutputDestination outputDestination; + @Autowired + private TestRestTemplate testRestTemplate; @Test public void testSourceFromSupplier() { - testRestTemplate.postForObject("/", "test1", Object.class); - Message sourceMessage = outputDestination.receive(10000); - final String actual = new String(sourceMessage.getPayload()); - assertThat(actual).isEqualTo("test1"); + testRestTemplate.postForObject("/", "test1", Object.class); + Message sourceMessage = outputDestination.receive(10000); + final String actual = new String(sourceMessage.getPayload()); + assertThat(actual).isEqualTo("test1"); } @SpringBootApplication @Import({HttpSupplierConfiguration.class, TestChannelBinderConfiguration.class, BindingServiceConfiguration.class}) - public static class HttpSourceConfiguration {} + public static class HttpSourceConfiguration { + } } diff --git a/applications/source/jdbc-source/pom.xml b/applications/source/jdbc-source/pom.xml index 90ff70c6..b92834b7 100644 --- a/applications/source/jdbc-source/pom.xml +++ b/applications/source/jdbc-source/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 jdbc-source 3.0.0.BUILD-SNAPSHOT @@ -62,7 +63,8 @@ jdbc source ${project.version} - org.springframework.cloud.fn.supplier.jdbc.JdbcSupplierConfiguration.class + org.springframework.cloud.fn.supplier.jdbc.JdbcSupplierConfiguration.class + diff --git a/applications/source/jdbc-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/source/jdbc-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index 5444c6cd..b37ecfd5 100644 --- a/applications/source/jdbc-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/source/jdbc-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -7,4 +7,4 @@ spring.datasource.username,\ spring.datasource.password,\ spring.datasource.schema,\ spring.datasource.data,\ -spring.datasource.initialization-mode \ No newline at end of file +spring.datasource.initialization-mode diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/DefaultBehaviorTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/DefaultBehaviorTests.java index 9324da79..7a3ce34f 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/DefaultBehaviorTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/DefaultBehaviorTests.java @@ -20,12 +20,10 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; + import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import static org.assertj.core.api.Assertions.assertThat; @TestPropertySource(properties = "jdbc.supplier.query=select id, name from test order by id") @@ -34,25 +32,25 @@ class DefaultBehaviorTests extends JdbcSourceIntegrationTests { @Test void testExtraction() throws Exception { Message received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); Map payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(1, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(1); received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(2, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(2); received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(3, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(3); } } 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 44fe0871..9e388476 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 @@ -17,6 +17,7 @@ package org.springframework.cloud.stream.app.jdbc.source; import com.fasterxml.jackson.databind.ObjectMapper; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -51,6 +52,7 @@ public class JdbcSourceIntegrationTests { @SpringBootApplication @Import(JdbcSupplierConfiguration.class) - public static class JdbcSourceConfiguration { } + public static class JdbcSourceConfiguration { + } } diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/Select2PerPollNoSplitWithUpdateTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/Select2PerPollNoSplitWithUpdateTests.java index 2ad4d592..fc01910c 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/Select2PerPollNoSplitWithUpdateTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/Select2PerPollNoSplitWithUpdateTests.java @@ -23,12 +23,11 @@ import java.util.concurrent.TimeUnit; import com.fasterxml.jackson.databind.type.CollectionLikeType; import com.fasterxml.jackson.databind.type.TypeFactory; import org.junit.jupiter.api.Test; + import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; /** * @author Soby Chacko @@ -38,13 +37,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; "jdbc.supplier.query=select id, name, tag from test where tag is NULL order by id", "jdbc.supplier.split=false", "jdbc.supplier.maxRows=2", - "jdbc.supplier.update=update test set tag='1' where id in (:id)" }) + "jdbc.supplier.update=update test set tag='1' where id in (:id)"}) public class Select2PerPollNoSplitWithUpdateTests extends JdbcSourceIntegrationTests { @Test public void testExtraction() throws Exception { Message received = this.messageCollector.forChannel(this.output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); CollectionLikeType valueType = TypeFactory.defaultInstance() @@ -52,14 +51,14 @@ public class Select2PerPollNoSplitWithUpdateTests extends JdbcSourceIntegrationT List> payload = this.objectMapper.readValue((String) received.getPayload(), valueType); - assertEquals(2, payload.size()); - assertEquals(1, payload.get(0).get("ID")); - assertEquals(2, payload.get(1).get("ID")); + assertThat(payload.size()).isEqualTo(2); + assertThat(payload.get(0).get("ID")).isEqualTo(1); + assertThat(payload.get(1).get("ID")).isEqualTo(2); received = this.messageCollector.forChannel(this.output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); payload = this.objectMapper.readValue((String) received.getPayload(), valueType); - assertEquals(1, payload.size()); - assertEquals(3, payload.get(0).get("ID")); + assertThat(payload.size()).isEqualTo(1); + assertThat(payload.get(0).get("ID")).isEqualTo(3); } } 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 1ffbf7d0..602b205c 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 @@ -23,12 +23,11 @@ import java.util.concurrent.TimeUnit; import com.fasterxml.jackson.databind.type.CollectionLikeType; import com.fasterxml.jackson.databind.type.TypeFactory; import org.junit.jupiter.api.Test; + import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; /** * @author Soby Chacko @@ -43,7 +42,7 @@ public class SelectAllNoSplitTests extends JdbcSourceIntegrationTests { @Test public void testExtraction() throws Exception { Message received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); CollectionLikeType valueType = TypeFactory.defaultInstance() @@ -51,9 +50,9 @@ public class SelectAllNoSplitTests extends JdbcSourceIntegrationTests { List> payload = this.objectMapper.readValue((String) received.getPayload(), valueType); - assertEquals(3, payload.size()); - assertEquals(1, payload.get(0).get("ID")); - assertEquals("John", payload.get(2).get("NAME")); + assertThat(payload.size()).isEqualTo(3); + assertThat(payload.get(0).get("ID")).isEqualTo(1); + assertThat(payload.get(2).get("NAME")).isEqualTo("John"); } } diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithDelayTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithDelayTests.java index 700ae9fc..d439f645 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithDelayTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithDelayTests.java @@ -20,40 +20,38 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; + import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -@TestPropertySource(properties = { "jdbc.supplier.query=select id, name from test order by id", "spring.cloud.stream.poller.fixedDelay=60000" }) +@TestPropertySource(properties = {"jdbc.supplier.query=select id, name from test order by id", "spring.cloud.stream.poller.fixedDelay=60000"}) public class SelectAllWithDelayTests extends JdbcSourceIntegrationTests { - @Test - public void testExtraction() throws Exception { - Message received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); - assertThat(received.getPayload().getClass()).isEqualTo(String.class); + @Test + public void testExtraction() throws Exception { + Message received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); + assertThat(received).isNotNull(); + assertThat(received.getPayload().getClass()).isEqualTo(String.class); - Map payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); + Map payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(1, payload.get("ID")); - received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); - assertThat(received.getPayload().getClass()).isEqualTo(String.class); + assertThat(payload.get("ID")).isEqualTo(1); + received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); + assertThat(received).isNotNull(); + assertThat(received.getPayload().getClass()).isEqualTo(String.class); - payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(2, payload.get("ID")); - received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); - assertThat(received.getPayload().getClass()).isEqualTo(String.class); + payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); + assertThat(payload.get("ID")).isEqualTo(2); + received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); + assertThat(received).isNotNull(); + assertThat(received.getPayload().getClass()).isEqualTo(String.class); - payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(3, payload.get("ID")); - // should not wrap around to the beginning since delay is 60 - received = messageCollector.forChannel(output).poll(1, TimeUnit.SECONDS); - assertNull(received); - } + payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); + assertThat(payload.get("ID")).isEqualTo(3); + // should not wrap around to the beginning since delay is 60 + received = messageCollector.forChannel(output).poll(1, TimeUnit.SECONDS); + assertThat(received).isNull(); + } } diff --git a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithMinDelayTests.java b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithMinDelayTests.java index 27bbda7a..2e717a1d 100644 --- a/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithMinDelayTests.java +++ b/applications/source/jdbc-source/src/test/java/org/springframework/cloud/stream/app/jdbc/source/SelectAllWithMinDelayTests.java @@ -20,46 +20,45 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; + import org.springframework.messaging.Message; import org.springframework.test.context.TestPropertySource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -@TestPropertySource(properties = { "jdbc.supplier.query=select id, name from test order by id", "spring.cloud.stream.poller.fixedDelay=1" }) +@TestPropertySource(properties = {"jdbc.supplier.query=select id, name from test order by id", "spring.cloud.stream.poller.fixedDelay=1"}) public class SelectAllWithMinDelayTests extends JdbcSourceIntegrationTests { @Test public void testExtraction() throws Exception { Message received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); Map payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(1, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(1); received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(2, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(2); received = messageCollector.forChannel(output).poll(10, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(3, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(3); // should wrap around to the beginning received = messageCollector.forChannel(output).poll(2, TimeUnit.SECONDS); - assertNotNull(received); + assertThat(received).isNotNull(); assertThat(received.getPayload().getClass()).isEqualTo(String.class); payload = this.objectMapper.readValue((String) received.getPayload(), Map.class); - assertEquals(1, payload.get("ID")); + assertThat(payload.get("ID")).isEqualTo(1); } } diff --git a/applications/source/mongodb-source/README.adoc b/applications/source/mongodb-source/README.adoc index ea65829c..dddfc9b4 100644 --- a/applications/source/mongodb-source/README.adoc +++ b/applications/source/mongodb-source/README.adoc @@ -13,9 +13,9 @@ The **$$mongodb$$** $$source$$ has the following options: //tag::configuration-properties[] -$$mongodb.supplier.collection$$:: $$The MongoDB collection to query$$ *($$String$$, default: `$$$$`)* -$$mongodb.supplier.query$$:: $$The MongoDB query$$ *($$String$$, default: `$${ }$$`)* -$$mongodb.supplier.query-expression$$:: $$The SpEL expression in MongoDB query DSL style$$ *($$Expression$$, default: `$$$$`)* +$$mongodb.supplier.collection$$:: $$The MongoDB collection to query.$$ *($$String$$, default: `$$$$`)* +$$mongodb.supplier.query$$:: $$The MongoDB query.$$ *($$String$$, default: `$${ }$$`)* +$$mongodb.supplier.query-expression$$:: $$The SpEL expression in MongoDB query DSL style.$$ *($$Expression$$, default: `$$$$`)* $$mongodb.supplier.split$$:: $$Whether to split the query result as individual messages.$$ *($$Boolean$$, default: `$$true$$`)* //end::configuration-properties[] diff --git a/applications/source/mongodb-source/pom.xml b/applications/source/mongodb-source/pom.xml index 8d6c7e1a..2d507866 100644 --- a/applications/source/mongodb-source/pom.xml +++ b/applications/source/mongodb-source/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 mongodb-source 3.0.0.BUILD-SNAPSHOT @@ -41,7 +42,8 @@ mongodb source ${project.version} - org.springframework.cloud.fn.supplier.mongo.MongodbSupplierConfiguration.class + org.springframework.cloud.fn.supplier.mongo.MongodbSupplierConfiguration.class + diff --git a/applications/source/mongodb-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/source/mongodb-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index db0d96af..9179cf5b 100644 --- a/applications/source/mongodb-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/source/mongodb-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1 +1 @@ -configuration-properties.classes=org.springframework.cloud.fn.supplier.mongo.MongodbSupplierProperties \ No newline at end of file +configuration-properties.classes=org.springframework.cloud.fn.supplier.mongo.MongodbSupplierProperties diff --git a/applications/source/pom.xml b/applications/source/pom.xml index 0cb00b77..0353d816 100644 --- a/applications/source/pom.xml +++ b/applications/source/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 diff --git a/applications/source/time-source/pom.xml b/applications/source/time-source/pom.xml index 1de53685..e148f4ea 100644 --- a/applications/source/time-source/pom.xml +++ b/applications/source/time-source/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 time-source @@ -42,7 +42,8 @@ time source ${project.version} - org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class + org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class + diff --git a/applications/source/time-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties b/applications/source/time-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties index a405e9c7..bdee747c 100644 --- a/applications/source/time-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties +++ b/applications/source/time-source/src/main/resources/META-INF/dataflow-configuration-metadata-whitelist.properties @@ -1,2 +1,2 @@ configuration-properties.classes=TimeProperties,\ - org.springframework.cloud.stream.config.DefaultPollerProperties \ No newline at end of file + org.springframework.cloud.stream.config.DefaultPollerProperties 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 87573cf7..8e39db8b 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 @@ -20,6 +20,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import org.junit.jupiter.api.Test; + import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -62,5 +63,6 @@ public class TimeSourceTests { @EnableAutoConfiguration @Import(TimeSupplierConfiguration.class) - public static class TimeSourceConfiguration {} + public static class TimeSourceConfiguration { + } } diff --git a/applications/apps-build/CODE_OF_CONDUCT.adoc b/applications/stream-applications-build/CODE_OF_CONDUCT.adoc similarity index 100% rename from applications/apps-build/CODE_OF_CONDUCT.adoc rename to applications/stream-applications-build/CODE_OF_CONDUCT.adoc diff --git a/applications/apps-build/LICENSE b/applications/stream-applications-build/LICENSE similarity index 100% rename from applications/apps-build/LICENSE rename to applications/stream-applications-build/LICENSE diff --git a/applications/apps-build/pom.xml b/applications/stream-applications-build/pom.xml similarity index 100% rename from applications/apps-build/pom.xml rename to applications/stream-applications-build/pom.xml diff --git a/applications/apps-build/release-tools/core-tag-next-version.sh b/applications/stream-applications-build/release-tools/core-tag-next-version.sh similarity index 100% rename from applications/apps-build/release-tools/core-tag-next-version.sh rename to applications/stream-applications-build/release-tools/core-tag-next-version.sh diff --git a/applications/apps-build/release-tools/core-version-check.sh b/applications/stream-applications-build/release-tools/core-version-check.sh similarity index 100% rename from applications/apps-build/release-tools/core-version-check.sh rename to applications/stream-applications-build/release-tools/core-version-check.sh diff --git a/applications/apps-build/release-tools/core-version-upgrade.sh b/applications/stream-applications-build/release-tools/core-version-upgrade.sh similarity index 100% rename from applications/apps-build/release-tools/core-version-upgrade.sh rename to applications/stream-applications-build/release-tools/core-version-upgrade.sh diff --git a/applications/apps-build/stream-apps-descriptor/pom.xml b/applications/stream-applications-build/stream-apps-descriptor/pom.xml similarity index 100% rename from applications/apps-build/stream-apps-descriptor/pom.xml rename to applications/stream-applications-build/stream-apps-descriptor/pom.xml diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-docker.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-docker.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-docker.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-docker.properties diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven-repo-url.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven-repo-url.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven-repo-url.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven-repo-url.properties diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/kafka-apps-maven.properties diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-docker.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-docker.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-docker.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-docker.properties diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven-repo-url.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven-repo-url.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven-repo-url.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven-repo-url.properties diff --git a/applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven.properties b/applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven.properties similarity index 100% rename from applications/apps-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven.properties rename to applications/stream-applications-build/stream-apps-descriptor/src/main/resources/META-INF/rabbit-apps-maven.properties diff --git a/applications/apps-build/stream-apps-docs/README.md b/applications/stream-applications-build/stream-apps-docs/README.md similarity index 100% rename from applications/apps-build/stream-apps-docs/README.md rename to applications/stream-applications-build/stream-apps-docs/README.md diff --git a/applications/apps-build/stream-apps-docs/pom.xml b/applications/stream-applications-build/stream-apps-docs/pom.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/pom.xml rename to applications/stream-applications-build/stream-apps-docs/pom.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/.gitignore b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/.gitignore similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/.gitignore rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/.gitignore diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/Guardfile b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/Guardfile similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/Guardfile rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/Guardfile diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/appendix.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/appendix.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/appendix.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/appendix.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/contributing.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/contributing.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/contributing.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/contributing.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/images/app-starter-naming-conventions.png b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/app-starter-naming-conventions.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/images/app-starter-naming-conventions.png rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/app-starter-naming-conventions.png diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/images/logo.png b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/logo.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/images/logo.png rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/logo.png diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/images/starters-pom-dependencies.png b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/starters-pom-dependencies.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/images/starters-pom-dependencies.png rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/images/starters-pom-dependencies.png diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/index-docinfo.xml b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/index-docinfo.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/index-docinfo.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/index-docinfo.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/index.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/index.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/index.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/index.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/overview.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/overview.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/overview.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/overview.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/pom-dependencies.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/pom-dependencies.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/pom-dependencies.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/pom-dependencies.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/processors.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/processors.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/processors.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/processors.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/sinks.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/sinks.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/sinks.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/sinks.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/asciidoc/sources.adoc b/applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/sources.adoc similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/asciidoc/sources.adoc rename to applications/stream-applications-build/stream-apps-docs/src/main/asciidoc/sources.adoc diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/css/highlight.css b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/highlight.css similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/css/highlight.css rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/highlight.css diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/css/manual-multipage.css b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual-multipage.css similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/css/manual-multipage.css rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual-multipage.css diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/css/manual-singlepage.css b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual-singlepage.css similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/css/manual-singlepage.css rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual-singlepage.css diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/css/manual.css b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual.css similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/css/manual.css rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/css/manual.css diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/background.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/background.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/background.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/background.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/1.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/1.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/1.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/1.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/10.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/10.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/10.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/10.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/11.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/11.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/11.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/11.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/12.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/12.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/12.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/12.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/13.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/13.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/13.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/13.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/14.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/14.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/14.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/14.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/15.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/15.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/15.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/15.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/2.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/2.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/2.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/2.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/3.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/3.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/3.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/3.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/4.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/4.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/4.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/4.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/5.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/5.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/5.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/5.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/6.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/6.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/6.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/6.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/7.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/7.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/7.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/7.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/8.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/8.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/8.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/8.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/9.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/9.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/callouts/9.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/callouts/9.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/caution.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/caution.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/caution.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/caution.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/cover.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/cover.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/cover.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/cover.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/important.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/important.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/important.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/important.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/logo.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/logo.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/logo.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/logo.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/logo.svg b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/logo.svg similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/logo.svg rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/logo.svg diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/note.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/note.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/note.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/note.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/tip.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/tip.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/tip.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/tip.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/images/warning.png b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/warning.png similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/images/warning.png rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/images/warning.png diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/common.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/common.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/common.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/common.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/epub.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/epub.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/epub.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/epub.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html-multipage.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html-multipage.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html-multipage.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html-multipage.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html-singlepage.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html-singlepage.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html-singlepage.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html-singlepage.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/html.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/html.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/pdf.xsl b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/pdf.xsl similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/pdf.xsl rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/pdf.xsl diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl-config.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl-config.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl-config.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl-config.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/asciidoc-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/asciidoc-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/asciidoc-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/asciidoc-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/bourne-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/bourne-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/bourne-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/bourne-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/c-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/c-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/c-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/c-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/cpp-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/cpp-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/cpp-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/cpp-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/csharp-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/csharp-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/csharp-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/csharp-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/css-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/css-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/css-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/css-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/html-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/html-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/html-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/html-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ini-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ini-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ini-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ini-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/java-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/java-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/java-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/java-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/javascript-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/javascript-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/javascript-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/javascript-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/json-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/json-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/json-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/json-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/perl-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/perl-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/perl-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/perl-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/php-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/php-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/php-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/php-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/properties-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/properties-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/properties-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/properties-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/python-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/python-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/python-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/python-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ruby-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ruby-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ruby-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/ruby-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/sql2003-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/sql2003-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/sql2003-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/sql2003-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/yaml-hl.xml b/applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/yaml-hl.xml similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/docbook/xsl/xslthl/yaml-hl.xml rename to applications/stream-applications-build/stream-apps-docs/src/main/docbook/xsl/xslthl/yaml-hl.xml diff --git a/applications/apps-build/stream-apps-docs/src/main/javadoc/spring-javadoc.css b/applications/stream-applications-build/stream-apps-docs/src/main/javadoc/spring-javadoc.css similarity index 100% rename from applications/apps-build/stream-apps-docs/src/main/javadoc/spring-javadoc.css rename to applications/stream-applications-build/stream-apps-docs/src/main/javadoc/spring-javadoc.css diff --git a/applications/stream-applications-core/.settings.xml b/applications/stream-applications-core/.settings.xml new file mode 100644 index 00000000..c77ffbe3 --- /dev/null +++ b/applications/stream-applications-core/.settings.xml @@ -0,0 +1,81 @@ + + + + + repo.spring.io + ${env.CI_DEPLOY_USERNAME} + ${env.CI_DEPLOY_PASSWORD} + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + gemstone-release + GemStone Maven Release Repository + http://dist.gemstone.com/maven/release + + true + always + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + + + diff --git a/applications/apps-core/CODE_OF_CONDUCT.adoc b/applications/stream-applications-core/CODE_OF_CONDUCT.adoc similarity index 100% rename from applications/apps-core/CODE_OF_CONDUCT.adoc rename to applications/stream-applications-core/CODE_OF_CONDUCT.adoc diff --git a/applications/apps-core/LICENSE b/applications/stream-applications-core/LICENSE similarity index 100% rename from applications/apps-core/LICENSE rename to applications/stream-applications-core/LICENSE diff --git a/applications/apps-core/README.adoc b/applications/stream-applications-core/README.adoc similarity index 100% rename from applications/apps-core/README.adoc rename to applications/stream-applications-core/README.adoc diff --git a/applications/stream-applications-core/common/pom.xml b/applications/stream-applications-core/common/pom.xml new file mode 100644 index 00000000..4a2a068c --- /dev/null +++ b/applications/stream-applications-core/common/pom.xml @@ -0,0 +1,25 @@ + + + + stream-apps-parent + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + + stream-apps-common + pom + stream-apps-common + + + stream-apps-ftp-common + stream-apps-test-support + stream-apps-postprocessor-common + stream-apps-micrometer-common + stream-apps-metadata-store-common + stream-apps-task-launch-request-common + stream-apps-security-common + + + diff --git a/applications/stream-applications-core/common/stream-apps-ftp-common/pom.xml b/applications/stream-applications-core/common/stream-apps-ftp-common/pom.xml new file mode 100644 index 00000000..5b9be4d0 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-ftp-common/pom.xml @@ -0,0 +1,27 @@ + + + + stream-apps-common + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + + stream-apps-ftp-common + stream-apps-ftp-common + + + + org.springframework.integration + spring-integration-ftp + true + + + org.springframework.cloud.stream.app + stream-apps-file-common + ${project.version} + + + + diff --git a/applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java b/applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java similarity index 97% rename from applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java rename to applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java index b28b9c2b..e79b9716 100644 --- a/applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryConfiguration.java @@ -1,5 +1,6 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-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 diff --git a/applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java b/applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java similarity index 91% rename from applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java rename to applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java index cf4ea143..acfbdcea 100644 --- a/applications/apps-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java +++ b/applications/stream-applications-core/common/stream-apps-ftp-common/src/main/java/org/springframework/cloud/stream/app/ftp/FtpSessionFactoryProperties.java @@ -1,5 +1,6 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-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 @@ -62,14 +63,20 @@ public class FtpSessionFactoryProperties extends AbstractRemoteServerProperties this.clientMode = clientMode; } - public static enum ClientMode { + public enum ClientMode { + /** + * Active mode. + */ ACTIVE(FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE), + /** + * Passive mode. + */ PASSIVE(FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE); private final int mode; - private ClientMode(int mode) { + ClientMode(int mode) { this.mode = mode; } diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/README.adoc b/applications/stream-applications-core/common/stream-apps-metadata-store-common/README.adoc similarity index 100% rename from applications/apps-core/common/stream-apps-metadata-store-common/README.adoc rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/README.adoc diff --git a/applications/stream-applications-core/common/stream-apps-metadata-store-common/pom.xml b/applications/stream-applications-core/common/stream-apps-metadata-store-common/pom.xml new file mode 100644 index 00000000..b14943db --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-metadata-store-common/pom.xml @@ -0,0 +1,152 @@ + + + 4.0.0 + + + stream-apps-common + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + + stream-apps-metadata-store-common + stream-apps-metadata-store-common + + + 1.11.439 + 2.0.0.RELEASE + 1.0.0.RELEASE + 4.0.1 + + + + + + org.springframework.integration + spring-integration-core + + + + + org.springframework.integration + spring-integration-redis + true + + + org.springframework.boot + spring-boot-starter-data-redis + true + + + + + org.springframework.integration + spring-integration-mongodb + true + + + org.springframework.boot + spring-boot-starter-data-mongodb + true + + + de.flapdoodle.embed + de.flapdoodle.embed.mongo + test + + + + + org.springframework.boot + spring-boot-starter-logging + true + + + org.apache.logging.log4j + log4j-to-slf4j + + + + + org.springframework.integration + spring-integration-gemfire + true + + + org.springframework.data + spring-data-gemfire + + + + + + org.springframework.data + spring-data-geode + true + + + + + + org.springframework.integration + spring-integration-jdbc + true + + + org.springframework.boot + spring-boot-starter-jdbc + true + + + org.hsqldb + hsqldb + test + + + + + org.springframework.integration + spring-integration-zookeeper + true + + + org.apache.curator + curator-test + ${curator.version} + test + + + + + org.springframework.integration + spring-integration-hazelcast + ${spring-integration-hazelcast.version} + true + + + + + org.springframework.integration + spring-integration-aws + ${spring-integration-aws.version} + true + + + com.amazonaws + aws-java-sdk-dynamodb + ${aws-java-sdk.version} + true + + + org.springframework.integration + spring-integration-test + test + + + + diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java similarity index 91% rename from applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java index 72831fc1..f3d7e510 100644 --- a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/ClientCacheAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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. @@ -28,14 +28,14 @@ import org.springframework.data.gemfire.config.annotation.EnablePdx; /** * TODO - * + *

* This is the copy of {@code org.springframework.boot.data.geode.autoconfigure.ClientCacheAutoConfiguration} * until {@code geode-spring-boot-starter} is released. * * @author John Blum */ @Configuration -@ConditionalOnClass({ ClientCacheFactoryBean.class, ClientCache.class }) +@ConditionalOnClass({ClientCacheFactoryBean.class, ClientCache.class}) @ConditionalOnMissingBean(GemFireCache.class) @ClientCacheApplication @EnablePdx diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java similarity index 89% rename from applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java index 8a29af6a..d6799aa5 100644 --- a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfiguration.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -15,6 +16,10 @@ package org.springframework.cloud.stream.app.metadata; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; +import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClientBuilder; +import com.hazelcast.core.HazelcastInstance; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.retry.RetryForever; @@ -45,14 +50,8 @@ import org.springframework.integration.redis.metadata.RedisMetadataStore; import org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore; import org.springframework.jdbc.core.JdbcTemplate; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; -import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClientBuilder; -import com.hazelcast.core.HazelcastInstance; - /** * @author Artem Bilan - * * @since 2.0.2 */ @Configuration @@ -60,6 +59,12 @@ import com.hazelcast.core.HazelcastInstance; @EnableConfigurationProperties(MetadataStoreProperties.class) public class MetadataStoreAutoConfiguration { + @Bean + @ConditionalOnMissingBean + public ConcurrentMetadataStore simpleMetadataStore() { + return new SimpleMetadataStore(); + } + @ConditionalOnClass(RedisMetadataStore.class) @ConditionalOnBean(RedisTemplate.class) static class Redis { @@ -67,7 +72,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore redisMetadataStore(RedisTemplate redisTemplate, - MetadataStoreProperties metadataStoreProperties) { + MetadataStoreProperties metadataStoreProperties) { return new RedisMetadataStore(redisTemplate, metadataStoreProperties.getRedis().getKey()); } @@ -81,7 +86,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore mongoDbMetadataStore(MongoTemplate mongoTemplate, - MetadataStoreProperties metadataStoreProperties) { + MetadataStoreProperties metadataStoreProperties) { return new MongoDbMetadataStore(mongoTemplate, metadataStoreProperties.getMongoDb().getCollection()); } @@ -95,7 +100,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ClientRegionFactoryBean gemfireRegion(GemFireCache cache, - MetadataStoreProperties metadataStoreProperties) { + MetadataStoreProperties metadataStoreProperties) { ClientRegionFactoryBean clientRegionFactoryBean = new ClientRegionFactoryBean<>(); clientRegionFactoryBean.setCache(cache); @@ -106,7 +111,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore gemfireMetadataStore(Region region, - ObjectProvider metadataStoreListenerObjectProvider) { + ObjectProvider metadataStoreListenerObjectProvider) { @SuppressWarnings("unchecked") GemfireMetadataStore gemfireMetadataStore = new GemfireMetadataStore((Region) region); @@ -129,7 +134,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore hazelcastMetadataStore(HazelcastInstance hazelcastInstance, - ObjectProvider metadataStoreListenerObjectProvider) { + ObjectProvider metadataStoreListenerObjectProvider) { HazelcastMetadataStore hazelcastMetadataStore = new HazelcastMetadataStore(hazelcastInstance); metadataStoreListenerObjectProvider.ifAvailable(hazelcastMetadataStore::addListener); @@ -138,7 +143,7 @@ public class MetadataStoreAutoConfiguration { } - @ConditionalOnClass({ ZookeeperMetadataStore.class, CuratorFramework.class }) + @ConditionalOnClass({ZookeeperMetadataStore.class, CuratorFramework.class}) static class Zookeeper { @Bean(initMethod = "start") @@ -152,8 +157,8 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore zookeeperMetadataStore(CuratorFramework curatorFramework, - MetadataStoreProperties metadataStoreProperties, - ObjectProvider metadataStoreListenerObjectProvider) { + MetadataStoreProperties metadataStoreProperties, + ObjectProvider metadataStoreListenerObjectProvider) { MetadataStoreProperties.Zookeeper zookeeperProperties = metadataStoreProperties.getZookeeper(); ZookeeperMetadataStore zookeeperMetadataStore = new ZookeeperMetadataStore(curatorFramework); @@ -166,13 +171,13 @@ public class MetadataStoreAutoConfiguration { } @ConditionalOnClass(DynamoDbMetadataStore.class) - @ConditionalOnBean({ AWSCredentialsProvider.class, RegionProvider.class }) + @ConditionalOnBean({AWSCredentialsProvider.class, RegionProvider.class}) static class DynamoDb { @Bean @ConditionalOnMissingBean public AmazonDynamoDBAsync dynamoDB(AWSCredentialsProvider awsCredentialsProvider, - RegionProvider regionProvider) { + RegionProvider regionProvider) { return AmazonDynamoDBAsyncClientBuilder.standard() .withCredentials(awsCredentialsProvider) @@ -185,7 +190,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore dynamoDbMetadataStore(AmazonDynamoDBAsync dynamoDB, - MetadataStoreProperties metadataStoreProperties) { + MetadataStoreProperties metadataStoreProperties) { MetadataStoreProperties.DynamoDb dynamoDbProperties = metadataStoreProperties.getDynamoDb(); @@ -212,7 +217,7 @@ public class MetadataStoreAutoConfiguration { @Bean @ConditionalOnMissingBean public ConcurrentMetadataStore jdbcMetadataStore(JdbcTemplate jdbcTemplate, - MetadataStoreProperties metadataStoreProperties) { + MetadataStoreProperties metadataStoreProperties) { MetadataStoreProperties.Jdbc jdbcProperties = metadataStoreProperties.getJdbc(); @@ -225,10 +230,4 @@ public class MetadataStoreAutoConfiguration { } - @Bean - @ConditionalOnMissingBean - public ConcurrentMetadataStore simpleMetadataStore() { - return new SimpleMetadataStore(); - } - } diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java similarity index 99% rename from applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java index 263ff4a4..a8cc3ce1 100644 --- a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java +++ b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/java/org/springframework/cloud/stream/app/metadata/MetadataStoreProperties.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -26,7 +27,6 @@ import org.springframework.integration.redis.metadata.RedisMetadataStore; /** * @author Artem Bilan - * * @since 2.0.2 */ @ConfigurationProperties("metadata.store") diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/src/main/resources/META-INF/spring.factories b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/resources/META-INF/spring.factories similarity index 100% rename from applications/apps-core/common/stream-apps-metadata-store-common/src/main/resources/META-INF/spring.factories rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/src/main/resources/META-INF/spring.factories diff --git a/applications/apps-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java similarity index 99% rename from applications/apps-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java rename to applications/stream-applications-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java index 4d888c0e..81faa0e5 100644 --- a/applications/apps-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java +++ b/applications/stream-applications-core/common/stream-apps-metadata-store-common/src/test/java/org/springframework/cloud/stream/app/metadata/MetadataStoreAutoConfigurationTests.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -15,17 +16,16 @@ package org.springframework.cloud.stream.app.metadata; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; - import java.beans.Introspector; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; +import com.amazonaws.services.dynamodbv2.model.DescribeTableRequest; +import com.amazonaws.services.dynamodbv2.model.DescribeTableResult; import org.apache.curator.test.TestingServer; import org.junit.Ignore; import org.junit.Test; @@ -50,14 +50,13 @@ import org.springframework.integration.mongodb.metadata.MongoDbMetadataStore; import org.springframework.integration.redis.metadata.RedisMetadataStore; import org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; -import com.amazonaws.services.dynamodbv2.model.DescribeTableRequest; -import com.amazonaws.services.dynamodbv2.model.DescribeTableResult; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; /** * @author Artem Bilan - * * @since 2.0.2 */ @RunWith(Parameterized.class) @@ -75,19 +74,9 @@ public class MetadataStoreAutoConfigurationTests { DynamoDbMetadataStore.class, SimpleMetadataStore.class ); - - private static FilteredClassLoader filteredClassLoaderBut(Class classToInclude) { - return new FilteredClassLoader( - METADATA_STORE_CLASSES.stream() - .filter(Predicate.isEqual(classToInclude).negate()) - .toArray(Class[]::new)); - } - private final ApplicationContextRunner contextRunner; - private final Class classToInclude; - public MetadataStoreAutoConfigurationTests(Class classToInclude) { this.classToInclude = classToInclude; this.contextRunner = @@ -96,6 +85,13 @@ public class MetadataStoreAutoConfigurationTests { .withClassLoader(filteredClassLoaderBut(classToInclude)); } + private static FilteredClassLoader filteredClassLoaderBut(Class classToInclude) { + return new FilteredClassLoader( + METADATA_STORE_CLASSES.stream() + .filter(Predicate.isEqual(classToInclude).negate()) + .toArray(Class[]::new)); + } + @Parameterized.Parameters public static Iterable parameters() { return METADATA_STORE_CLASSES; diff --git a/applications/apps-core/common/stream-apps-micrometer-common/pom.xml b/applications/stream-applications-core/common/stream-apps-micrometer-common/pom.xml similarity index 91% rename from applications/apps-core/common/stream-apps-micrometer-common/pom.xml rename to applications/stream-applications-core/common/stream-apps-micrometer-common/pom.xml index 99e9d9ea..c9c62cb2 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/pom.xml +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/pom.xml @@ -1,6 +1,6 @@ - stream-apps-common diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java similarity index 97% rename from applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java index f4c2eec8..fdf98d5e 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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.stream.app.micrometer.common; import io.micrometer.core.instrument.MeterRegistry; @@ -27,10 +28,10 @@ import org.springframework.context.annotation.Profile; /** * Micrometer common tags for Cloud Foundry deployment properties. Based on the CF application environment variables: * https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html - * + *

* Tags are set only if the "cloud" Spring profile is set. The "cloud" profile is activated automatically when an * application is deployed in CF: https://docs.cloudfoundry.org/buildpacks/java/configuring-service-connections/spring-service-bindings.html#cloud-profiles - * + *

* Use the spring.cloud.stream.app.metrics.cf.tags.enabled=false property to disable inserting those tags. * * @author Christian Tzolov diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java similarity index 97% rename from applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java index c2595fbe..ff01bcae 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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.stream.app.micrometer.common; import io.micrometer.core.instrument.MeterRegistry; @@ -28,7 +29,7 @@ import org.springframework.context.annotation.Configuration; * Auto configuration extends the micrometer metrics with additional tags such as: stream name, application name, * instance index and guids. Later are necessary to allow discrimination and aggregation of app metrics by external * metrics collection and visualizaiton tools. - * + *

* Use the spring.cloud.stream.app.metrics.common.tags.enabled=false property to disable inserting those tags. * * @author Christian Tzolov diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java similarity index 94% rename from applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java index 94c56743..8c1b5958 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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.stream.app.micrometer.common; import java.util.Properties; @@ -35,7 +36,7 @@ public class SpringCloudStreamMicrometerEnvironmentPostProcessor implements Envi private final static String METRICS_PROPERTY_NAME_TEMPLATE = "management.metrics.export.%s.enabled"; private final static String[] METRICS_REPOSITORY_NAMES = - new String[] { "datadog", "influx", "prometheus", "prometheus.rsocket" }; + new String[]{"datadog", "influx", "prometheus", "prometheus.rsocket"}; @Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/main/resources/META-INF/spring.factories b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/resources/META-INF/spring.factories similarity index 100% rename from applications/apps-core/common/stream-apps-micrometer-common/src/main/resources/META-INF/spring.factories rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/main/resources/META-INF/spring.factories diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java similarity index 93% rename from applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java index c15b1dd6..62f0f3c5 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/AbstractMicrometerTagTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-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.stream.app.micrometer.common; import java.io.IOException; @@ -41,7 +42,7 @@ import org.springframework.core.io.DefaultResourceLoader; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.StreamUtils; -import static org.junit.Assert.assertNotNull; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Christian Tzolov @@ -59,13 +60,6 @@ public class AbstractMicrometerTagTest { protected Meter meter; - @Before - public void before() { - assertNotNull(simpleMeterRegistry); - meter = simpleMeterRegistry.find("jvm.memory.committed").meter(); - assertNotNull("The jvm.memory.committed meter mast be present in SpringBoot apps!", meter); - } - @BeforeClass public static void setup() throws IOException { String serviceJson = StreamUtils.copyToString(new DefaultResourceLoader().getResource( @@ -74,6 +68,13 @@ public class AbstractMicrometerTagTest { CfEnvTestUtils.mockVcapServicesFromString(serviceJson); } + @Before + public void before() { + assertThat(simpleMeterRegistry).isNotNull(); + meter = simpleMeterRegistry.find("jvm.memory.committed").meter(); + assertThat(meter).isNotNull(); + } + @SpringBootApplication @EnableConfigurationProperties(SimpleProperties.class) public static class AutoConfigurationApplication { diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java similarity index 53% rename from applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java index f5b610e0..4fdd2b95 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/CloudFoundryMicrometerCommonTagsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.stream.app.micrometer.common; -import org.hamcrest.Matchers; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; @@ -24,8 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Christian Tzolov @@ -37,13 +35,13 @@ public class CloudFoundryMicrometerCommonTagsTest { public static class ActiveCloudProfileDefaultValues extends AbstractMicrometerTagTest { @Test public void testDefaultTagValues() { - assertThat(meter.getId().getTag("cf.org.name"), is("default")); - assertThat(meter.getId().getTag("cf.space.id"), is("unknown")); - assertThat(meter.getId().getTag("cf.space.name"), is("unknown")); - assertThat(meter.getId().getTag("cf.app.name"), is("unknown")); - assertThat(meter.getId().getTag("cf.app.id"), is("unknown")); - assertThat(meter.getId().getTag("cf.app.version"), is("unknown")); - assertThat(meter.getId().getTag("cf.instance.index"), is("0")); + assertThat(meter.getId().getTag("cf.org.name")).isEqualTo("default"); + assertThat(meter.getId().getTag("cf.space.id")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("cf.space.name")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("cf.app.name")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("cf.app.id")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("cf.app.version")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("cf.instance.index")).isEqualTo("0"); } } @@ -54,19 +52,19 @@ public class CloudFoundryMicrometerCommonTagsTest { "vcap.application.application_name=App666", "vcap.application.application_id=666guid", "vcap.application.application_version=2.0", - "vcap.application.instance_index=123" }) + "vcap.application.instance_index=123"}) @ActiveProfiles("cloud") public static class ActiveCloudProfile extends AbstractMicrometerTagTest { @Test public void testPresetTagValues() { - assertThat(meter.getId().getTag("cf.org.name"), is("PivotalOrg")); - assertThat(meter.getId().getTag("cf.space.id"), is("SpringSpaceId")); - assertThat(meter.getId().getTag("cf.space.name"), is("SpringSpace")); - assertThat(meter.getId().getTag("cf.app.name"), is("App666")); - assertThat(meter.getId().getTag("cf.app.id"), is("666guid")); - assertThat(meter.getId().getTag("cf.app.version"), is("2.0")); - assertThat(meter.getId().getTag("cf.instance.index"), is("123")); + assertThat(meter.getId().getTag("cf.org.name")).isEqualTo("PivotalOrg"); + assertThat(meter.getId().getTag("cf.space.id")).isEqualTo("SpringSpaceId"); + assertThat(meter.getId().getTag("cf.space.name")).isEqualTo("SpringSpace"); + assertThat(meter.getId().getTag("cf.app.name")).isEqualTo("App666"); + assertThat(meter.getId().getTag("cf.app.id")).isEqualTo("666guid"); + assertThat(meter.getId().getTag("cf.app.version")).isEqualTo("2.0"); + assertThat(meter.getId().getTag("cf.instance.index")).isEqualTo("123"); } } @@ -77,22 +75,22 @@ public class CloudFoundryMicrometerCommonTagsTest { "vcap.application.application_name=App666", "vcap.application.application_id=666guid", "vcap.application.application_version=2.0", - "vcap.application.instance_index=123" }) + "vcap.application.instance_index=123"}) public static class InactiveCloudProfile extends AbstractMicrometerTagTest { @Test public void testDisabledTagValues() { - assertThat(meter.getId().getTag("cf.org.name"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.space.id"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.space.name"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.app.name"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.app.id"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.app.version"), is(Matchers.nullValue())); - assertThat(meter.getId().getTag("cf.instance.index"), is(Matchers.nullValue())); + assertThat(meter.getId().getTag("cf.org.name")).isNull(); + assertThat(meter.getId().getTag("cf.space.id")).isNull(); + assertThat(meter.getId().getTag("cf.space.name")).isNull(); + assertThat(meter.getId().getTag("cf.app.name")).isNull(); + assertThat(meter.getId().getTag("cf.app.id")).isNull(); + assertThat(meter.getId().getTag("cf.app.version")).isNull(); + assertThat(meter.getId().getTag("cf.instance.index")).isNull(); } } - @TestPropertySource(properties = { "spring.cloud.stream.app.metrics.cf.tags.enabled=false" }) + @TestPropertySource(properties = {"spring.cloud.stream.app.metrics.cf.tags.enabled=false"}) @ActiveProfiles("cloud") public static class ActiveCloudProfileDisabledProperty extends InactiveCloudProfile { } diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java similarity index 79% rename from applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java index c9d06a51..8c30940c 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/InfluxReservedKeywordHandlingTest.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. @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.stream.app.micrometer.common; import io.micrometer.core.instrument.Meter; import io.micrometer.influx.InfluxMeterRegistry; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,9 +27,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Christian Tzolov @@ -38,7 +36,7 @@ import static org.junit.Assert.assertThat; @SpringBootTest(classes = InfluxReservedKeywordHandlingTest.AutoConfigurationApplication.class, properties = { "management.metrics.export.influx.enabled=true", - "spring.cloud.dataflow.stream.app.label=time" }) + "spring.cloud.dataflow.stream.app.label=time"}) public class InfluxReservedKeywordHandlingTest { @Autowired @@ -46,11 +44,13 @@ public class InfluxReservedKeywordHandlingTest { @Test public void testPresetTagValues() { - assertNotNull(influxMeterRegistry); - Meter meter = influxMeterRegistry.find("jvm.memory.committed").meter(); - assertNotNull("The jvm.memory.committed meter mast be present in SpringBoot apps!", meter); - assertThat(meter.getId().getTag("application.name"), is("atime")); + assertThat(influxMeterRegistry).isNotNull(); + + Meter meter = influxMeterRegistry.find("jvm.memory.committed").meter(); + assertThat(meter).isNotNull(); + + assertThat(meter.getId().getTag("application.name")).isEqualTo(("atime")); } @SpringBootApplication diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java similarity index 52% rename from applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java index 5fef6c98..4fddb6e0 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerCommonTagsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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,18 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.stream.app.micrometer.common; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; import org.springframework.test.context.TestPropertySource; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Christian Tzolov @@ -36,11 +34,11 @@ public class SpringCloudStreamMicrometerCommonTagsTest { @Test public void testDefaultTagValues() { - assertThat(meter.getId().getTag("stream.name"), is("unknown")); - assertThat(meter.getId().getTag("application.name"), is("unknown")); - assertThat(meter.getId().getTag("instance.index"), is("0")); - assertThat(meter.getId().getTag("application.type"), is("unknown")); - assertThat(meter.getId().getTag("application.guid"), is("unknown")); + assertThat(meter.getId().getTag("stream.name")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("application.name")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("instance.index")).isEqualTo("0"); + assertThat(meter.getId().getTag("application.type")).isEqualTo("unknown"); + assertThat(meter.getId().getTag("application.guid")).isEqualTo("unknown"); } } @@ -49,29 +47,29 @@ public class SpringCloudStreamMicrometerCommonTagsTest { "spring.cloud.dataflow.stream.app.label=myApp", "spring.cloud.stream.instanceIndex=666", "spring.cloud.application.guid=666guid", - "spring.cloud.dataflow.stream.app.type=source" }) + "spring.cloud.dataflow.stream.app.type=source"}) public static class TestPresetTagValues extends AbstractMicrometerTagTest { @Test public void testPresetTagValues() { - assertThat(meter.getId().getTag("stream.name"), is("myStream")); - assertThat(meter.getId().getTag("application.name"), is("myApp")); - assertThat(meter.getId().getTag("instance.index"), is("666")); - assertThat(meter.getId().getTag("application.type"), is("source")); - assertThat(meter.getId().getTag("application.guid"), is("666guid")); + assertThat(meter.getId().getTag("stream.name")).isEqualTo("myStream"); + assertThat(meter.getId().getTag("application.name")).isEqualTo("myApp"); + assertThat(meter.getId().getTag("instance.index")).isEqualTo("666"); + assertThat(meter.getId().getTag("application.type")).isEqualTo("source"); + assertThat(meter.getId().getTag("application.guid")).isEqualTo("666guid"); } } - @TestPropertySource(properties = { "spring.cloud.stream.app.metrics.common.tags.enabled=false" }) + @TestPropertySource(properties = {"spring.cloud.stream.app.metrics.common.tags.enabled=false"}) public static class TestDisabledTagValues extends AbstractMicrometerTagTest { @Test public void testDefaultTagValues() { - assertThat(meter.getId().getTag("stream.name"), is(nullValue())); - assertThat(meter.getId().getTag("application.name"), is(nullValue())); - assertThat(meter.getId().getTag("instance.index"), is(nullValue())); - assertThat(meter.getId().getTag("application.type"), is(nullValue())); - assertThat(meter.getId().getTag("application.guid"), is(nullValue())); + assertThat(meter.getId().getTag("stream.name")).isNull(); + assertThat(meter.getId().getTag("application.name")).isNull(); + assertThat(meter.getId().getTag("instance.index")).isNull(); + assertThat(meter.getId().getTag("application.type")).isNull(); + assertThat(meter.getId().getTag("application.guid")).isNull(); } } } diff --git a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java similarity index 63% rename from applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java rename to applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java index da340292..26c4311a 100644 --- a/applications/apps-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/java/org/springframework/cloud/stream/app/micrometer/common/SpringCloudStreamMicrometerEnvironmentPostProcessorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.stream.app.micrometer.common; -import org.hamcrest.core.Is; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; @@ -24,9 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.core.env.PropertySource; import org.springframework.test.context.TestPropertySource; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Christian Tzolov @@ -38,28 +35,23 @@ public class SpringCloudStreamMicrometerEnvironmentPostProcessorTest { @Test public void testDefaultProperties() { - assertNotNull(context); + + assertThat(context).isNotNull(); PropertySource propertySource = context.getEnvironment().getPropertySources() .get(SpringCloudStreamMicrometerEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNotNull("Property source " - + SpringCloudStreamMicrometerEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is null", - propertySource); - - assertThat(propertySource.getProperty("management.metrics.export.influx.enabled"), Is.is("false")); - assertThat(propertySource.getProperty("management.metrics.export.prometheus.enabled"), Is.is("false")); - assertThat(propertySource.getProperty("management.metrics.export.prometheus.rsocket.enabled"), Is.is("false")); - assertThat(propertySource.getProperty("management.metrics.export.datadog.enabled"), Is.is("false")); - - assertThat(propertySource.getProperty("management.endpoints.web.exposure.include"), Is.is("prometheus")); - - assertThat(context.getEnvironment().getProperty("management.metrics.export.influx.enabled"), Is.is("false")); - assertThat(context.getEnvironment().getProperty("management.metrics.export.prometheus.enabled"), Is.is("false")); - assertThat(context.getEnvironment().getProperty("management.metrics.export.datadog.enabled"), Is.is("false")); - - assertThat(context.getEnvironment().getProperty("management.endpoints.web.exposure.include"), Is.is("prometheus")); + assertThat(propertySource).isNotNull(); + assertThat(propertySource.getProperty("management.metrics.export.influx.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.metrics.export.prometheus.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.metrics.export.prometheus.rsocket.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.metrics.export.datadog.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.endpoints.web.exposure.include")).isEqualTo("prometheus"); + assertThat(propertySource.getProperty("management.metrics.export.influx.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.metrics.export.prometheus.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.metrics.export.datadog.enabled")).isEqualTo("false"); + assertThat(propertySource.getProperty("management.endpoints.web.exposure.include")).isEqualTo("prometheus"); } } @@ -74,21 +66,19 @@ public class SpringCloudStreamMicrometerEnvironmentPostProcessorTest { @Test public void testOverrideProperties() { - assertNotNull(context); + assertThat(context).isNotNull(); PropertySource propertySource = context.getEnvironment().getPropertySources() .get(SpringCloudStreamMicrometerEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNull("Property source " - + SpringCloudStreamMicrometerEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is not null", - propertySource); + assertThat(propertySource).isNull(); - assertThat(context.getEnvironment().getProperty("management.metrics.export.influx.enabled"), Is.is("true")); - assertThat(context.getEnvironment().getProperty("management.metrics.export.prometheus.enabled"), Is.is("true")); - assertThat(context.getEnvironment().getProperty("management.metrics.export.prometheus.rsocket.enabled"), Is.is("true")); - assertThat(context.getEnvironment().getProperty("management.metrics.export.datadog.enabled"), Is.is("true")); + assertThat(context.getEnvironment().getProperty("management.metrics.export.influx.enabled")).isEqualTo("true"); + assertThat(context.getEnvironment().getProperty("management.metrics.export.prometheus.enabled")).isEqualTo("true"); + assertThat(context.getEnvironment().getProperty("management.metrics.export.prometheus.rsocket.enabled")).isEqualTo("true"); + assertThat(context.getEnvironment().getProperty("management.metrics.export.datadog.enabled")).isEqualTo("true"); - assertThat(context.getEnvironment().getProperty("management.endpoints.web.exposure.include"), Is.is("info,health")); + assertThat(context.getEnvironment().getProperty("management.endpoints.web.exposure.include")).isEqualTo("info,health"); } } } diff --git a/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json new file mode 100644 index 00000000..d96e779d --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-micrometer-common/src/test/resources/org/springframework/cloud/stream/app/micrometer/common/pcf-scs-info.json @@ -0,0 +1,18 @@ +{ + "sso": [ + { + "name": "sso", + "label": "sso", + "plan": "notfree", + "tags": [ + "configuration" + ], + "credentials": { + "uri": "https://pivotal.io", + "client_id": "fakeClientId", + "client_secret": "fakeSecret", + "access_token_uri": "token" + } + } + ] +} diff --git a/applications/apps-core/common/stream-apps-postprocessor-common/pom.xml b/applications/stream-applications-core/common/stream-apps-postprocessor-common/pom.xml similarity index 87% rename from applications/apps-core/common/stream-apps-postprocessor-common/pom.xml rename to applications/stream-applications-core/common/stream-apps-postprocessor-common/pom.xml index 8107c8b5..4ebcbe59 100644 --- a/applications/apps-core/common/stream-apps-postprocessor-common/pom.xml +++ b/applications/stream-applications-core/common/stream-apps-postprocessor-common/pom.xml @@ -1,5 +1,5 @@ - stream-apps-common diff --git a/applications/apps-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java b/applications/stream-applications-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java similarity index 98% rename from applications/apps-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java rename to applications/stream-applications-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java index 470f6277..3d67061d 100644 --- a/applications/apps-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java +++ b/applications/stream-applications-core/common/stream-apps-postprocessor-common/src/main/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessor.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -15,6 +16,10 @@ package org.springframework.cloud.stream.app.postprocessor; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + import org.springframework.boot.SpringApplication; import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.cloud.stream.messaging.Sink; @@ -22,33 +27,19 @@ import org.springframework.cloud.stream.messaging.Source; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.PropertiesPropertySource; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - /** * An {@link EnvironmentPostProcessor} to set the {@code spring.cloud.stream.bindings.{input,output}.contentType} * channel properties to a default of {@code application/octet-stream} if it has not been set already. - * + *

* Subclasses may extend this class to change the default content type and channel name(s). * * @author Chris Schaefer */ public class ContentTypeEnvironmentPostProcessor implements EnvironmentPostProcessor { - private Map channelMap = createChannelMap(); - - private Map createChannelMap() { - Map channelMap = new HashMap<>(); - channelMap.put(Sink.INPUT, "application/octet-stream"); - channelMap.put(Source.OUTPUT, "application/octet-stream"); - - return channelMap; - } - protected static final String PROPERTY_SOURCE_KEY_NAME = ContentTypeEnvironmentPostProcessor.class.getName(); protected static final String CONTENT_TYPE_PROPERTY_PREFIX = "spring.cloud.stream.bindings."; protected static final String CONTENT_TYPE_PROPERTY_SUFFIX = ".contentType"; - + private Map channelMap = createChannelMap(); public ContentTypeEnvironmentPostProcessor() { super(); } @@ -67,6 +58,14 @@ public class ContentTypeEnvironmentPostProcessor implements EnvironmentPostProce channelMap.put(channelName, contentType); } + private Map createChannelMap() { + Map channelMap = new HashMap<>(); + channelMap.put(Sink.INPUT, "application/octet-stream"); + channelMap.put(Source.OUTPUT, "application/octet-stream"); + + return channelMap; + } + @Override public void postProcessEnvironment(ConfigurableEnvironment configurableEnvironment, SpringApplication springApplication) { Properties properties = new Properties(); diff --git a/applications/apps-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java b/applications/stream-applications-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java similarity index 66% rename from applications/apps-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java rename to applications/stream-applications-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java index bde024cf..64b7319a 100644 --- a/applications/apps-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java +++ b/applications/stream-applications-core/common/stream-apps-postprocessor-common/src/test/java/org/springframework/cloud/stream/app/postprocessor/ContentTypeEnvironmentPostProcessorTests.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -15,7 +16,12 @@ package org.springframework.cloud.stream.app.postprocessor; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + import org.junit.Test; + import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -27,12 +33,7 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.PropertiesPropertySource; import org.springframework.core.env.PropertySource; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; /** * Test cases for {@ContentTypeEnvironmentPostProcessor}. @@ -40,6 +41,11 @@ import static org.junit.Assert.assertTrue; * @author Chris Schaefer */ public class ContentTypeEnvironmentPostProcessorTests { + private static String getContentTypeProperty(String channelName) { + return ContentTypeEnvironmentPostProcessor.CONTENT_TYPE_PROPERTY_PREFIX + channelName + + ContentTypeEnvironmentPostProcessor.CONTENT_TYPE_PROPERTY_SUFFIX; + } + @Test public void testPostProcessorDefaults() { ConfigurableEnvironment configurableEnvironment = getEnvironment(); @@ -47,26 +53,17 @@ public class ContentTypeEnvironmentPostProcessorTests { PropertySource propertySource = configurableEnvironment.getPropertySources() .get(ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNotNull("Property source " + ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is null", - propertySource); - - assertTrue("Unexpected input content type", propertySource.getProperty(getContentTypeProperty(Sink.INPUT)) - .equals("application/octet-stream")); - - assertTrue("Unexpected output content type", propertySource.getProperty(getContentTypeProperty(Source.OUTPUT)) - .equals("application/octet-stream")); + assertThat(propertySource).isNotNull(); + assertThat(propertySource.getProperty(getContentTypeProperty(Sink.INPUT))).isEqualTo("application/octet-stream"); + assertThat(propertySource.getProperty(getContentTypeProperty(Source.OUTPUT))).isEqualTo("application/octet-stream"); } @Test public void testUserDefinedOutputContentType() { PropertiesPropertySource testProperties = buildTestProperties(Source.OUTPUT, "text/plain"); ConfigurableEnvironment configurableEnvironment = getEnvironment(testProperties); - - assertTrue("Output contentType property key not found", - configurableEnvironment.containsProperty(getContentTypeProperty(Source.OUTPUT))); - - assertTrue("Unexpected output content type", configurableEnvironment.getProperty(getContentTypeProperty(Source.OUTPUT)) - .equals("text/plain")); + assertThat(configurableEnvironment.containsProperty(getContentTypeProperty(Source.OUTPUT))).isTrue(); + assertThat(configurableEnvironment.getProperty(getContentTypeProperty(Source.OUTPUT))).isEqualTo("text/plain"); } @Test @@ -74,11 +71,8 @@ public class ContentTypeEnvironmentPostProcessorTests { PropertiesPropertySource testProperties = buildTestProperties(Sink.INPUT, "text/html"); ConfigurableEnvironment configurableEnvironment = getEnvironment(testProperties); - assertTrue("Input contentType property key not found", - configurableEnvironment.containsProperty(getContentTypeProperty(Sink.INPUT))); - - assertTrue("Unexpected input content type", configurableEnvironment.getProperty(getContentTypeProperty(Sink.INPUT)) - .equals("text/html")); + assertThat(configurableEnvironment.containsProperty(getContentTypeProperty(Sink.INPUT))).isTrue(); + assertThat(configurableEnvironment.getProperty(getContentTypeProperty(Sink.INPUT))).isEqualTo("text/html"); } @Test @@ -88,23 +82,9 @@ public class ContentTypeEnvironmentPostProcessorTests { PropertySource propertySource = configurableEnvironment.getPropertySources() .get(ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNotNull("Property source " + ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is null", - propertySource); - - assertTrue("myChannelName contentType property key not found", - propertySource.containsProperty(getContentTypeProperty("myChannelName"))); - - assertTrue("Unexpected myChannelName content type", propertySource.getProperty(getContentTypeProperty("myChannelName")) - .equals("application/octet-stream")); - } - - public static class CustomChannel extends ContentTypeEnvironmentPostProcessor { - private static final String CHANNEL_NAME = "myChannelName"; - private static final String CONTENT_TYPE = "application/octet-stream"; - - public CustomChannel() { - super(CHANNEL_NAME, CONTENT_TYPE); - } + assertThat(propertySource).isNotNull(); + assertThat(propertySource.containsProperty(getContentTypeProperty("myChannelName"))).isTrue(); + assertThat(propertySource.getProperty(getContentTypeProperty("myChannelName"))).isEqualTo("application/octet-stream"); } @Test @@ -114,20 +94,11 @@ public class ContentTypeEnvironmentPostProcessorTests { PropertySource propertySource = configurableEnvironment.getPropertySources() .get(ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNotNull("Property source " + ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is null", - propertySource); - - assertTrue("Output contentType property key not found", - propertySource.containsProperty(getContentTypeProperty(Source.OUTPUT))); - - assertTrue("Unexpected output content type", propertySource.getProperty(getContentTypeProperty(Source.OUTPUT)) - .equals("image/jpeg")); - - assertTrue("Input contentType property key not found", - propertySource.containsProperty(getContentTypeProperty(Sink.INPUT))); - - assertTrue("Unexpected input content type", propertySource.getProperty(getContentTypeProperty(Sink.INPUT)) - .equals("image/gif")); + assertThat(propertySource).isNotNull(); + assertThat(propertySource.containsProperty(getContentTypeProperty(Source.OUTPUT))).isTrue(); + assertThat(propertySource.getProperty(getContentTypeProperty(Source.OUTPUT))).isEqualTo("image/jpeg"); + assertThat(propertySource.containsProperty(getContentTypeProperty(Sink.INPUT))).isTrue(); + assertThat(propertySource.getProperty(getContentTypeProperty(Sink.INPUT))).isEqualTo("image/gif"); } @Test @@ -137,49 +108,12 @@ public class ContentTypeEnvironmentPostProcessorTests { PropertySource propertySource = configurableEnvironment.getPropertySources() .get(ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME); - assertNotNull("Property source " + ContentTypeEnvironmentPostProcessor.PROPERTY_SOURCE_KEY_NAME + " is null", - propertySource); - assertTrue("Output contentType property key not found", - propertySource.containsProperty(getContentTypeProperty(Source.OUTPUT))); - - assertTrue("Unexpected output content type", propertySource.getProperty(getContentTypeProperty(Source.OUTPUT)) - .equals("image/jpeg")); - - assertTrue("Input contentType property key not found", - propertySource.containsProperty(getContentTypeProperty(Sink.INPUT))); - - assertTrue("Unexpected input content type", propertySource.getProperty(getContentTypeProperty(Sink.INPUT)) - .equals("image/jpeg")); - } - - public static class ChannelSameContentType extends ContentTypeEnvironmentPostProcessor { - private static final String CONTENT_TYPE = "image/jpeg"; - - public ChannelSameContentType() { - super(CONTENT_TYPE); - } - } - - public static class DefaultChannelsCustomContentTypes extends ContentTypeEnvironmentPostProcessor { - private static Map CHANNEL_MAP = createChannelMap(); - - private static Map createChannelMap() { - Map channelMap = new HashMap<>(); - channelMap.put(Source.OUTPUT, "image/jpeg"); - channelMap.put(Sink.INPUT, "image/gif"); - - return channelMap; - } - - public DefaultChannelsCustomContentTypes() { - super(CHANNEL_MAP); - } - } - - private static String getContentTypeProperty(String channelName) { - return ContentTypeEnvironmentPostProcessor.CONTENT_TYPE_PROPERTY_PREFIX + channelName - + ContentTypeEnvironmentPostProcessor.CONTENT_TYPE_PROPERTY_SUFFIX; + assertThat(propertySource).isNotNull(); + assertThat(propertySource.containsProperty(getContentTypeProperty(Source.OUTPUT))).isTrue(); + assertThat(propertySource.getProperty(getContentTypeProperty(Source.OUTPUT))).isEqualTo("image/jpeg"); + assertThat(propertySource.containsProperty(getContentTypeProperty(Sink.INPUT))).isTrue(); + assertThat(propertySource.getProperty(getContentTypeProperty(Sink.INPUT))).isEqualTo("image/jpeg"); } private PropertiesPropertySource buildTestProperties(String channelName, String contentType) { @@ -202,7 +136,7 @@ public class ContentTypeEnvironmentPostProcessorTests { } private ConfigurableEnvironment getEnvironment(PropertiesPropertySource propertiesPropertySource, - EnvironmentPostProcessor environmentPostProcessor) { + EnvironmentPostProcessor environmentPostProcessor) { SpringApplication springApplication = new SpringApplicationBuilder() .sources(ContentTypeEnvironmentPostProcessorTests.class) .web(WebApplicationType.NONE).build(); @@ -224,4 +158,37 @@ public class ContentTypeEnvironmentPostProcessorTests { return configurableEnvironment; } + + public static class CustomChannel extends ContentTypeEnvironmentPostProcessor { + private static final String CHANNEL_NAME = "myChannelName"; + private static final String CONTENT_TYPE = "application/octet-stream"; + + public CustomChannel() { + super(CHANNEL_NAME, CONTENT_TYPE); + } + } + + public static class ChannelSameContentType extends ContentTypeEnvironmentPostProcessor { + private static final String CONTENT_TYPE = "image/jpeg"; + + public ChannelSameContentType() { + super(CONTENT_TYPE); + } + } + + public static class DefaultChannelsCustomContentTypes extends ContentTypeEnvironmentPostProcessor { + private static Map CHANNEL_MAP = createChannelMap(); + + public DefaultChannelsCustomContentTypes() { + super(CHANNEL_MAP); + } + + private static Map createChannelMap() { + Map channelMap = new HashMap<>(); + channelMap.put(Source.OUTPUT, "image/jpeg"); + channelMap.put(Sink.INPUT, "image/gif"); + + return channelMap; + } + } } diff --git a/applications/apps-core/common/stream-apps-security-common/README.adoc b/applications/stream-applications-core/common/stream-apps-security-common/README.adoc similarity index 100% rename from applications/apps-core/common/stream-apps-security-common/README.adoc rename to applications/stream-applications-core/common/stream-apps-security-common/README.adoc diff --git a/applications/stream-applications-core/common/stream-apps-security-common/pom.xml b/applications/stream-applications-core/common/stream-apps-security-common/pom.xml new file mode 100644 index 00000000..75e41ea0 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-security-common/pom.xml @@ -0,0 +1,52 @@ + + + + stream-apps-common + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + + stream-apps-security-common + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-autoconfigure-processor + true + + + javax.servlet + javax.servlet-api + provided + + + org.springframework.boot + spring-boot-starter-actuator + true + + + org.springframework.boot + spring-boot-starter-webflux + true + + + org.springframework.boot + spring-boot-starter-web + true + test + + + org.springframework.boot + spring-boot-starter-security + + + + diff --git a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java similarity index 86% rename from applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java index 7d160091..31474a71 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebFluxSecurityAutoConfiguration.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. @@ -16,6 +16,8 @@ package org.springframework.cloud.stream.app.security.common; +import reactor.core.publisher.Flux; + import org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -32,26 +34,23 @@ import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.WebFilterChainProxy; import org.springframework.web.reactive.config.WebFluxConfigurer; -import reactor.core.publisher.Flux; - /** * @author Artem Bilan - * * @since 3.0 */ @Conditional(OnHttpCsrfOrSecurityDisabled.class) @Configuration -@ConditionalOnClass({ Flux.class, EnableWebFluxSecurity.class, WebFilterChainProxy.class, WebFluxConfigurer.class }) +@ConditionalOnClass({Flux.class, EnableWebFluxSecurity.class, WebFilterChainProxy.class, WebFluxConfigurer.class}) @ConditionalOnMissingBean(WebFilterChainProxy.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) -@AutoConfigureBefore(value = { ReactiveManagementWebSecurityAutoConfiguration.class, - ReactiveSecurityAutoConfiguration.class }) +@AutoConfigureBefore({ReactiveManagementWebSecurityAutoConfiguration.class, + ReactiveSecurityAutoConfiguration.class}) @EnableConfigurationProperties(AppStarterWebSecurityAutoConfigurationProperties.class) public class AppStarterWebFluxSecurityAutoConfiguration { @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http, - AppStarterWebSecurityAutoConfigurationProperties securityProperties) { + AppStarterWebSecurityAutoConfigurationProperties securityProperties) { if (!securityProperties.isCsrfEnabled()) { http.csrf().disable(); } diff --git a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java similarity index 96% rename from applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java index 8e451ceb..300d53af 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfiguration.java @@ -34,7 +34,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur /** * @author Christian Tzolov * @author Artem Bilan - * * @since 2.1 */ @Conditional(OnHttpCsrfOrSecurityDisabled.class) @@ -42,7 +41,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @ConditionalOnClass(WebSecurityConfigurerAdapter.class) @ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) -@AutoConfigureBefore(value = { ManagementWebSecurityAutoConfiguration.class, SecurityAutoConfiguration.class }) +@AutoConfigureBefore({ManagementWebSecurityAutoConfiguration.class, SecurityAutoConfiguration.class}) @EnableConfigurationProperties(AppStarterWebSecurityAutoConfigurationProperties.class) @EnableWebSecurity public class AppStarterWebSecurityAutoConfiguration { diff --git a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java similarity index 96% rename from applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java index 7ed36d7a..4bbbbedf 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/AppStarterWebSecurityAutoConfigurationProperties.java @@ -1,5 +1,6 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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 @@ -22,7 +23,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * * @author Christian Tzolov * @author Artem Bilan - * * @since 2.1 */ @ConfigurationProperties("spring.cloud.streamapp.security") diff --git a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java similarity index 96% rename from applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java index 70e0ff22..bcca41a1 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/main/java/org/springframework/cloud/stream/app/security/common/OnHttpCsrfOrSecurityDisabled.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. @@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; * overriding out-of-the-box one in Spring Boot. * * @author Artem Bilan - * * @since 3.0 */ class OnHttpCsrfOrSecurityDisabled extends AnyNestedCondition { diff --git a/applications/apps-core/common/stream-apps-security-common/src/main/resources/META-INF/spring.factories b/applications/stream-applications-core/common/stream-apps-security-common/src/main/resources/META-INF/spring.factories similarity index 100% rename from applications/apps-core/common/stream-apps-security-common/src/main/resources/META-INF/spring.factories rename to applications/stream-applications-core/common/stream-apps-security-common/src/main/resources/META-INF/spring.factories diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/AbstractSecurityCommonTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/AbstractSecurityCommonTests.java similarity index 100% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/AbstractSecurityCommonTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/AbstractSecurityCommonTests.java diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java similarity index 75% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java index 9474e504..be25cbff 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityDisabledManagementSecurityEnabledTests.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. @@ -16,9 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; import org.junit.jupiter.api.Test; @@ -27,44 +24,46 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + /** * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { "spring.main.web-application-type=reactive", "spring.cloud.streamapp.security.enabled=false", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class ReactiveSecurityDisabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java similarity index 81% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java index a899752a..a2bdd572 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.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. @@ -16,9 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -31,9 +28,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.support.BasicAuthenticationInterceptor; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov - * * @since 3.0 */ @TestPropertySource(properties = { @@ -41,7 +39,7 @@ import org.springframework.test.context.TestPropertySource; "org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration" + ",org.springframework.cloud.stream.app.security.common.AppStarterWebFluxSecurityAutoConfiguration", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTests extends AbstractSecurityCommonTests { @Autowired @@ -57,28 +55,29 @@ public class ReactiveSecurityEnabledManagementSecurityDisabledAuthorizedAccessTe @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java similarity index 82% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java index df88435b..92ddd90e 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.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. @@ -16,8 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; - import java.util.Map; import org.junit.jupiter.api.Test; @@ -26,10 +24,11 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { @@ -37,28 +36,28 @@ import org.springframework.test.context.TestPropertySource; "spring.autoconfigure.exclude=" + "org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration" + ",org.springframework.cloud.stream.app.security.common.AppStarterWebFluxSecurityAutoConfiguration", - "management.endpoints.web.exposure.include=health,info" }) + "management.endpoints.web.exposure.include=health,info"}) public class ReactiveSecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java similarity index 77% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java index 256281a1..8a6694b0 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/ReactiveSecurityEnabledManagementSecurityEnabledTests.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. @@ -16,9 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; import org.junit.jupiter.api.Test; @@ -27,36 +24,38 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { "spring.main.web-application-type=reactive", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class ReactiveSecurityEnabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } // The ManagementWebSecurityAutoConfiguration exposes only Info and Health endpoint not Env! @@ -64,7 +63,7 @@ public class ReactiveSecurityEnabledManagementSecurityEnabledTests extends Abstr @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java similarity index 75% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java index 673cd8f5..30867233 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityDisabledManagementSecurityEnabledTests.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. @@ -16,9 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; import org.junit.jupiter.api.Test; @@ -27,45 +24,46 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { "spring.main.web-application-type=servlet", "spring.cloud.streamapp.security.enabled=false", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class SecurityDisabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java similarity index 81% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java index affc6bfb..be0b7147 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests.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. @@ -16,9 +16,6 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -31,10 +28,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.support.BasicAuthenticationInterceptor; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { @@ -43,7 +41,7 @@ import org.springframework.test.context.TestPropertySource; ".ManagementWebSecurityAutoConfiguration" + ",org.springframework.cloud.stream.app.security.common.AppStarterWebSecurityAutoConfiguration", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests extends AbstractSecurityCommonTests { @Autowired @@ -59,28 +57,28 @@ public class SecurityEnabledManagementSecurityDisabledAuthorizedAccessTests exte @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java similarity index 76% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java index 7161bd3e..5e72ff62 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests.java @@ -16,22 +16,19 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { @@ -39,35 +36,35 @@ import org.springframework.test.context.TestPropertySource; "spring.autoconfigure.exclude=" + "org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration" + ",org.springframework.cloud.stream.app.security.common.AppStarterWebSecurityAutoConfiguration", - "management.endpoints.web.exposure.include=health,info" }) + "management.endpoints.web.exposure.include=health,info"}) public class SecurityEnabledManagementSecurityDisabledUnauthorizedAccessTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("Unauthorized", health.get("error")); + assertThat(health.get("error")).isEqualTo("Unauthorized"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("Unauthorized", info.get("error")); + assertThat(info.get("error")).isEqualTo("Unauthorized"); } @Test @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java similarity index 75% rename from applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java rename to applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java index 155eaaa8..f5d8cbcc 100644 --- a/applications/apps-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.java +++ b/applications/stream-applications-core/common/stream-apps-security-common/src/test/java/org/springframework/cloud/stream/app/security/common/SecurityEnabledManagementSecurityEnabledTests.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. @@ -16,48 +16,45 @@ package org.springframework.cloud.stream.app.security.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.Map; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan - * * @since 3.0 */ @TestPropertySource(properties = { "spring.main.web-application-type=servlet", "management.endpoints.web.exposure.include=health,info,env", - "info.name=MY TEST APP" }) + "info.name=MY TEST APP"}) public class SecurityEnabledManagementSecurityEnabledTests extends AbstractSecurityCommonTests { @Test @SuppressWarnings("rawtypes") public void testHealthEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/health", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map health = response.getBody(); - assertEquals("UP", health.get("status")); + assertThat(health.get("status")).isEqualTo("UP"); } @Test @SuppressWarnings("rawtypes") public void testInfoEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/info", Map.class); - assertEquals(HttpStatus.OK, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(response.hasBody()).isTrue(); Map info = response.getBody(); - assertEquals("MY TEST APP", info.get("name")); + assertThat(info.get("name")).isEqualTo("MY TEST APP"); } // The ManagementWebSecurityAutoConfiguration exposes only Info and Health endpoint not Env! @@ -65,8 +62,8 @@ public class SecurityEnabledManagementSecurityEnabledTests extends AbstractSecur @SuppressWarnings("rawtypes") public void testEnvEndpoint() { ResponseEntity response = this.restTemplate.getForEntity("/actuator/env", Map.class); - assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); - assertTrue(response.hasBody()); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); + assertThat(response.hasBody()).isTrue(); } } diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/README.adoc b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/README.adoc similarity index 100% rename from applications/apps-core/common/stream-apps-task-launch-request-common/README.adoc rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/README.adoc diff --git a/applications/stream-applications-core/common/stream-apps-task-launch-request-common/pom.xml b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/pom.xml new file mode 100644 index 00000000..b370241c --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/pom.xml @@ -0,0 +1,45 @@ + + + + stream-apps-common + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + + stream-apps-task-launch-request-common + stream-apps-task-launch-request-common + + + + org.springframework.cloud.stream.app + stream-apps-file-common + ${project.version} + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud + spring-cloud-stream + test-jar + test + test-binder + + + org.springframework.cloud + spring-cloud-stream + + + + org.springframework.cloud + spring-cloud-stream-test-support + test + + + + diff --git a/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java new file mode 100644 index 00000000..1650e440 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequest.java @@ -0,0 +1,65 @@ +/* + * 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 + * + * 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.stream.app.tasklaunchrequest; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class DataFlowTaskLaunchRequest { + @JsonProperty("args") + private List commandlineArguments = new ArrayList<>(); + + @JsonProperty("deploymentProps") + private Map deploymentProperties = new HashMap<>(); + + @JsonProperty("name") + private String taskName; + + public List getCommandlineArguments() { + return this.commandlineArguments; + } + + public void setCommandlineArguments(List commandlineArguments) { + this.commandlineArguments = new ArrayList<>(commandlineArguments); + } + + public Map getDeploymentProperties() { + return this.deploymentProperties; + } + + public void setDeploymentProperties(Map deploymentProperties) { + this.deploymentProperties = deploymentProperties; + } + + public String getTaskName() { + return this.taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public DataFlowTaskLaunchRequest addCommmandLineArguments(Collection args) { + this.commandlineArguments.addAll(args); + return this; + } +} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java similarity index 89% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java index 06b72528..d3147597 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataFlowTaskLaunchRequestAutoConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-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, @@ -24,8 +24,7 @@ import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -50,18 +49,20 @@ import org.springframework.util.StringUtils; @EnableConfigurationProperties(DataflowTaskLaunchRequestProperties.class) public class DataFlowTaskLaunchRequestAutoConfiguration { + /** + * Task launch request function name. + */ + public final static String TASK_LAUNCH_REQUEST_FUNCTION_NAME = "taskLaunchRequest"; + @Autowired private BeanFactory beanFactory; private EvaluationContext evaluationContext; - public final static String TASK_LAUNCH_REQUEST_FUNCTION_NAME = "taskLaunchRequest"; - /** * A {@link java.util.function.Function} to transform a {@link Message} payload to a {@link DataFlowTaskLaunchRequest}. * * @param taskLaunchRequestMessageProcessor a {@link TaskLaunchRequestMessageProcessor}. - * * @return a {code DataFlowTaskLaunchRequest} Message. */ @Bean(name = TASK_LAUNCH_REQUEST_FUNCTION_NAME) @@ -85,7 +86,7 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { @Bean @ConditionalOnMissingBean(CommandLineArgumentsMessageMapper.class) public CommandLineArgumentsMessageMapper commandLineArgumentsMessageMapper( - DataflowTaskLaunchRequestProperties dataflowTaskLaunchRequestProperties){ + DataflowTaskLaunchRequestProperties dataflowTaskLaunchRequestProperties) { return new ExpressionEvaluatingCommandLineArgsMapper(dataflowTaskLaunchRequestProperties.getArgExpressions(), this.evaluationContext); @@ -93,7 +94,7 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { @Bean public TaskLaunchRequestSupplier taskLaunchRequestInitializer( - DataflowTaskLaunchRequestProperties taskLaunchRequestProperties){ + DataflowTaskLaunchRequestProperties taskLaunchRequestProperties) { return new DataflowTaskLaunchRequestPropertiesInitializer(taskLaunchRequestProperties); } @@ -108,9 +109,14 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { commandLineArgumentsMessageMapper); } + @PostConstruct + public void createEvaluationContext() { + this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); + } + static class DataflowTaskLaunchRequestPropertiesInitializer extends TaskLaunchRequestSupplier { DataflowTaskLaunchRequestPropertiesInitializer( - DataflowTaskLaunchRequestProperties taskLaunchRequestProperties){ + DataflowTaskLaunchRequestProperties taskLaunchRequestProperties) { this.commandLineArgumentSupplier( () -> new ArrayList<>(taskLaunchRequestProperties.getArgs()) @@ -121,12 +127,12 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { taskLaunchRequestProperties.getDeploymentProperties()) ); - this.taskNameSupplier(()->taskLaunchRequestProperties.getTaskName()); + this.taskNameSupplier(() -> taskLaunchRequestProperties.getTaskName()); } } static class ExpressionEvaluatingCommandLineArgsMapper implements CommandLineArgumentsMessageMapper { - private final Map argExpressionsMap; + private final Map argExpressionsMap; private final EvaluationContext evaluationContext; ExpressionEvaluatingCommandLineArgsMapper(String argExpressions, EvaluationContext evaluationContext) { @@ -136,7 +142,7 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { SpelExpressionParser expressionParser = new SpelExpressionParser(); KeyValueListParser.parseCommaDelimitedKeyValuePairs(argExpressions).forEach( - (k,v)-> argExpressionsMap.put(k, expressionParser.parseExpression(v))); + (k, v) -> argExpressionsMap.put(k, expressionParser.parseExpression(v))); } } @@ -149,14 +155,9 @@ public class DataFlowTaskLaunchRequestAutoConfiguration { private Collection evaluateArgExpressions(Message message) { List results = new LinkedList<>(); this.argExpressionsMap.forEach((k, expression) -> - results.add(String.format("%s=%s", k, expression.getValue(this.evaluationContext, message)))); + results.add(String.format("%s=%s", k, expression.getValue(this.evaluationContext, message)))); return results; } } - @PostConstruct - public void createEvaluationContext(){ - this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); - } - } diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java similarity index 96% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java index 2003c530..95ad6ce8 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/DataflowTaskLaunchRequestProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-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, @@ -18,8 +18,10 @@ package org.springframework.cloud.stream.app.tasklaunchrequest; import java.util.ArrayList; import java.util.List; + import javax.validation.constraints.AssertFalse; import javax.validation.constraints.NotNull; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java similarity index 65% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java index b38d35e3..1664391c 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/ExpressionEvaluatingTaskNameMessageMapper.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. @@ -23,16 +23,16 @@ import org.springframework.messaging.Message; public class ExpressionEvaluatingTaskNameMessageMapper implements TaskNameMessageMapper { - private final Expression expression; - private final EvaluationContext evaluationContext; + private final Expression expression; + private final EvaluationContext evaluationContext; - public ExpressionEvaluatingTaskNameMessageMapper(Expression expression, EvaluationContext evaluationContext) { - this.evaluationContext = evaluationContext; - this.expression = expression; - } + public ExpressionEvaluatingTaskNameMessageMapper(Expression expression, EvaluationContext evaluationContext) { + this.evaluationContext = evaluationContext; + this.expression = expression; + } - @Override - public String processMessage(Message message) { - return expression.getValue(evaluationContext, message).toString(); - } + @Override + public String processMessage(Message message) { + return expression.getValue(evaluationContext, message).toString(); + } } diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java similarity index 97% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java index ee71ebba..b9e1b20b 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParser.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. diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java similarity index 94% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java index 611dc9c1..181923b9 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestFunction.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. diff --git a/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java new file mode 100644 index 00000000..2fb84361 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestMessageProcessor.java @@ -0,0 +1,70 @@ +/* + * 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 + * + * 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.stream.app.tasklaunchrequest; + +import org.springframework.cloud.stream.app.tasklaunchrequest.support.CommandLineArgumentsMessageMapper; +import org.springframework.cloud.stream.app.tasklaunchrequest.support.TaskLaunchRequestSupplier; +import org.springframework.cloud.stream.app.tasklaunchrequest.support.TaskNameMessageMapper; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; +import org.springframework.messaging.core.MessagePostProcessor; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.util.Assert; +import org.springframework.util.MimeTypeUtils; +import org.springframework.util.StringUtils; + +public class TaskLaunchRequestMessageProcessor implements MessagePostProcessor { + + private final TaskNameMessageMapper taskNameMessageMapper; + private final CommandLineArgumentsMessageMapper commandLineArgumentsMessageMapper; + private final TaskLaunchRequestSupplier taskLaunchRequestInitializer; + + public TaskLaunchRequestMessageProcessor(TaskLaunchRequestSupplier taskLaunchRequestInitializer, + TaskNameMessageMapper taskNameMessageMapper, + CommandLineArgumentsMessageMapper commandLIneArgumentsMessageMapper) { + + this.taskLaunchRequestInitializer = taskLaunchRequestInitializer; + + this.taskNameMessageMapper = taskNameMessageMapper; + + this.commandLineArgumentsMessageMapper = commandLIneArgumentsMessageMapper; + + } + + @Override + public Message postProcessMessage(Message message) { + DataFlowTaskLaunchRequest taskLaunchRequest = taskLaunchRequestInitializer.get(); + + if (!StringUtils.hasText(taskLaunchRequest.getTaskName())) { + taskLaunchRequest.setTaskName(taskNameMessageMapper.processMessage(message)); + Assert.hasText(taskLaunchRequest.getTaskName(), () -> + "'taskName' is required in " + DataFlowTaskLaunchRequest.class.getName()); + } + + taskLaunchRequest.addCommmandLineArguments(commandLineArgumentsMessageMapper.processMessage(message)); + + MessageBuilder builder + = MessageBuilder.withPayload(taskLaunchRequest).copyHeaders(message.getHeaders()); + return adjustHeaders(builder).build(); + } + + + private MessageBuilder adjustHeaders(MessageBuilder builder) { + builder.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON); + return builder; + } +} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java similarity index 93% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java index 12f4a5af..f1bdfe4d 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/CommandLineArgumentsMessageMapper.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. @@ -17,6 +17,7 @@ package org.springframework.cloud.stream.app.tasklaunchrequest.support; import java.util.Collection; + import org.springframework.integration.handler.MessageProcessor; public interface CommandLineArgumentsMessageMapper extends MessageProcessor> { diff --git a/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java new file mode 100644 index 00000000..dfc22fc2 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskLaunchRequestSupplier.java @@ -0,0 +1,66 @@ +/* + * 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 + * + * 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.stream.app.tasklaunchrequest.support; + +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +import org.springframework.cloud.stream.app.tasklaunchrequest.DataFlowTaskLaunchRequest; +import org.springframework.util.Assert; + +public class TaskLaunchRequestSupplier implements Supplier { + + private Supplier taskNameSupplier; + private Supplier> commandLineArgumentsSupplier; + private Supplier> deploymentPropertiesSupplier; + + + public TaskLaunchRequestSupplier taskNameSupplier(Supplier taskNameSupplier) { + this.taskNameSupplier = taskNameSupplier; + return this; + } + + public TaskLaunchRequestSupplier commandLineArgumentSupplier(Supplier> commandLineArgumentsSupplier) { + this.commandLineArgumentsSupplier = commandLineArgumentsSupplier; + return this; + } + + public TaskLaunchRequestSupplier deploymentPropertiesSupplier(Supplier> deploymentPropertiesSupplier) { + this.deploymentPropertiesSupplier = deploymentPropertiesSupplier; + return this; + } + + @Override + public DataFlowTaskLaunchRequest get() { + + Assert.notNull(this.taskNameSupplier, "'taskNameSupplier' is required."); + + DataFlowTaskLaunchRequest dataFlowTaskLaunchRequest = new DataFlowTaskLaunchRequest(); + dataFlowTaskLaunchRequest.setTaskName(this.taskNameSupplier.get()); + + if (this.commandLineArgumentsSupplier != null) { + dataFlowTaskLaunchRequest.setCommandlineArguments(this.commandLineArgumentsSupplier.get()); + } + + if (this.deploymentPropertiesSupplier != null) { + dataFlowTaskLaunchRequest.setDeploymentProperties(this.deploymentPropertiesSupplier.get()); + } + + return dataFlowTaskLaunchRequest; + } +} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java similarity index 93% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java index 0997a72b..c9dacf57 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/support/TaskNameMessageMapper.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. diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring-configuration-metadata-whitelist.properties b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring-configuration-metadata-whitelist.properties similarity index 100% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring-configuration-metadata-whitelist.properties rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring-configuration-metadata-whitelist.properties diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring.factories b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring.factories similarity index 100% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring.factories rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/main/resources/META-INF/spring.factories diff --git a/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java new file mode 100644 index 00000000..16c5c51e --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/KeyValueListParserTests.java @@ -0,0 +1,88 @@ +/* + * 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.stream.app.tasklaunchrequest; + +import java.util.Map; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Chris Schaefer + * @author David Turanski + */ +public class KeyValueListParserTests { + + @Test + public void testParseSimpleDeploymentProperty() { + Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( + "app.sftp.param=value"); + + assertThat(deploymentProperties.size()).isEqualTo(1); + assertThat(deploymentProperties.containsKey("app.sftp.param")).isTrue(); + assertThat(deploymentProperties.get("app.sftp.param")).isEqualTo("value"); + } + + @Test + public void testParseSimpleDeploymentPropertyMultipleValues() { + Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( + "app.sftp.param=value1,value2,value3"); + + assertThat(deploymentProperties.size()).isEqualTo(1); + assertThat(deploymentProperties.containsKey("app.sftp.param")).isTrue(); + assertThat(deploymentProperties.get("app.sftp.param")).isEqualTo("value1,value2,value3"); + } + + @Test + public void testParseSpelExpressionMultipleValues() { + Map argExpressions = KeyValueListParser.parseCommaDelimitedKeyValuePairs( + "arg1=payload.substr(0,2),arg2=headers['foo'],arg3=headers['bar']==false"); + + + assertThat(argExpressions.size()).isEqualTo(3); + assertThat(argExpressions.containsKey("arg1")).isTrue(); + assertThat(argExpressions.get("arg1")).isEqualTo("payload.substr(0,2)"); + assertThat(argExpressions.containsKey("arg2")).isTrue(); + assertThat(argExpressions.get("arg2")).isEqualTo("headers['foo']"); + } + + @Test + public void testParseMultipleDeploymentPropertiesSingleValue() { + Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( + "app.sftp.param=value1,app.sftp.other.param=value2"); + + assertThat(deploymentProperties.size()).isEqualTo(2); + assertThat(deploymentProperties.containsKey("app.sftp.param")).isTrue(); + assertThat(deploymentProperties.get("app.sftp.param")).isEqualTo("value1"); + assertThat(deploymentProperties.containsKey("app.sftp.other.param")).isTrue(); + assertThat(deploymentProperties.get("app.sftp.other.param")).isEqualTo("value2"); + } + + @Test + public void testParseMultipleDeploymentPropertiesMultipleValues() { + DataflowTaskLaunchRequestProperties taskLaunchRequestProperties = new DataflowTaskLaunchRequestProperties(); + + Map deploymentProperties = KeyValueListParser.parseCommaDelimitedKeyValuePairs( + "app.sftp.param=value1,value2,app.sftp.other.param=other1,other2"); + + assertThat(deploymentProperties.size()).isEqualTo(2); + assertThat(deploymentProperties.containsKey("app.sftp.param")).isTrue(); + assertThat(deploymentProperties.get("app.sftp.param")).isEqualTo("value1,value2"); + assertThat(deploymentProperties.get("app.sftp.other.param")).isEqualTo("other1,other2"); + } +} diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java similarity index 79% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java index 0aaaa167..45b746f2 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestIntegrationTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-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,14 +16,13 @@ package org.springframework.cloud.stream.app.tasklaunchrequest; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - import java.io.IOException; import java.util.Collections; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; import org.junit.Test; + import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -43,7 +42,8 @@ import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.MessageBuilder; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; /** * @author David Turanski @@ -218,54 +218,54 @@ public class TaskLaunchRequestIntegrationTests { "spring.jmx.enabled=false", "spring.cloud.stream.function.definition=taskLaunchRequest", "customTaskNameExtractor=true") .run(context -> { - MessageChannel input = context.getBean("input", MessageChannel.class); + MessageChannel input = context.getBean("input", MessageChannel.class); - OutputDestination target = context.getBean(OutputDestination.class); + OutputDestination target = context.getBean(OutputDestination.class); - ObjectMapper objectMapper = context.getBean(ObjectMapper.class); + ObjectMapper objectMapper = context.getBean(ObjectMapper.class); - Message message = MessageBuilder.withPayload("foo").build(); - input.send(message); + Message message = MessageBuilder.withPayload("foo").build(); + input.send(message); - Message response = target.receive(1000); - assertThat(response).isNotNull(); + Message response = target.receive(1000); + assertThat(response).isNotNull(); - DataFlowTaskLaunchRequest request = objectMapper.readValue(response.getPayload(), - DataFlowTaskLaunchRequest.class); + DataFlowTaskLaunchRequest request = objectMapper.readValue(response.getPayload(), + DataFlowTaskLaunchRequest.class); - assertThat(request.getTaskName()).isEqualTo("fooTask"); - }); - //TODO: Workaround for https://github.com/spring-cloud/spring-cloud-stream/issues/1876 - applicationContextRunner.withPropertyValues( - "spring.jmx.enabled=false", "spring.cloud.stream.function.definition=taskLaunchRequest", - "customTaskNameExtractor=true") - .run(context -> { - MessageChannel input = context.getBean("input", MessageChannel.class); + assertThat(request.getTaskName()).isEqualTo("fooTask"); + }); + //TODO: Workaround for https://github.com/spring-cloud/spring-cloud-stream/issues/1876 + applicationContextRunner.withPropertyValues( + "spring.jmx.enabled=false", "spring.cloud.stream.function.definition=taskLaunchRequest", + "customTaskNameExtractor=true") + .run(context -> { + MessageChannel input = context.getBean("input", MessageChannel.class); - OutputDestination target = context.getBean(OutputDestination.class); + OutputDestination target = context.getBean(OutputDestination.class); - ObjectMapper objectMapper = context.getBean(ObjectMapper.class); + ObjectMapper objectMapper = context.getBean(ObjectMapper.class); - Message message = MessageBuilder.withPayload("bar").build(); - input.send(message); + Message message = MessageBuilder.withPayload("bar").build(); + input.send(message); - Message response = target.receive(1000); - assertThat(response).isNotNull(); + Message response = target.receive(1000); + assertThat(response).isNotNull(); - DataFlowTaskLaunchRequest request = objectMapper.readValue(response.getPayload(), - DataFlowTaskLaunchRequest.class); + DataFlowTaskLaunchRequest request = objectMapper.readValue(response.getPayload(), + DataFlowTaskLaunchRequest.class); - assertThat(request.getTaskName()).isEqualTo("defaultTask"); - }); + assertThat(request.getTaskName()).isEqualTo("defaultTask"); + }); } private DataFlowTaskLaunchRequest verifyAndreceiveDataFlowTaskLaunchRequest(ApplicationContext context) - throws IOException { + throws IOException { MessageChannel input = context.getBean("input", MessageChannel.class); OutputDestination target = context.getBean(OutputDestination.class); - MessageBuilder builder = MessageBuilder.withPayload(new byte[] {}); + MessageBuilder builder = MessageBuilder.withPayload(new byte[]{}); ObjectMapper objectMapper = context.getBean(ObjectMapper.class); @@ -276,11 +276,11 @@ public class TaskLaunchRequestIntegrationTests { assertThat(message).isNotNull(); return objectMapper.readValue(message.getPayload(), - DataFlowTaskLaunchRequest.class); + DataFlowTaskLaunchRequest.class); } - @EnableAutoConfiguration(exclude = { TestSupportBinderAutoConfiguration.class, - MessageCollectorAutoConfiguration.class }) + @EnableAutoConfiguration(exclude = {TestSupportBinderAutoConfiguration.class, + MessageCollectorAutoConfiguration.class}) @EnableBinding(Processor.class) static class TestApp { @@ -292,14 +292,14 @@ public class TaskLaunchRequestIntegrationTests { @Bean @ConditionalOnProperty("customTaskNameExtractor") TaskNameMessageMapper taskNameExtractor() { - return message -> ((String)(message.getPayload())).equalsIgnoreCase("foo") ? - "fooTask" : - "defaultTask"; + return message -> ((String) (message.getPayload())).equalsIgnoreCase("foo") ? + "fooTask" : + "defaultTask"; } @Bean @ConditionalOnProperty("enhanceTLRArgs") - CommandLineArgumentsMessageMapper commandLineArgumentsProvider(){ + CommandLineArgumentsMessageMapper commandLineArgumentsProvider() { return message -> Collections.singletonList("runtimeArg"); } @@ -307,7 +307,7 @@ public class TaskLaunchRequestIntegrationTests { public IntegrationFlow flow() { return IntegrationFlows.from(Processor.INPUT) - .channel(Processor.OUTPUT).get(); + .channel(Processor.OUTPUT).get(); } } } diff --git a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java similarity index 90% rename from applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java rename to applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java index 0753e5e7..ec6a1fe6 100644 --- a/applications/apps-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java +++ b/applications/stream-applications-core/common/stream-apps-task-launch-request-common/src/test/java/org/springframework/cloud/stream/app/tasklaunchrequest/TaskLaunchRequestPropertiesTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-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, @@ -37,14 +37,14 @@ public class TaskLaunchRequestPropertiesTests { @Test public void deploymentPropertiesCanBeCustomized() { DataflowTaskLaunchRequestProperties properties = getBatchProperties( - "task.launch.request.deploymentProperties:prop1=val1,prop2=val2"); + "task.launch.request.deploymentProperties:prop1=val1,prop2=val2"); assertThat(properties.getDeploymentProperties()).isEqualTo("prop1=val1,prop2=val2"); } @Test public void parametersCanBeCustomized() { DataflowTaskLaunchRequestProperties properties = getBatchProperties( - "task.launch.request.args:jp1=jpv1,jp2=jpv2"); + "task.launch.request.args:jp1=jpv1,jp2=jpv2"); List args = properties.getArgs(); assertThat(args).isNotNull(); diff --git a/applications/stream-applications-core/common/stream-apps-test-support/pom.xml b/applications/stream-applications-core/common/stream-apps-test-support/pom.xml new file mode 100644 index 00000000..7100d166 --- /dev/null +++ b/applications/stream-applications-core/common/stream-apps-test-support/pom.xml @@ -0,0 +1,30 @@ + + + + stream-apps-common + org.springframework.cloud.stream.app + 3.0.0.BUILD-SNAPSHOT + + 4.0.0 + + stream-apps-test-support + + + + org.springframework.integration + spring-integration-test + + + org.springframework.integration + spring-integration-test-support + + + org.springframework.boot + spring-boot-starter-data-redis + true + + + + + diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java similarity index 97% rename from applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java rename to applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java index e49ca6e8..b9b44882 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java +++ b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/BinderTestPropertiesInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-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. @@ -32,7 +32,6 @@ import org.springframework.core.env.PropertiesPropertySource; * before any BFPPs - i.e. as early as possible. * * @author Gary Russell - * */ public class BinderTestPropertiesInitializer implements BeanDefinitionRegistryPostProcessor { diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java similarity index 97% rename from applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java rename to applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java index dad41cd9..8eab7973 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java +++ b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/file/remote/RemoteFileTestSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-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.stream.app.test.file.remote; import java.io.File; @@ -27,18 +28,23 @@ import org.junit.rules.TemporaryFolder; * Abstract base class for tests requiring remote file servers, e.g. (S)FTP. * * @author Gary Russell - * */ public abstract class RemoteFileTestSupport { - protected static final int port = 0; - + /** + * remote temp folder. + */ @ClassRule public static final TemporaryFolder remoteTemporaryFolder = new TemporaryFolder(); + /** + * local temp folder. + */ @ClassRule public static final TemporaryFolder localTemporaryFolder = new TemporaryFolder(); + protected static final int port = 0; + protected volatile File sourceRemoteDirectory; protected volatile File targetRemoteDirectory; @@ -78,7 +84,7 @@ public abstract class RemoteFileTestSupport { * ├── localSource2.txt - contains 'local2' * localTarget/ * - * + *

* The intent is tests retrieve from remoteSource and verify arrival in localTarget or send from localSource and verify * arrival in remoteTarget. *

@@ -86,6 +92,7 @@ public abstract class RemoteFileTestSupport { * create a different structure. *

* While a single server exists for all tests, the directory structure is rebuilt for each test. + * * @throws IOException IO Exception. */ @Before @@ -140,6 +147,7 @@ public abstract class RemoteFileTestSupport { /** * Prefix for directory/file structure; default 'remote'. + * * @return the prefix. */ protected String prefix() { diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java similarity index 89% rename from applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java rename to applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java index e1de6007..9254576a 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSinkTestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-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,13 +27,12 @@ import org.springframework.context.annotation.Configuration; * Generated app test configuration for the IP (TCP) sink. * * @author Gary Russell - * */ @Configuration public class IpSinkTestConfiguration { @Bean - public static BinderTestPropertiesInitializer loadProps(ConfigurableApplicationContext context) { + public BinderTestPropertiesInitializer loadProps(ConfigurableApplicationContext context) { // minimal properties for the context to load Properties properties = new Properties(); properties.put("host", "localhost"); diff --git a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java similarity index 89% rename from applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java rename to applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java index babe0127..876bb1b5 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/ip/IpSourceTestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-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,13 +27,12 @@ import org.springframework.context.annotation.Configuration; * Generated app test configuration for IP (TCP, UDP) sources. * * @author Gary Russell - * */ @Configuration public class IpSourceTestConfiguration { @Bean - public static BinderTestPropertiesInitializer loadProps(ConfigurableApplicationContext context) { + public BinderTestPropertiesInitializer loadProps(ConfigurableApplicationContext context) { // minimal properties for the context to load Properties properties = new Properties(); properties.put("port", 0); 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/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java similarity index 96% rename from applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java rename to applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java index 39a6aee6..ba32e59c 100644 --- a/applications/apps-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java +++ b/applications/stream-applications-core/common/stream-apps-test-support/src/main/java/org/springframework/cloud/stream/app/test/script/ScriptableTestConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-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 org.springframework.context.annotation.Configuration; * Test configuration for generated scriptable apps. * * @author Gary Russell - * */ @Configuration public class ScriptableTestConfiguration { diff --git a/applications/apps-core/pom.xml b/applications/stream-applications-core/pom.xml similarity index 66% rename from applications/apps-core/pom.xml rename to applications/stream-applications-core/pom.xml index 37f50ab8..280f7d6a 100644 --- a/applications/apps-core/pom.xml +++ b/applications/stream-applications-core/pom.xml @@ -1,11 +1,12 @@ - + 4.0.0 org.springframework.cloud.stream.app - stream-apps-parent + stream-applications-core 3.0.0.BUILD-SNAPSHOT - stream-apps-parent - Infrastructure for stream apps + stream-applications-core + Stream Applications Core (Parent) pom @@ -28,6 +29,28 @@ 2.1.1.RELEASE 1.0.0.BUILD-SNAPSHOT 0.9.0 + 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 + + 3.1.1 @@ -83,7 +106,8 @@ implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. + @@ -277,6 +301,124 @@ + + + + + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + javadoc + package + + jar + + + + + true + + + + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + package + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + **/*Tests.java + **/*Test.java + + + **/Abstract*.java + + + + + 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 + + + + +