org.springframework.cloud.aws.autoconfigure.context.ContextCredentialsAutoConfiguration Java Examples

The following examples show how to use org.springframework.cloud.aws.autoconfigure.context.ContextCredentialsAutoConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonServicesAutoConfigurationTest.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Make sure when AWS configuration is involved it gives the right configuration.
 */
@Test
void testExpectedContextWithAws() {
    this.contextRunner
        .withPropertyValues(
            "cloud.aws.credentials.useDefaultAwsCredentialsChain=true",
            "cloud.aws.region.auto=false",
            "cloud.aws.region.static=us-east-1",
            "cloud.aws.stack.auto=false"
        )
        .withConfiguration(
            AutoConfigurations.of(
                ContextCredentialsAutoConfiguration.class,
                ContextRegionProviderAutoConfiguration.class,
                ContextResourceLoaderAutoConfiguration.class,
                AwsAutoConfiguration.class
            )
        )
        .run(
            (context) -> {
                Assertions.assertThat(context).hasSingleBean(FileSystemJobArchiverImpl.class);
                Assertions.assertThat(context).hasSingleBean(S3JobArchiverImpl.class);
                Assertions.assertThat(context).hasSingleBean(JobArchiveService.class);

                // TODO: Find a way to test the order
                Assertions
                    .assertThat(context)
                    .getBeans(JobArchiver.class)
                    .size()
                    .isEqualTo(2);
            }
        );
}