use of io.github.resilience4j.fallback.FallbackDecorators in project resilience4j by resilience4j.
the class SpringBootCommonTest method testCircuitBreakerCommonConfig.
@Test
public void testCircuitBreakerCommonConfig() {
CircuitBreakerConfig circuitBreakerConfig = new CircuitBreakerConfig(new CircuitBreakerConfigurationProperties());
assertThat(circuitBreakerConfig.reactorCircuitBreakerAspect()).isNotNull();
assertThat(circuitBreakerConfig.rxJava2CircuitBreakerAspect()).isNotNull();
assertThat(circuitBreakerConfig.circuitBreakerRegistry(new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.singletonList(new TestCustomizer())))).isNotNull();
final DefaultSpelResolver spelResolver = new DefaultSpelResolver(new SpelExpressionParser(), new StandardReflectionParameterNameDiscoverer(), new GenericApplicationContext());
final FallbackDecorators fallbackDecorators = new FallbackDecorators(Collections.singletonList(new CompletionStageFallbackDecorator()));
assertThat(circuitBreakerConfig.circuitBreakerAspect(CircuitBreakerRegistry.ofDefaults(), Collections.emptyList(), new FallbackExecutor(spelResolver, fallbackDecorators), spelResolver)).isNotNull();
assertThat(circuitBreakerConfig.circuitBreakerRegistryEventConsumer(Optional.empty())).isNotNull();
}
use of io.github.resilience4j.fallback.FallbackDecorators in project resilience4j by resilience4j.
the class SpringBootCommonTest method testBulkHeadCommonConfig.
@Test
public void testBulkHeadCommonConfig() {
BulkheadConfigurationOnMissingBean bulkheadConfigurationOnMissingBean = new BulkheadConfigurationOnMissingBean();
assertThat(bulkheadConfigurationOnMissingBean.bulkheadRegistry(new BulkheadConfigurationProperties(), new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.singletonList(BulkheadConfigCustomizer.of("backend", builder -> builder.maxConcurrentCalls(10)))))).isNotNull();
assertThat(bulkheadConfigurationOnMissingBean.threadPoolBulkheadRegistry(new ThreadPoolBulkheadConfigurationProperties(), new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.singletonList(ThreadPoolBulkheadConfigCustomizer.of("backend", builder -> builder.coreThreadPoolSize(10)))))).isNotNull();
assertThat(bulkheadConfigurationOnMissingBean.reactorBulkHeadAspectExt()).isNotNull();
assertThat(bulkheadConfigurationOnMissingBean.rxJava2BulkHeadAspectExt()).isNotNull();
final DefaultSpelResolver spelResolver = new DefaultSpelResolver(new SpelExpressionParser(), new StandardReflectionParameterNameDiscoverer(), new GenericApplicationContext());
final FallbackDecorators fallbackDecorators = new FallbackDecorators(Collections.singletonList(new CompletionStageFallbackDecorator()));
assertThat(bulkheadConfigurationOnMissingBean.bulkheadAspect(new BulkheadConfigurationProperties(), ThreadPoolBulkheadRegistry.ofDefaults(), BulkheadRegistry.ofDefaults(), Collections.emptyList(), new FallbackExecutor(spelResolver, fallbackDecorators), spelResolver)).isNotNull();
assertThat(bulkheadConfigurationOnMissingBean.bulkheadRegistryEventConsumer(Optional.empty())).isNotNull();
}
use of io.github.resilience4j.fallback.FallbackDecorators in project resilience4j by resilience4j.
the class SpringBootCommonTest method testTimeLimiterCommonConfig.
@Test
public void testTimeLimiterCommonConfig() {
TimeLimiterConfigurationOnMissingBean timeLimiterConfigurationOnMissingBean = new TimeLimiterConfigurationOnMissingBean();
assertThat(timeLimiterConfigurationOnMissingBean.reactorTimeLimiterAspectExt()).isNotNull();
assertThat(timeLimiterConfigurationOnMissingBean.rxJava2TimeLimiterAspectExt()).isNotNull();
assertThat(timeLimiterConfigurationOnMissingBean.timeLimiterRegistry(new TimeLimiterConfigurationProperties(), new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.singletonList(TimeLimiterConfigCustomizer.of("backend", builder -> builder.timeoutDuration(Duration.ofSeconds(10))))))).isNotNull();
final DefaultSpelResolver spelResolver = new DefaultSpelResolver(new SpelExpressionParser(), new StandardReflectionParameterNameDiscoverer(), new GenericApplicationContext());
final FallbackDecorators fallbackDecorators = new FallbackDecorators(Arrays.asList(new CompletionStageFallbackDecorator()));
assertThat(timeLimiterConfigurationOnMissingBean.timeLimiterAspect(new TimeLimiterConfigurationProperties(), TimeLimiterRegistry.ofDefaults(), Collections.emptyList(), new FallbackExecutor(spelResolver, fallbackDecorators), spelResolver, null)).isNotNull();
assertThat(timeLimiterConfigurationOnMissingBean.timeLimiterRegistryEventConsumer(Optional.empty())).isNotNull();
}
use of io.github.resilience4j.fallback.FallbackDecorators in project resilience4j by resilience4j.
the class SpringBootCommonTest method testRetryCommonConfig.
@Test
public void testRetryCommonConfig() {
RetryConfigurationOnMissingBean retryConfigurationOnMissingBean = new RetryConfigurationOnMissingBean();
assertThat(retryConfigurationOnMissingBean.reactorRetryAspectExt()).isNotNull();
assertThat(retryConfigurationOnMissingBean.rxJava2RetryAspectExt()).isNotNull();
assertThat(retryConfigurationOnMissingBean.retryRegistry(new RetryConfigurationProperties(), new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.emptyList()))).isNotNull();
final DefaultSpelResolver spelResolver = new DefaultSpelResolver(new SpelExpressionParser(), new StandardReflectionParameterNameDiscoverer(), new GenericApplicationContext());
final FallbackDecorators fallbackDecorators = new FallbackDecorators(Collections.singletonList(new CompletionStageFallbackDecorator()));
assertThat(retryConfigurationOnMissingBean.retryAspect(new RetryConfigurationProperties(), RetryRegistry.ofDefaults(), Collections.emptyList(), new FallbackExecutor(spelResolver, fallbackDecorators), spelResolver, null)).isNotNull();
assertThat(retryConfigurationOnMissingBean.retryRegistryEventConsumer(Optional.empty())).isNotNull();
}
use of io.github.resilience4j.fallback.FallbackDecorators in project resilience4j by resilience4j.
the class SpringBootCommonTest method testRateLimiterCommonConfig.
@Test
public void testRateLimiterCommonConfig() {
RateLimiterConfigurationOnMissingBean rateLimiterConfigurationOnMissingBean = new RateLimiterConfigurationOnMissingBean();
assertThat(rateLimiterConfigurationOnMissingBean.reactorRateLimiterAspectExt()).isNotNull();
assertThat(rateLimiterConfigurationOnMissingBean.rxJava2RateLimiterAspectExt()).isNotNull();
assertThat(rateLimiterConfigurationOnMissingBean.rateLimiterRegistry(new RateLimiterConfigurationProperties(), new DefaultEventConsumerRegistry<>(), new CompositeRegistryEventConsumer<>(Collections.emptyList()), new CompositeCustomizer<>(Collections.emptyList()))).isNotNull();
final FallbackDecorators fallbackDecorators = new FallbackDecorators(Arrays.asList(new CompletionStageFallbackDecorator()));
final DefaultSpelResolver spelResolver = new DefaultSpelResolver(new SpelExpressionParser(), new StandardReflectionParameterNameDiscoverer(), new GenericApplicationContext());
assertThat(rateLimiterConfigurationOnMissingBean.rateLimiterAspect(new RateLimiterConfigurationProperties(), RateLimiterRegistry.ofDefaults(), Collections.emptyList(), new FallbackExecutor(spelResolver, fallbackDecorators), spelResolver)).isNotNull();
assertThat(rateLimiterConfigurationOnMissingBean.rateLimiterRegistryEventConsumer(Optional.empty())).isNotNull();
}
Aggregations