forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
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 quarkusio#18558 from mkouba/issue-18538
ArC - fix ordering of multiple decorators with the same priority
- Loading branch information
Showing
8 changed files
with
72 additions
and
14 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
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
22 changes: 22 additions & 0 deletions
22
...ts/src/test/java/io/quarkus/arc/test/decorators/priority/AlsoAlphaConverterDecorator.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,22 @@ | ||
package io.quarkus.arc.test.decorators.priority; | ||
|
||
import javax.annotation.Priority; | ||
import javax.decorator.Decorator; | ||
import javax.decorator.Delegate; | ||
import javax.inject.Inject; | ||
|
||
@Priority(20) | ||
@Decorator | ||
class AlsoAlphaConverterDecorator implements Converter<String> { | ||
|
||
@Inject | ||
@Delegate | ||
Converter<String> delegate; | ||
|
||
@Override | ||
public String convert(String value) { | ||
// skip first char | ||
return delegate.convert(value).substring(1); | ||
} | ||
|
||
} |
1 change: 0 additions & 1 deletion
1
.../tests/src/test/java/io/quarkus/arc/test/decorators/priority/BravoConverterDecorator.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
7 changes: 7 additions & 0 deletions
7
...t-projects/arc/tests/src/test/java/io/quarkus/arc/test/decorators/priority/Converter.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,7 @@ | ||
package io.quarkus.arc.test.decorators.priority; | ||
|
||
interface Converter<T> { | ||
|
||
T convert(T value); | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...test/java/io/quarkus/arc/test/decorators/priority/MultipleDecoratorsSamePriorityTest.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,33 @@ | ||
package io.quarkus.arc.test.decorators.priority; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.arc.test.ArcTestContainer; | ||
import javax.enterprise.context.ApplicationScoped; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
public class MultipleDecoratorsSamePriorityTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = new ArcTestContainer(Converter.class, ToUpperCaseConverter.class, | ||
AlphaConverterDecorator.class, AlsoAlphaConverterDecorator.class); | ||
|
||
@Test | ||
public void testDecoration() { | ||
ToUpperCaseConverter converter = Arc.container().instance(ToUpperCaseConverter.class).get(); | ||
assertEquals("J", converter.convert("hej")); | ||
} | ||
|
||
@ApplicationScoped | ||
static class ToUpperCaseConverter implements Converter<String> { | ||
|
||
@Override | ||
public String convert(String value) { | ||
return value.toUpperCase(); | ||
} | ||
|
||
} | ||
|
||
} |
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