Various fixes

* Remove `aws-sdk` BOM in favor of one from the SC-AWS
* Add `artifactoryPublish.skip = true` for root project
* Remove `provided` Gradle feature
This commit is contained in:
Artem Bilan
2023-11-24 13:44:06 -05:00
parent df47b2aa04
commit fc71db446a
7 changed files with 42 additions and 82 deletions

View File

@@ -9,6 +9,11 @@ plugins {
description = 'Spring Functions Catlog'
if (tasks.findByName('artifactoryPublish')) {
artifactoryPublish.skip = true
}
ext {
javaProjects = subprojects - project(':function-dependencies')
}
@@ -46,7 +51,6 @@ allprojects {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${property('spring-boot.version')}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${property('spring-cloud.version')}"
mavenBom "software.amazon.awssdk:bom:${property('aws-sdk.version')}"
mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:${property('spring-cloud-aws.version')}"
}
@@ -75,14 +79,10 @@ configure(javaProjects) { subproject ->
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
registerFeature('provided') {
usingSourceSet(sourceSets.main)
}
}
compileJava {
options.release = 17
options.compilerArgs << '-parameters'
}
compileTestJava {
@@ -107,7 +107,7 @@ configure(javaProjects) { subproject ->
// dependencies that are common across all java projects
dependencies {
providedImplementation 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
if (subproject.name != 'config-common') {
api project(':config-common')
@@ -128,9 +128,7 @@ configure(javaProjects) { subproject ->
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
}
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all,-options,-processing'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg, '-parameters']
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing', '-parameters']
test {
maxHeapSize = '2g'
@@ -149,7 +147,7 @@ configure(javaProjects) { subproject ->
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})",
'Implementation-Title': subproject.name,
'Implementation-Vendor-Id': subproject.group,
'Implementation-Vendor': 'Pivotal Software, Inc.',
'Implementation-Vendor': 'VMware, Inc.',
'Implementation-URL': 'https://spring.io/projects/spring-functions-catalog',
'Automatic-Module-Name': subproject.name.replace('-', '.')
)

View File

@@ -1,12 +1,13 @@
version=5.0.0-SNAPSHOT
org.gradle.jvmargs=-Xmx1536M -Dfile.encoding=UTF-8
org.gradle.caching=true
org.gradle.parallel=true
spring-boot.version=3.2.0
spring-cloud.version=2023.0.0-SNAPSHOT
aws-sdk.version=2.20.162
spring-cloud-aws.version=3.0.3
spring-integration-aws.version=3.0.4
angus-mail.version=2.0.2
debeziumVersion = 2.4.1.Final
ftpServerVersion=1.2.0

View File

@@ -1,7 +1,6 @@
dependencies {
api 'org.springframework.integration:spring-integration-jms'
providedImplementation 'jakarta.jms:jakarta.jms-api'
api 'jakarta.jms:jakarta.jms-api'
testImplementation 'org.springframework.boot:spring-boot-starter-artemis'
testImplementation 'org.apache.activemq:artemis-jakarta-server'

View File

@@ -4,6 +4,7 @@ ext {
dependencies {
api 'org.springframework.integration:spring-integration-mail'
api 'org.springframework.boot:spring-boot-starter-mail'
api 'org.eclipse.angus:jakarta.mail:2.0.2'
testImplementation "com.icegreen:greenmail:$greenmailVersion"

View File

@@ -1,47 +0,0 @@
/*
* Copyright 2020-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.fn.supplier.mail;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import org.springframework.messaging.Message;
import org.springframework.test.context.TestPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
@TestPropertySource(properties = {
"mail.supplier.idle-imap=true",
"mail.supplier.url=imap://user:pw@localhost:${test.mail.server.imap.port}/INBOX"})
public class ImapIdleFailTests extends AbstractMailSupplierTests {
@Test
public void testSimpleTest() {
// given
sendMessage("test", "foo");
// when
final Flux<Message<?>> messageFlux = mailSupplier.get();
// then
StepVerifier.create(messageFlux)
.assertNext((message) -> {
assertThat(((String) message.getPayload())).isNotEqualTo("Test Mail");
}
)
.thenCancel()
.verify();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2023 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.
@@ -71,6 +71,7 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
}
@Test
@SuppressWarnings("unchecked")
void supplierForListOnly() {
defaultApplicationContextRunner
.withPropertyValues("sftp.supplier.listOnly=true")
@@ -96,35 +97,38 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE))
.isEqualTo(MediaType.TEXT_PLAIN);
})
.expectTimeout(Duration.ofMillis(1000))
.thenCancel()
.verify(Duration.ofSeconds(30));
});
}
@Test
@SuppressWarnings("unchecked")
void supplierForListOnlyWithPatternFilter() {
defaultApplicationContextRunner
.withPropertyValues("sftp.supplier.listOnly=true", "sftp.supplier.file-name-pattern=.*1.txt")
.withPropertyValues("sftp.supplier.listOnly=true",
"sftp.supplier.file-name-pattern=.*1.txt")
.run(context -> {
Supplier<Flux<Message<String>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
SftpSupplierProperties properties = context.getBean(SftpSupplierProperties.class);
final AtomicReference<String> expectedFileName = new AtomicReference<>(
properties.getRemoteDir() + "/sftpSource1.txt");
StepVerifier.create(sftpSupplier.get())
.assertNext(message -> assertThat(expectedFileName.get()).contains(message.getPayload()))
.expectTimeout(Duration.ofMillis(1000))
.assertNext(message -> assertThat(message.getPayload()).contains("sftpSource1.txt"))
.thenCancel()
.verify(Duration.ofSeconds(30));
});
}
@Test
@SuppressWarnings("unchecked")
void supplierForListSortedByFilenameAsc() {
defaultApplicationContextRunner
.withPropertyValues("sftp.supplier.listOnly=true", "sftp.supplier.sortBy.attribute=filename", "sftp.supplier.sortBy.dir=asc")
.withPropertyValues("sftp.supplier.listOnly=true",
"sftp.supplier.sortBy.attribute=filename",
"sftp.supplier.sortBy.dir=asc")
.run(context -> {
Supplier<Flux<Message<String>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
@@ -146,16 +150,19 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE))
.isEqualTo(MediaType.TEXT_PLAIN);
})
.expectTimeout(Duration.ofMillis(1000))
.thenCancel()
.verify(Duration.ofSeconds(30));
});
}
@Test
@SuppressWarnings("unchecked")
void supplierForListSortedByFilenameDesc() {
defaultApplicationContextRunner
.withPropertyValues("sftp.supplier.listOnly=true", "sftp.supplier.sortBy.attribute=filename", "sftp.supplier.sortBy.dir=desc")
.withPropertyValues("sftp.supplier.listOnly=true",
"sftp.supplier.sortBy.attribute=filename",
"sftp.supplier.sortBy.dir=desc")
.run(context -> {
Supplier<Flux<Message<String>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
@@ -177,21 +184,21 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE))
.isEqualTo(MediaType.TEXT_PLAIN);
})
.expectTimeout(Duration.ofMillis(1000))
.thenCancel()
.verify(Duration.ofSeconds(30));
});
}
@Test
@SuppressWarnings("unchecked")
void supplierForFileRef() {
defaultApplicationContextRunner
.withPropertyValues(
"sftp.supplier.localDir=" + getTargetLocalDirectory().getAbsolutePath(),
"file.consumer.mode=ref")
.run(context -> {
Supplier<Flux<Message<File>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
Supplier<Flux<Message<File>>> sftpSupplier = context.getBean("sftpSupplier", Supplier.class);
SftpSupplierProperties properties = context.getBean(SftpSupplierProperties.class);
MetadataStore metadataStore = context.getBean(MetadataStore.class);
HashSet<String> fileNames = new HashSet<>();
@@ -219,14 +226,14 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
}
@Test
@SuppressWarnings("unchecked")
void deleteRemoteFiles() {
defaultApplicationContextRunner
.withPropertyValues(
"sftp.supplier.stream=true",
"sftp.supplier.delete-remote-files=true")
.run(context -> {
Supplier<Flux<Message<byte[]>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
Supplier<Flux<Message<byte[]>>> sftpSupplier = context.getBean("sftpSupplier", Supplier.class);
StepVerifier.create(sftpSupplier.get())
.expectNextMatches(message -> message.getPayload().length > 0)
.expectNextMatches(message -> message.getPayload().length > 0)
@@ -258,9 +265,9 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
.run(this::doTestRenameRemoteFiles);
}
@SuppressWarnings("unchecked")
private void doTestRenameRemoteFiles(AssertableApplicationContext context) {
Supplier<Flux<Message<byte[]>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
Supplier<Flux<Message<byte[]>>> sftpSupplier = context.getBean("sftpSupplier", Supplier.class);
final Set<String> expectedTargetFiles = Arrays.stream(getSourceRemoteDirectory().list())
.collect(Collectors.toSet());
@@ -274,11 +281,12 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
.until(() ->
expectedTargetFiles.equals(
Arrays.stream(getTargetRemoteDirectory().list())
.collect(Collectors.toSet()))
.collect(Collectors.toSet()))
);
}
@Test
@SuppressWarnings("unchecked")
public void streamSourceFilesInLineMode() {
defaultApplicationContextRunner
.withPropertyValues(
@@ -291,8 +299,7 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
"file.consumer.with-markers=true",
"file.consumer.markers-json=true")
.run(context -> {
Supplier<Flux<Message<String>>> sftpSupplier = context.getBean("sftpSupplier",
Supplier.class);
Supplier<Flux<Message<String>>> sftpSupplier = context.getBean("sftpSupplier", Supplier.class);
StepVerifier.create(sftpSupplier.get())
.assertNext(message -> {
final Object evaluate;
@@ -321,6 +328,7 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
}
@Test
@SuppressWarnings("unchecked")
void supplierWithMultiSourceAndStreamContentsSource3ComesSecond() throws Exception {
Path newSource = createNewRemoteSource(
Paths.get(remoteTemporaryFolder.toString(), "sftpSecondSource", "doesNotMatter.txt"),
@@ -372,6 +380,7 @@ public class SftpSupplierApplicationTests extends SftpTestSupport {
}
@Test
@SuppressWarnings("unchecked")
void supplierMultiSourceRefTestsFor200Alex() throws Exception {
Path newSource = createNewRemoteSource(
Paths.get(remoteTemporaryFolder.toString(), "sftpSecondSource", "sftpSource3.txt"),

View File

@@ -5,8 +5,7 @@ ext {
dependencies {
api project(':twitter-common')
api 'org.springframework.integration:spring-integration-jms'
providedImplementation 'jakarta.jms:jakarta.jms-api'
api 'jakarta.jms:jakarta.jms-api'
testImplementation "org.mock-server:mockserver-netty:$mockserverVersion"
testImplementation "org.mock-server:mockserver-client-java:$mockserverVersion"