-
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 #43245 from Ladicek/arc-fix-fwk-class-using-app-de…
…corator ArC: fix the situation when a framework bean uses an application decorator
- Loading branch information
Showing
11 changed files
with
93 additions
and
6 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
49 changes: 49 additions & 0 deletions
49
...c/deployment/src/test/java/io/quarkus/arc/test/decorator/DecoratorOfExternalBeanTest.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,49 @@ | ||
package io.quarkus.arc.test.decorator; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.decorator.Decorator; | ||
import jakarta.decorator.Delegate; | ||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.test.supplement.SomeBeanInExternalLibrary; | ||
import io.quarkus.arc.test.supplement.SomeInterfaceInExternalLibrary; | ||
import io.quarkus.builder.Version; | ||
import io.quarkus.maven.dependency.Dependency; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class DecoratorOfExternalBeanTest { | ||
// the test includes an _application_ decorator (in the Runtime CL) that applies | ||
// to a bean that is _outside_ of the application (in the Base Runtime CL) | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(jar -> jar.addClass(MyDecorator.class)) | ||
// we need a non-application archive, so cannot use `withAdditionalDependency()` | ||
.setForcedDependencies(List.of(Dependency.of("io.quarkus", "quarkus-arc-test-supplement", Version.getVersion()))); | ||
|
||
@Inject | ||
SomeBeanInExternalLibrary bean; | ||
|
||
@Test | ||
public void test() { | ||
assertEquals("Delegated: Hello", bean.hello()); | ||
} | ||
|
||
@Decorator | ||
public static class MyDecorator implements SomeInterfaceInExternalLibrary { | ||
@Inject | ||
@Delegate | ||
SomeInterfaceInExternalLibrary delegate; | ||
|
||
@Override | ||
public String hello() { | ||
return "Delegated: " + delegate.hello(); | ||
} | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
...st-supplement/src/main/java/io/quarkus/arc/test/supplement/SomeBeanInExternalLibrary.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,11 @@ | ||
package io.quarkus.arc.test.supplement; | ||
|
||
import jakarta.enterprise.context.Dependent; | ||
|
||
@Dependent | ||
public class SomeBeanInExternalLibrary implements SomeInterfaceInExternalLibrary { | ||
@Override | ||
public String hello() { | ||
return "Hello"; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...pplement/src/main/java/io/quarkus/arc/test/supplement/SomeInterfaceInExternalLibrary.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,5 @@ | ||
package io.quarkus.arc.test.supplement; | ||
|
||
public interface SomeInterfaceInExternalLibrary { | ||
String hello(); | ||
} |
Empty file.
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
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