@Test void registerAmazonWebserviceClient_withCustomRegionAndRegionProviderConfigured_reportsError() throws Exception { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); beanFactory.registerSingleton( AmazonWebserviceClientConfigurationUtils.CREDENTIALS_PROVIDER_BEAN_NAME, new StaticAwsCredentialsProvider()); assertThatThrownBy(() -> AmazonWebserviceClientConfigurationUtils .registerAmazonWebserviceClient(new Object(), beanFactory, AmazonTestWebserviceClient.class.getName(), "someProvider", Regions.EU_WEST_1.getName())) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining( "Only region or regionProvider can be configured, but not both"); }
public static BeanDefinitionHolder registerAmazonWebserviceClient(Object source, BeanDefinitionRegistry registry, String serviceNameClassName, String customRegionProvider, String customRegion) { String beanName = getBeanName(serviceNameClassName); if (registry.containsBeanDefinition(beanName)) { return new BeanDefinitionHolder(registry.getBeanDefinition(beanName), beanName); } BeanDefinition definition = getAmazonWebserviceClientBeanDefinition(source, serviceNameClassName, customRegionProvider, customRegion, registry); BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, beanName); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); return holder; }
AmazonWebserviceClientConfigurationUtils { public static BeanDefinitionHolder registerAmazonWebserviceClient(Object source, BeanDefinitionRegistry registry, String serviceNameClassName, String customRegionProvider, String customRegion) { String beanName = getBeanName(serviceNameClassName); if (registry.containsBeanDefinition(beanName)) { return new BeanDefinitionHolder(registry.getBeanDefinition(beanName), beanName); } BeanDefinition definition = getAmazonWebserviceClientBeanDefinition(source, serviceNameClassName, customRegionProvider, customRegion, registry); BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, beanName); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); return holder; } }
AmazonWebserviceClientConfigurationUtils { public static BeanDefinitionHolder registerAmazonWebserviceClient(Object source, BeanDefinitionRegistry registry, String serviceNameClassName, String customRegionProvider, String customRegion) { String beanName = getBeanName(serviceNameClassName); if (registry.containsBeanDefinition(beanName)) { return new BeanDefinitionHolder(registry.getBeanDefinition(beanName), beanName); } BeanDefinition definition = getAmazonWebserviceClientBeanDefinition(source, serviceNameClassName, customRegionProvider, customRegion, registry); BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, beanName); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); return holder; } private  AmazonWebserviceClientConfigurationUtils(); }
AmazonWebserviceClientConfigurationUtils { public static BeanDefinitionHolder registerAmazonWebserviceClient(Object source, BeanDefinitionRegistry registry, String serviceNameClassName, String customRegionProvider, String customRegion) { String beanName = getBeanName(serviceNameClassName); if (registry.containsBeanDefinition(beanName)) { return new BeanDefinitionHolder(registry.getBeanDefinition(beanName), beanName); } BeanDefinition definition = getAmazonWebserviceClientBeanDefinition(source, serviceNameClassName, customRegionProvider, customRegion, registry); BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, beanName); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); return holder; } private  AmazonWebserviceClientConfigurationUtils(); static BeanDefinitionHolder registerAmazonWebserviceClient(Object source,
			BeanDefinitionRegistry registry, String serviceNameClassName,
			String customRegionProvider, String customRegion); static AbstractBeanDefinition getAmazonWebserviceClientBeanDefinition(
			Object source, String serviceNameClassName, String customRegionProvider,
			String customRegion, BeanDefinitionRegistry beanDefinitionRegistry); static String getBeanName(String serviceClassName); static String getRegionProviderBeanName(
			BeanDefinitionRegistry beanDefinitionRegistry); static void replaceDefaultRegionProvider(BeanDefinitionRegistry registry,
			String customGlobalRegionProvider); static void replaceDefaultCredentialsProvider(BeanDefinitionRegistry registry,
			String customGlobalCredentialsProvider); }
AmazonWebserviceClientConfigurationUtils { public static BeanDefinitionHolder registerAmazonWebserviceClient(Object source, BeanDefinitionRegistry registry, String serviceNameClassName, String customRegionProvider, String customRegion) { String beanName = getBeanName(serviceNameClassName); if (registry.containsBeanDefinition(beanName)) { return new BeanDefinitionHolder(registry.getBeanDefinition(beanName), beanName); } BeanDefinition definition = getAmazonWebserviceClientBeanDefinition(source, serviceNameClassName, customRegionProvider, customRegion, registry); BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, beanName); BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry); return holder; } private  AmazonWebserviceClientConfigurationUtils(); static BeanDefinitionHolder registerAmazonWebserviceClient(Object source,
			BeanDefinitionRegistry registry, String serviceNameClassName,
			String customRegionProvider, String customRegion); static AbstractBeanDefinition getAmazonWebserviceClientBeanDefinition(
			Object source, String serviceNameClassName, String customRegionProvider,
			String customRegion, BeanDefinitionRegistry beanDefinitionRegistry); static String getBeanName(String serviceClassName); static String getRegionProviderBeanName(
			BeanDefinitionRegistry beanDefinitionRegistry); static void replaceDefaultRegionProvider(BeanDefinitionRegistry registry,
			String customGlobalRegionProvider); static void replaceDefaultCredentialsProvider(BeanDefinitionRegistry registry,
			String customGlobalCredentialsProvider); static final String REGION_PROVIDER_BEAN_NAME; static final String CREDENTIALS_PROVIDER_BEAN_NAME; }