-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36104 from Ladicek/fix-duplicate-circuit-breaker-…
…name-detection Fix duplicate circuit breaker name detection
- Loading branch information
Showing
11 changed files
with
73 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/inheritance/CircuitBreakerService1.java → ...nce/duplicate/CircuitBreakerService1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/inheritance/CircuitBreakerService2.java → ...nce/duplicate/CircuitBreakerService2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ance/DuplicateCircuitBreakerNameTest.java → ...cate/DuplicateCircuitBreakerNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...te/CircuitBreakerNameInheritanceTest.java → ...ce/CircuitBreakerNameInheritanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/duplicate/SubCircuitBreakerService.java → ...inheritance/SubCircuitBreakerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...duplicate/SuperCircuitBreakerService.java → ...heritance/SuperCircuitBreakerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ye/faulttolerance/test/circuitbreaker/maintenance/noduplicate/CircuitBreakerService1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.smallrye.faulttolerance.test.circuitbreaker.maintenance.noduplicate; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import org.eclipse.microprofile.faulttolerance.CircuitBreaker; | ||
|
||
import io.smallrye.faulttolerance.api.CircuitBreakerName; | ||
|
||
@Singleton | ||
public class CircuitBreakerService1 { | ||
@CircuitBreaker | ||
@CircuitBreakerName("hello") | ||
public String hello() { | ||
return "1"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ye/faulttolerance/test/circuitbreaker/maintenance/noduplicate/CircuitBreakerService2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.smallrye.faulttolerance.test.circuitbreaker.maintenance.noduplicate; | ||
|
||
import org.eclipse.microprofile.faulttolerance.CircuitBreaker; | ||
|
||
import io.smallrye.faulttolerance.api.CircuitBreakerName; | ||
|
||
public class CircuitBreakerService2 { | ||
// this class is not a bean, so there's no circuit breaker and hence no duplicate circuit breaker name | ||
@CircuitBreaker | ||
@CircuitBreakerName("hello") | ||
public String hello() { | ||
return "2"; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...erance/test/circuitbreaker/maintenance/noduplicate/NoDuplicateCircuitBreakerNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.quarkus.smallrye.faulttolerance.test.circuitbreaker.maintenance.noduplicate; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.faulttolerance.api.CircuitBreakerMaintenance; | ||
import io.smallrye.faulttolerance.api.CircuitBreakerState; | ||
|
||
public class NoDuplicateCircuitBreakerNameTest { | ||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(CircuitBreakerService1.class, CircuitBreakerService2.class)); | ||
|
||
@Inject | ||
CircuitBreakerMaintenance cb; | ||
|
||
@Test | ||
public void deploysWithoutError() { | ||
assertNotNull(cb); | ||
assertEquals(CircuitBreakerState.CLOSED, cb.currentState("hello")); | ||
} | ||
} |