Apply checkstyle changes in stream-applications

* core, source, sink and processor are now updated with latest checkstyle requirements.
This commit is contained in:
Soby Chacko
2020-05-07 11:18:22 -04:00
parent f61fbb4dc9
commit 9bc78ec1fa
234 changed files with 1717 additions and 2419 deletions

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers>
<server>
<id>repo.spring.io</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<!--
N.B. this profile is only here to support users and IDEs that do not use Maven 3.3.
It isn't needed on the command line if you use the wrapper script (mvnw) or if you use
a native Maven with the right version. Eclipse users should points their Maven tooling to
this settings file, or copy the profile into their ~/.m2/settings.xml.
-->
<id>spring</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- Gemstone repository is needed since gemfire libs
are not hosted in mvn central. Note that the libs
are also hosted and browsable at
https://repo.spring.io/gemstone-release-cache -->
<repository>
<id>gemstone-release</id>
<name>GemStone Maven Release Repository</name>
<url>http://dist.gemstone.com/maven/release</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-parent</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-common</artifactId>
<packaging>pom</packaging>
<name>stream-apps-common</name>
<modules>
<module>stream-apps-file-common</module>
<module>stream-apps-ftp-common</module>
<module>stream-apps-test-support</module>
<module>stream-apps-postprocessor-common</module>
<module>stream-apps-micrometer-common</module>
<module>stream-apps-metadata-store-common</module>
<module>stream-apps-task-launch-request-common</module>
<module>stream-apps-security-common</module>
</modules>
</project>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-file-common</artifactId>
<name>stream-apps-file-common</name>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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.<String, Object>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.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
MimeTypeUtils.TEXT_PLAIN_VALUE))
.split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson()));
break;
case ref:
flowBuilder.enrichHeaders(Collections.<String, Object>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.<String, Object>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.<String, Object>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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-ftp-common</artifactId>
<name>stream-apps-ftp-common</name>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ftp</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-file-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>stream-apps-metadata-store-common</artifactId>
<name>stream-apps-metadata-store-common</name>
<properties>
<aws-java-sdk.version>1.11.439</aws-java-sdk.version>
<spring-integration-aws.version>2.0.0.RELEASE</spring-integration-aws.version>
<spring-integration-hazelcast.version>1.0.0.RELEASE</spring-integration-hazelcast.version>
<curator.version>4.0.1</curator.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<!--Redis-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-redis</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<optional>true</optional>
</dependency>
<!--MongoDB-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mongodb</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<!--Gemfire-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-gemfire</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-gemfire</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--TODO-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-geode</artifactId>
<optional>true</optional>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>geode-spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>-->
<!--JDBC-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jdbc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
<!--Zookeeper-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-zookeeper</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${curator.version}</version>
<scope>test</scope>
</dependency>
<!--Hazelcast-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-hazelcast</artifactId>
<version>${spring-integration-hazelcast.version}</version>
<optional>true</optional>
</dependency>
<!--DynamoDB-->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-aws</artifactId>
<version>${spring-integration-aws.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>${aws-java-sdk.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -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"
}
}]}

View File

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-security-common</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-task-launch-request-common</artifactId>
<name>stream-apps-task-launch-request-common</name>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-file-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<type>test-jar</type>
<scope>test</scope>
<classifier>test-binder</classifier>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -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<String> commandlineArguments = new ArrayList<>();
@JsonProperty("deploymentProps")
private Map<String, String> deploymentProperties = new HashMap<>();
@JsonProperty("name")
private String taskName;
public void setCommandlineArguments(List<String> commandlineArguments) {
this.commandlineArguments = new ArrayList<>(commandlineArguments);
}
public List<String> getCommandlineArguments() {
return this.commandlineArguments;
}
public void setDeploymentProperties(Map<String, String> deploymentProperties) {
this.deploymentProperties = deploymentProperties;
}
public Map<String, String> getDeploymentProperties() {
return this.deploymentProperties;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskName() {
return this.taskName;
}
public DataFlowTaskLaunchRequest addCommmandLineArguments(Collection<String> args) {
this.commandlineArguments.addAll(args);
return this;
}
}

View File

@@ -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<DataFlowTaskLaunchRequest> 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<DataFlowTaskLaunchRequest> builder
= MessageBuilder.withPayload(taskLaunchRequest).copyHeaders(message.getHeaders());
return adjustHeaders(builder).build();
}
private MessageBuilder<DataFlowTaskLaunchRequest> adjustHeaders(MessageBuilder<DataFlowTaskLaunchRequest> builder) {
builder.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON);
return builder;
}
}

View File

@@ -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<DataFlowTaskLaunchRequest> {
private Supplier<String> taskNameSupplier;
private Supplier<List<String>> commandLineArgumentsSupplier;
private Supplier<Map<String, String>> deploymentPropertiesSupplier;
public TaskLaunchRequestSupplier taskNameSupplier(Supplier<String> taskNameSupplier) {
this.taskNameSupplier = taskNameSupplier;
return this;
}
public TaskLaunchRequestSupplier commandLineArgumentSupplier(Supplier<List<String>> commandLineArgumentsSupplier) {
this.commandLineArgumentsSupplier = commandLineArgumentsSupplier;
return this;
}
public TaskLaunchRequestSupplier deploymentPropertiesSupplier(Supplier<Map<String, String>> 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;
}
}

View File

@@ -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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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"));
}
}

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>stream-apps-common</artifactId>
<groupId>org.springframework.cloud.stream.app</groupId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stream-apps-test-support</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -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<ConfigurableApplicationContext> {
public static Properties PROPERTIES;
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
configurableApplicationContext.getEnvironment().getPropertySources().addLast(new
PropertiesPropertySource("applicationOptions", PROPERTIES));
}
}

View File

@@ -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<LettuceConnectionFactory> {
//
// 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();
// }
//}

View File

@@ -2,15 +2,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps</artifactId>
<artifactId>stream-applications-infra</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<name>stream-apps</name>
<name>stream-applications-infra</name>
<description>Infrastructure for stream applications</description>
<packaging>pom</packaging>
<modules>
<module>apps-core</module>
<module>apps-build</module>
<module>stream-applications-core</module>
<module>stream-applications-build</module>
<module>source</module>
<module>sink</module>
<module>processor</module>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>bridge-processor</artifactId>
@@ -43,7 +43,8 @@
<name>bridge</name>
<type>processor</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.stream.app.BridgeProcessorConfiguration.class</configClass>
<configClass>org.springframework.cloud.stream.app.BridgeProcessorConfiguration.class
</configClass>
<functionDefinition>bridgeFunction</functionDefinition>
</generatedApp>

View File

@@ -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 {
}
}

View File

@@ -1,91 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>filter-processor</artifactId>
<name>filter-processor</name>
<description>filter processor apps</description>
<version>3.0.0.BUILD-SNAPSHOT</version>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>filter-processor</artifactId>
<name>filter-processor</name>
<description>filter processor apps</description>
<version>3.0.0.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-parent</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<parent>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-parent</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>filter-function</artifactId>
<version>${java-functions.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>filter-function</artifactId>
<version>${java-functions.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-doc-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud.stream.app.plugin</groupId>
<artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
<configuration>
<generatedApp>
<name>filter</name>
<type>processor</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.filter.FilterFunctionConfiguration.class</configClass>
<functionDefinition>byteArrayTextToString|filterFunction</functionDefinition>
</generatedApp>
<build>
<plugins>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-doc-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud.stream.app.plugin</groupId>
<artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
<configuration>
<generatedApp>
<name>filter</name>
<type>processor</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.filter.FilterFunctionConfiguration.class</configClass>
<functionDefinition>byteArrayTextToString|filterFunction</functionDefinition>
</generatedApp>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>filter-function</artifactId>
<version>${java-functions.version}</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>filter-function</artifactId>
<version>${java-functions.version}</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
</repository>
</repositories>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
</repository>
</repositories>
</project>

View File

@@ -1 +1 @@
configuration-properties.classes=SpelFunctionProperties
configuration-properties.classes=SpelFunctionProperties

View File

@@ -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 {
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>splitter-processor</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -52,7 +53,8 @@
<name>splitter</name>
<type>processor</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.splitter.SplitterFunctionConfiguration.class
</configClass>
<functionDefinition>byteArrayTextToString|splitterFunction</functionDefinition>
</generatedApp>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.splitter.SplitterFunctionProperties
configuration-properties.classes=org.springframework.cloud.fn.splitter.SplitterFunctionProperties

View File

@@ -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 {
}
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>transform-processor</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.spel.SpelFunctionProperties
configuration-properties.classes=org.springframework.cloud.fn.spel.SpelFunctionProperties

View File

@@ -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 {
}
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cassandra-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -41,7 +42,9 @@
<name>cassandra</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.cassandra.CassandraConsumerConfiguration.class</configClass>
<configClass>
org.springframework.cloud.fn.consumer.cassandra.CassandraConsumerConfiguration.class
</configClass>
</generatedApp>
<dependencies>

View File

@@ -1,3 +1,3 @@
configuration-properties.classes=CassandraConsumerProperties, \
CassandraClusterProperties, \
org.springframework.boot.autoconfigure.cassandra.CassandraProperties
org.springframework.boot.autoconfigure.cassandra.CassandraProperties

View File

@@ -1,98 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>counter-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<name>counter-sink</name>
<description>counter sink apps</description>
<packaging>jar</packaging>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>counter-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<name>counter-sink</name>
<description>counter sink apps</description>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-parent</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<parent>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>stream-apps-parent</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>counter-consumer</artifactId>
<version>${java-functions.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>counter-consumer</artifactId>
<version>${java-functions.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-doc-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud.stream.app.plugin</groupId>
<artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
<configuration>
<generatedApp>
<name>counter</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.counter.CounterConsumerConfiguration.class</configClass>
<functionDefinition>byteArrayTextToString|counterConsumer</functionDefinition>
</generatedApp>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>counter-consumer</artifactId>
<version>${java-functions.version}</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-doc-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud.stream.app.plugin</groupId>
<artifactId>spring-cloud-stream-app-maven-plugin</artifactId>
<configuration>
<generatedApp>
<name>counter</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.counter.CounterConsumerConfiguration.class
</configClass>
<functionDefinition>byteArrayTextToString|counterConsumer</functionDefinition>
</generatedApp>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>counter-consumer</artifactId>
<version>${java-functions.version}</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
</repository>
</repositories>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
</repository>
</repositories>
</project>

View File

@@ -1,2 +1,3 @@
configuration-properties.classes=CounterConsumerProperties, \
CounterConsumerProperties$MetricsTag

View File

@@ -69,6 +69,7 @@ public class CounterSinkTests {
@EnableAutoConfiguration
//@Import({CounterConsumerConfiguration.class, PayloadConverterConfiguration.class})
@Import({CounterConsumerConfiguration.class})
public static class CounterSinkConfiguration {}
public static class CounterSinkConfiguration {
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>file-sink</artifactId>
@@ -42,7 +42,8 @@
<name>file</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.consumer.file.FileConsumerConfiguration.class
</configClass>
</generatedApp>
<dependencies>
<dependency>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.consumer.file.FileConsumerProperties
configuration-properties.classes=org.springframework.cloud.fn.consumer.file.FileConsumerProperties

View File

@@ -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 {
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>jdbc-sink</artifactId>
@@ -60,7 +60,8 @@
<name>jdbc</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.jdbc.JdbcConsumerConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.consumer.jdbc.JdbcConsumerConfiguration.class
</configClass>
</generatedApp>
<dependencies>
<dependency>

View File

@@ -6,4 +6,4 @@ spring.datasource.username,\
spring.datasource.password,\
spring.datasource.schema,\
spring.datasource.data,\
spring.datasource.initialization-mode
spring.datasource.initialization-mode

View File

@@ -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;
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>log-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -52,7 +53,8 @@
<name>log</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class
</configClass>
<functionDefinition>byteArrayTextToString|logConsumer</functionDefinition>
</generatedApp>
<dependencies>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties
configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties

View File

@@ -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 {
}
}

View File

@@ -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: `$$<none>$$`)*
$$mongodb.consumer.collection-expression$$:: $$The SpEL expression to evaluate MongoDB collection$$ *($$Expression$$, default: `$$<none>$$`)*
$$mongodb.consumer.collection$$:: $$The MongoDB collection to store data.$$ *($$String$$, default: `$$<none>$$`)*
$$mongodb.consumer.collection-expression$$:: $$The SpEL expression to evaluate MongoDB collection.$$ *($$Expression$$, default: `$$<none>$$`)*
//end::configuration-properties[]
//end::ref-doc[]

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mongodb-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -41,7 +42,8 @@
<name>mongodb</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerConfiguration.class
</configClass>
</generatedApp>
<dependencies>
<dependency>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerProperties
configuration-properties.classes=org.springframework.cloud.fn.consumer.mongo.MongoDbConsumerProperties

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>rabbit-sink</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -74,7 +75,8 @@
<name>rabbit</name>
<type>sink</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.consumer.rabbit.RabbitConsumerConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.consumer.rabbit.RabbitConsumerConfiguration.class
</configClass>
</generatedApp>
<dependencies>

View File

@@ -1,2 +1,2 @@
configuration-properties.classes=RabbitConsumerProperties, \
org.springframework.boot.autoconfigure.amqp.RabbitProperties
org.springframework.boot.autoconfigure.amqp.RabbitProperties

View File

@@ -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");
}
}

View File

@@ -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<CreateContainerCmd> 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 {
}
}

View File

@@ -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.
*

View File

@@ -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);
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>file-source</artifactId>
@@ -42,7 +42,8 @@
<name>file</name>
<type>source</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.supplier.file.FileSupplierConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.supplier.file.FileSupplierConfiguration.class
</configClass>
</generatedApp>
<dependencies>
<dependency>

View File

@@ -1,2 +1,2 @@
configuration-properties.classes=FileSupplierProperties,\
FileConsumerProperties
FileConsumerProperties

View File

@@ -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 {
}
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>http-source</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -51,7 +52,8 @@
<name>http</name>
<type>source</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class
</configClass>
</generatedApp>
<dependencies>
@@ -65,7 +67,8 @@
<additionalAppProperties>
<additionalAppProperty>spring.main.web-application-type=reactive</additionalAppProperty>
<additionalAppProperty>spring.cloud.streamapp.security.enabled=false</additionalAppProperty>
<additionalAppProperty>spring.cloud.streamapp.security.csrf-enabled=false</additionalAppProperty>
<additionalAppProperty>spring.cloud.streamapp.security.csrf-enabled=false
</additionalAppProperty>
</additionalAppProperties>
</configuration>
</plugin>

View File

@@ -1,3 +1,3 @@
configuration-properties.classes=HttpSourceProperties,\
HttpSourceProperties$Cors
configuration-properties.names=server.port
configuration-properties.names=server.port

View File

@@ -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<byte[]> sourceMessage = outputDestination.receive(10000);
final String actual = new String(sourceMessage.getPayload());
assertThat(actual).isEqualTo("test1");
testRestTemplate.postForObject("/", "test1", Object.class);
Message<byte[]> 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 {
}
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>jdbc-source</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -62,7 +63,8 @@
<name>jdbc</name>
<type>source</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.supplier.jdbc.JdbcSupplierConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.supplier.jdbc.JdbcSupplierConfiguration.class
</configClass>
</generatedApp>
<dependencies>

View File

@@ -7,4 +7,4 @@ spring.datasource.username,\
spring.datasource.password,\
spring.datasource.schema,\
spring.datasource.data,\
spring.datasource.initialization-mode
spring.datasource.initialization-mode

View File

@@ -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);
}
}

View File

@@ -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 {
}
}

View File

@@ -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<Map<?, ?>> 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);
}
}

View File

@@ -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<Map<?, ?>> 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");
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -13,9 +13,9 @@ The **$$mongodb$$** $$source$$ has the following options:
//tag::configuration-properties[]
$$mongodb.supplier.collection$$:: $$The MongoDB collection to query$$ *($$String$$, default: `$$<none>$$`)*
$$mongodb.supplier.query$$:: $$The MongoDB query$$ *($$String$$, default: `$${ }$$`)*
$$mongodb.supplier.query-expression$$:: $$The SpEL expression in MongoDB query DSL style$$ *($$Expression$$, default: `$$<none>$$`)*
$$mongodb.supplier.collection$$:: $$The MongoDB collection to query.$$ *($$String$$, default: `$$<none>$$`)*
$$mongodb.supplier.query$$:: $$The MongoDB query.$$ *($$String$$, default: `$${ }$$`)*
$$mongodb.supplier.query-expression$$:: $$The SpEL expression in MongoDB query DSL style.$$ *($$Expression$$, default: `$$<none>$$`)*
$$mongodb.supplier.split$$:: $$Whether to split the query result as individual messages.$$ *($$Boolean$$, default: `$$true$$`)*
//end::configuration-properties[]

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mongodb-source</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
@@ -41,7 +42,8 @@
<name>mongodb</name>
<type>source</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.supplier.mongo.MongodbSupplierConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.supplier.mongo.MongodbSupplierConfiguration.class
</configClass>
</generatedApp>
<dependencies>

View File

@@ -1 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.supplier.mongo.MongodbSupplierProperties
configuration-properties.classes=org.springframework.cloud.fn.supplier.mongo.MongodbSupplierProperties

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>time-source</artifactId>
@@ -42,7 +42,8 @@
<name>time</name>
<type>source</type>
<version>${project.version}</version>
<configClass>org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class</configClass>
<configClass>org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class
</configClass>
</generatedApp>
<dependencies>
<dependency>

View File

@@ -1,2 +1,2 @@
configuration-properties.classes=TimeProperties,\
org.springframework.cloud.stream.config.DefaultPollerProperties
org.springframework.cloud.stream.config.DefaultPollerProperties

View File

@@ -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 {
}
}

Some files were not shown because too many files have changed in this diff Show More