GH-368: Update AWS code to the latest deps (#378)
Fixes https://github.com/spring-cloud/stream-applications/issues/368
* Upgrade to `spring-cloud-aws-2.4.2`; fix respective package changes
* Remove `AutoConfigurationExclusionEnvironmentPostProcessor` since classes in the SC-AWS
are not considered as auto-configuration anymore.
Instead, add an explicit `@Import` into `AmazonS3Configuration`.
Not sure, though, why it was excluded before at all
* Fix `MetadataStoreAutoConfigurationTests` with the current state of code.
Looks like before it was designed for auto-configuration based on classpath content
* Re-enable other AWS S3 tests
This fix has helped to spot a bug in Spring Integration Testing framework:
e2d8eeb04d
Co-authored-by: Chris Bono <cbono@vmware.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
<properties>
|
||||
<spring-integration-aws.version>2.5.2</spring-integration-aws.version>
|
||||
<spring-cloud-aws.version>2.2.6.RELEASE</spring-cloud-aws.version>
|
||||
<spring-cloud-aws.version>2.4.2</spring-cloud-aws.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -25,7 +25,7 @@
|
||||
<version>${spring-integration-aws.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<groupId>io.awspring.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-aws</artifactId>
|
||||
<version>${spring-cloud-aws.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,15 +22,25 @@ import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cloud.aws.context.annotation.ConditionalOnMissingAmazonClient;
|
||||
import org.springframework.cloud.aws.core.region.RegionProvider;
|
||||
|
||||
import io.awspring.cloud.autoconfigure.context.ContextCredentialsAutoConfiguration;
|
||||
import io.awspring.cloud.autoconfigure.context.ContextRegionProviderAutoConfiguration;
|
||||
import io.awspring.cloud.context.annotation.ConditionalOnMissingAmazonClient;
|
||||
import io.awspring.cloud.context.config.annotation.ContextDefaultConfigurationRegistrar;
|
||||
import io.awspring.cloud.core.region.RegionProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnMissingAmazonClient(AmazonS3.class)
|
||||
@Import({
|
||||
ContextCredentialsAutoConfiguration.class,
|
||||
ContextDefaultConfigurationRegistrar.class,
|
||||
ContextRegionProviderAutoConfiguration.class
|
||||
})
|
||||
public class AmazonS3Configuration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,56 +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.common.aws.s3;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.cloud.aws.autoconfigure.context.ContextInstanceDataAutoConfiguration;
|
||||
import org.springframework.cloud.aws.autoconfigure.context.ContextResourceLoaderAutoConfiguration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Timo Salm
|
||||
* @author David Turanski
|
||||
*/
|
||||
@Order
|
||||
public class AutoConfigurationExclusionEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
|
||||
static final String SPRING_AUTOCONFIGURE_EXCLUDE_PROPERTY = "spring.autoconfigure.exclude";
|
||||
|
||||
static final String S_3_COMMON_ENDPOINT_URL = "s3.common.endpoint-url";
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
|
||||
final PropertySource<?> propertySource = environment.getPropertySources()
|
||||
.get(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME);
|
||||
if (propertySource instanceof MapPropertySource) {
|
||||
String excludedAutoConfiguration = ContextResourceLoaderAutoConfiguration.class.getCanonicalName();
|
||||
//If an endpoint url is set, avoid the timeout attempting to connect to AWS to retrieve instance data.
|
||||
if (StringUtils.hasText(environment.getProperty(S_3_COMMON_ENDPOINT_URL))) {
|
||||
excludedAutoConfiguration = excludedAutoConfiguration
|
||||
.concat("," + ContextInstanceDataAutoConfiguration.class.getCanonicalName());
|
||||
}
|
||||
((MapPropertySource) propertySource).getSource().put(SPRING_AUTOCONFIGURE_EXCLUDE_PROPERTY,
|
||||
excludedAutoConfiguration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.aws.core.region.RegionProvider;
|
||||
import io.awspring.cloud.core.region.RegionProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.integration.aws.support.S3SessionFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
/**
|
||||
* @author Timo Salm
|
||||
* @author David Turanski
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(AmazonS3Properties.class)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
org.springframework.cloud.fn.common.aws.s3.AutoConfigurationExclusionEnvironmentPostProcessor
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 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.
|
||||
@@ -26,8 +26,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.context.annotation.UserConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.aws.core.region.RegionProvider;
|
||||
import org.springframework.cloud.aws.core.region.StaticRegionProvider;
|
||||
import io.awspring.cloud.core.region.RegionProvider;
|
||||
import io.awspring.cloud.core.region.StaticRegionProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,48 +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.common.aws.s3;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
import static org.springframework.cloud.fn.common.aws.s3.AutoConfigurationExclusionEnvironmentPostProcessor
|
||||
.SPRING_AUTOCONFIGURE_EXCLUDE_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author Timo Salm
|
||||
*/
|
||||
class AutoConfigurationExclusionEnvironmentPostProcessorTests {
|
||||
|
||||
@Test
|
||||
public void addsConfigurationPropertyToExcludeAmazonS3AutoConfiguration() {
|
||||
final ConfigurableApplicationContext context = new SpringApplicationBuilder()
|
||||
.sources(AutoConfigurationExclusionEnvironmentPostProcessor.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.build()
|
||||
.run();
|
||||
|
||||
final ConfigurableEnvironment environment = context.getEnvironment();
|
||||
Assertions.assertEquals(
|
||||
"org.springframework.cloud.aws.autoconfigure.context.ContextResourceLoaderAutoConfiguration",
|
||||
environment.getProperty(SPRING_AUTOCONFIGURE_EXCLUDE_PROPERTY));
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,9 @@
|
||||
<description>metadata-store common</description>
|
||||
|
||||
<properties>
|
||||
<aws-java-sdk.version>1.11.951</aws-java-sdk.version>
|
||||
<spring-integration-aws.version>2.5.0</spring-integration-aws.version>
|
||||
<aws-java-sdk.version>1.12.322</aws-java-sdk.version>
|
||||
<spring-integration-aws.version>2.5.2</spring-integration-aws.version>
|
||||
<spring-integration-hazelcast.version>3.0.0</spring-integration-hazelcast.version>
|
||||
<curator.version>5.3.0</curator.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.cloud.fn.common.metadata.store;
|
||||
|
||||
import java.beans.Introspector;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -28,10 +27,8 @@ import com.amazonaws.services.dynamodbv2.model.DescribeTableRequest;
|
||||
import com.amazonaws.services.dynamodbv2.model.DescribeTableResult;
|
||||
import io.awspring.cloud.core.region.RegionProvider;
|
||||
import org.apache.curator.test.TestingServer;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -57,14 +54,13 @@ import static org.mockito.Mockito.mock;
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Corneil du Plessis
|
||||
*
|
||||
* @since 2.0.2
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@Ignore
|
||||
public class MetadataStoreAutoConfigurationTests {
|
||||
|
||||
private final static List<Class<? extends ConcurrentMetadataStore>> METADATA_STORE_CLASSES =
|
||||
Arrays.asList(
|
||||
List.of(
|
||||
RedisMetadataStore.class,
|
||||
MongoDbMetadataStore.class,
|
||||
JdbcMetadataStore.class,
|
||||
@@ -73,15 +69,30 @@ public class MetadataStoreAutoConfigurationTests {
|
||||
DynamoDbMetadataStore.class,
|
||||
SimpleMetadataStore.class
|
||||
);
|
||||
private final ApplicationContextRunner contextRunner;
|
||||
private final Class<? extends ConcurrentMetadataStore> classToInclude;
|
||||
|
||||
public MetadataStoreAutoConfigurationTests(Class<? extends ConcurrentMetadataStore> classToInclude) {
|
||||
this.classToInclude = classToInclude;
|
||||
this.contextRunner =
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
public void testMetadataStore(Class<? extends ConcurrentMetadataStore> classToInclude) {
|
||||
ApplicationContextRunner contextRunner =
|
||||
new ApplicationContextRunner()
|
||||
.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("metadata.store.type=" +
|
||||
classToInclude.getSimpleName()
|
||||
.replaceFirst("MetadataStore", "")
|
||||
.toLowerCase()
|
||||
.replaceFirst("simple", "memory"))
|
||||
.withClassLoader(filteredClassLoaderBut(classToInclude));
|
||||
contextRunner
|
||||
.run(context -> {
|
||||
assertThat(context.getBeansOfType(MetadataStore.class)).hasSize(1);
|
||||
|
||||
assertThat(context.getBeanNamesForType(classToInclude))
|
||||
.containsOnlyOnce(Introspector.decapitalize(classToInclude.getSimpleName()));
|
||||
});
|
||||
}
|
||||
|
||||
static List<Class<? extends ConcurrentMetadataStore>> testMetadataStore() {
|
||||
return METADATA_STORE_CLASSES;
|
||||
}
|
||||
|
||||
private static FilteredClassLoader filteredClassLoaderBut(Class<? extends ConcurrentMetadataStore> classToInclude) {
|
||||
@@ -91,22 +102,6 @@ public class MetadataStoreAutoConfigurationTests {
|
||||
.toArray(Class<?>[]::new));
|
||||
}
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Iterable<?> parameters() {
|
||||
return METADATA_STORE_CLASSES;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetadataStore() {
|
||||
this.contextRunner
|
||||
.run(context -> {
|
||||
assertThat(context.getBeansOfType(MetadataStore.class)).hasSize(1);
|
||||
|
||||
assertThat(context.getBeanNamesForType(this.classToInclude))
|
||||
.containsOnlyOnce(Introspector.decapitalize(this.classToInclude.getSimpleName()));
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
public static class TestConfiguration {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2022 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.
|
||||
@@ -30,6 +30,7 @@ import com.amazonaws.services.s3.model.PutObjectResult;
|
||||
import com.amazonaws.services.s3.model.SetObjectAclRequest;
|
||||
import com.amazonaws.services.s3.transfer.PersistableTransfer;
|
||||
import com.amazonaws.services.s3.transfer.internal.S3ProgressListener;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
@@ -144,5 +145,7 @@ public abstract class AbstractAwsS3ConsumerMockTests {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,6 @@ import com.amazonaws.services.s3.model.PutObjectRequest;
|
||||
import com.amazonaws.services.s3.model.SetObjectAclRequest;
|
||||
import com.amazonaws.services.s3.transfer.internal.S3ProgressPublisher;
|
||||
import com.amazonaws.util.Md5Utils;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
@@ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@Disabled
|
||||
@TestPropertySource(properties = "s3.consumer.acl=PublicReadWrite")
|
||||
public class AmazonS3UploadFileTests extends AbstractAwsS3ConsumerMockTests {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,7 +23,6 @@ import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||
import com.amazonaws.services.s3.model.PutObjectRequest;
|
||||
import com.amazonaws.util.Md5Utils;
|
||||
import com.amazonaws.util.StringInputStream;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
@@ -37,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@Disabled
|
||||
@TestPropertySource(properties = "s3.consumer.key-expression=headers.key")
|
||||
public class AmazonS3UploadInputStreamTests extends AbstractAwsS3ConsumerMockTests {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.integration.aws.support.filters.S3PersistentAcceptOnc
|
||||
import org.springframework.integration.aws.support.filters.S3RegexPatternFileListFilter;
|
||||
import org.springframework.integration.aws.support.filters.S3SimplePatternFileListFilter;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.dsl.IntegrationFlows;
|
||||
import org.springframework.integration.dsl.IntegrationFlow;
|
||||
import org.springframework.integration.endpoint.ReactiveMessageSourceProducer;
|
||||
import org.springframework.integration.file.filters.ChainFileListFilter;
|
||||
import org.springframework.integration.metadata.ConcurrentMetadataStore;
|
||||
@@ -59,7 +59,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties({ AwsS3SupplierProperties.class, FileConsumerProperties.class })
|
||||
public abstract class AwsS3SupplierConfiguration {
|
||||
public class AwsS3SupplierConfiguration {
|
||||
|
||||
protected static final String METADATA_STORE_PREFIX = "s3-metadata-";
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class AwsS3SupplierConfiguration {
|
||||
@Bean
|
||||
public Publisher<Message<Object>> s3SupplierFlow(MessageSource<?> s3MessageSource) {
|
||||
return FileUtils.enhanceFlowForReadingMode(
|
||||
IntegrationFlows.from(IntegrationReactiveUtils.messageSourceToFlux(s3MessageSource)),
|
||||
IntegrationFlow.from(IntegrationReactiveUtils.messageSourceToFlux(s3MessageSource)),
|
||||
fileConsumerProperties)
|
||||
.toReactivePublisher(true);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public abstract class AwsS3SupplierConfiguration {
|
||||
|
||||
@Bean
|
||||
public Publisher<Message<Object>> s3SupplierFlow(ReactiveMessageSourceProducer s3ListingProducer) {
|
||||
return IntegrationFlows.from(s3ListingProducer).split().toReactivePublisher(true);
|
||||
return IntegrationFlow.from(s3ListingProducer).split().toReactivePublisher(true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -59,7 +59,8 @@ import static org.mockito.Mockito.mock;
|
||||
"cloud.aws.credentials.secretKey=" + AbstractAwsS3SupplierMockTests.AWS_SECRET_KEY,
|
||||
"cloud.aws.region.static=" + AbstractAwsS3SupplierMockTests.AWS_REGION,
|
||||
"s3.common.endpointUrl=foo",
|
||||
"s3.supplier.remoteDir=" + AbstractAwsS3SupplierMockTests.S3_BUCKET})
|
||||
"s3.supplier.remoteDir=" + AbstractAwsS3SupplierMockTests.S3_BUCKET
|
||||
})
|
||||
@DirtiesContext
|
||||
@SpringIntegrationTest(noAutoStartup = "*")
|
||||
public abstract class AbstractAwsS3SupplierMockTests {
|
||||
@@ -158,5 +159,7 @@ public abstract class AbstractAwsS3SupplierMockTests {
|
||||
}
|
||||
return amazonS3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.springframework.cloud.fn.supplier.s3;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.test.StepVerifier;
|
||||
@@ -28,7 +28,6 @@ import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Disabled
|
||||
@TestPropertySource(properties = {"file.consumer.mode=ref",
|
||||
"s3.supplier.filenameRegex=.*\\\\.test$"})
|
||||
public class AmazonS3FilesTransferredTests extends AbstractAwsS3SupplierMockTests {
|
||||
@@ -50,7 +49,7 @@ public class AmazonS3FilesTransferredTests extends AbstractAwsS3SupplierMockTest
|
||||
.thenCancel()
|
||||
.verifyLater();
|
||||
standardIntegrationFlow.start();
|
||||
stepVerifier.verify();
|
||||
stepVerifier.verify(Duration.ofSeconds(10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.springframework.cloud.fn.supplier.s3;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.test.StepVerifier;
|
||||
@@ -29,7 +29,6 @@ import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Disabled
|
||||
@TestPropertySource(properties = {
|
||||
"file.consumer.mode=lines",
|
||||
"s3.supplier.filenamePattern=otherFile",
|
||||
@@ -37,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class AmazonS3LinesTransferredTests extends AbstractAwsS3SupplierMockTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
public void test() {
|
||||
final Flux<Message<?>> messageFlux = s3Supplier.get();
|
||||
StepVerifier stepVerifier =
|
||||
StepVerifier.create(messageFlux)
|
||||
@@ -54,7 +53,7 @@ public class AmazonS3LinesTransferredTests extends AbstractAwsS3SupplierMockTest
|
||||
.thenCancel()
|
||||
.verifyLater();
|
||||
standardIntegrationFlow.start();
|
||||
stepVerifier.verify();
|
||||
stepVerifier.verify(Duration.ofSeconds(10));
|
||||
|
||||
assertThat(this.awsS3SupplierProperties.getLocalDir().list().length).isEqualTo(1);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.time.Duration;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.test.StepVerifier;
|
||||
@@ -30,7 +29,6 @@ import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Disabled
|
||||
@TestPropertySource(properties = {
|
||||
"s3.supplier.list-only=true"
|
||||
})
|
||||
@@ -47,25 +45,25 @@ public class AmazonS3ListOnlyTests extends AbstractAwsS3SupplierMockTests {
|
||||
.assertNext(message -> {
|
||||
S3ObjectSummary summary = (S3ObjectSummary) message.getPayload();
|
||||
assertThat(summary.getBucketName()).isEqualTo(S3_BUCKET);
|
||||
assertThat(keys.contains(summary.getKey()));
|
||||
assertThat(keys).contains(summary.getKey());
|
||||
keys.remove(summary.getKey());
|
||||
})
|
||||
.assertNext(message -> {
|
||||
S3ObjectSummary summary = (S3ObjectSummary) message.getPayload();
|
||||
assertThat(summary.getBucketName()).isEqualTo(S3_BUCKET);
|
||||
assertThat(keys.contains(summary.getKey()));
|
||||
assertThat(keys).contains(summary.getKey());
|
||||
keys.remove(summary.getKey());
|
||||
})
|
||||
.assertNext(message -> {
|
||||
S3ObjectSummary summary = (S3ObjectSummary) message.getPayload();
|
||||
assertThat(summary.getBucketName()).isEqualTo(S3_BUCKET);
|
||||
assertThat(keys.contains(summary.getKey()));
|
||||
assertThat(keys).contains(summary.getKey());
|
||||
keys.remove(summary.getKey());
|
||||
})
|
||||
.expectTimeout(Duration.ofSeconds(1))
|
||||
.thenCancel()
|
||||
.verifyLater();
|
||||
standardIntegrationFlow.start();
|
||||
stepVerifier.verify(Duration.ofSeconds(10));
|
||||
standardIntegrationFlow.stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user