File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
redis/util/src/main/java/example/springdata/redis/test/condition Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 36
36
@ Retention (RetentionPolicy .RUNTIME )
37
37
@ Inherited
38
38
@ Documented
39
- @ ExtendWith (EnabledOnCommandCondition .class )
39
+ @ EnabledOnRedisAvailable
40
+ @ ExtendWith ({EnabledOnRedisAvailableCondition .class })
40
41
public @interface EnabledOnCommand {
41
42
42
43
String host () default "localhost" ;
Original file line number Diff line number Diff line change 36
36
*/
37
37
class EnabledOnCommandCondition implements ExecutionCondition {
38
38
39
+ EnabledOnRedisAvailableCondition redisAvailable = new EnabledOnRedisAvailableCondition ();
40
+
39
41
private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = enabled ("@EnabledOnCommand is not present" );
40
42
private static final ExtensionContext .Namespace NAMESPACE = ExtensionContext .Namespace .create (RedisConditions .class );
41
43
42
44
@ Override
43
45
public ConditionEvaluationResult evaluateExecutionCondition (ExtensionContext context ) {
44
46
47
+ if (redisAvailable .evaluateExecutionCondition (context ).isDisabled ()) {
48
+ return disabled ("Redis not available" );
49
+ }
50
+
45
51
var optional = AnnotationUtils .findAnnotation (context .getElement (), EnabledOnCommand .class );
46
52
47
53
if (!optional .isPresent ()) {
You can’t perform that action at this time.
0 commit comments