Skip to content

Commit

Permalink
replace classInChaosMonkeyPackage calls with isBlackListedPointcut
Browse files Browse the repository at this point in the history
  • Loading branch information
F43nd1r committed Aug 13, 2021
1 parent 8baca6e commit 1a040fa
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ public void classInChaosMonkeyPackage() {}
public void nonFinalOrJdkProxiedClassPointcut() {}

// GenericFilterBean cannot be proxied due to final init method.
@Pointcut("this(org.springframework.web.filter.GenericFilterBean)")
@Pointcut("classInChaosMonkeyPackage() || target(org.springframework.web.filter.GenericFilterBean)")
public void isBlackListedPointcut() {}

@Pointcut(
"!isBlackListedPointcut() && nonFinalOrJdkProxiedClassPointcut() && execution(* *.*(..))")
@Pointcut("nonFinalOrJdkProxiedClassPointcut() && execution(* *.*(..))")
public void allPublicMethodPointcut() {}

@Pointcut(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SpringBootHealthIndicatorAspect extends ChaosMonkeyBaseAspect {
@Pointcut("execution(* org.springframework.boot.actuate.health.HealthIndicator.getHealth(..))")
public void getHealthPointCut() {}

@Around("getHealthPointCut() && !classInChaosMonkeyPackage()")
@Around("getHealthPointCut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {
Health health = (Health) pjp.proceed();
if (watcherProperties.isActuatorHealth()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void classInSpringCloudContextPackage() {}

@Around(
"classAnnotatedWithComponentPointcut() && !classInSpringCloudContextPackage() "
+ "&& allPublicMethodPointcut() && !classInChaosMonkeyPackage() && !springHooksPointcut()")
+ "&& allPublicMethodPointcut() && !isBlackListedPointcut() && !springHooksPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {
if (watcherProperties.isComponent()) {
log.debug("Watching public method on component class: {}", pjp.getSignature());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringControllerAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithControllerPointcut() {}

@Around(
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isController()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRepositoryAspectJDBC extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithRepositoryPointcut() {}

@Around(
"classAnnotatedWithRepositoryPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithRepositoryPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRepository()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRepositoryAspectJPA extends ChaosMonkeyBaseAspect {
"this(org.springframework.data.repository.Repository) || within(@org.springframework.data.repository.RepositoryDefinition *)")
public void implementsCrudRepository() {}

@Around("implementsCrudRepository() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
@Around("implementsCrudRepository() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRepository()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringRestControllerAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithControllerPointcut() {}

@Around(
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()")
"classAnnotatedWithControllerPointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

if (watcherProperties.isRestController()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SpringServiceAspect extends ChaosMonkeyBaseAspect {
public void classAnnotatedWithServicePointcut() {}

@Around(
"classAnnotatedWithServicePointcut() && allPublicMethodPointcut() && !classInChaosMonkeyPackage()"
"classAnnotatedWithServicePointcut() && allPublicMethodPointcut() && !isBlackListedPointcut()"
+ "&& !springHooksPointcut()")
public Object intercept(ProceedingJoinPoint pjp) throws Throwable {

Expand Down

0 comments on commit 1a040fa

Please sign in to comment.