-
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.
ArC client proxies - prioritize delegating methods impl. on superclasses
- resolves #17755
- Loading branch information
Showing
7 changed files
with
87 additions
and
15 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
25 changes: 25 additions & 0 deletions
25
.../arc/test/clientproxy/delegatingmethods/ClientProxyMethodInvocationInConstructorTest.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,25 @@ | ||
package io.quarkus.arc.test.clientproxy.delegatingmethods; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.arc.ClientProxy; | ||
import io.quarkus.arc.test.ArcTestContainer; | ||
import java.io.IOException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
public class ClientProxyMethodInvocationInConstructorTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = new ArcTestContainer(MyBean.class, Component.class, HasElement.class, HasSize.class); | ||
|
||
@Test | ||
public void testClientProxy() throws IOException { | ||
// Just test that the client proxy can be instantiated | ||
MyBean myBean = Arc.container().instance(MyBean.class).get(); | ||
assertTrue(myBean instanceof ClientProxy); | ||
assertEquals("an element", myBean.getElement().toString()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.../arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/delegatingmethods/Component.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.clientproxy.delegatingmethods; | ||
|
||
public class Component implements HasElement { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public Object getElement() { | ||
return "an element"; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/delegatingmethods/HasElement.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,10 @@ | ||
package io.quarkus.arc.test.clientproxy.delegatingmethods; | ||
|
||
import java.io.Serializable; | ||
|
||
@FunctionalInterface | ||
public interface HasElement extends Serializable { | ||
|
||
Object getElement(); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
...ts/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/delegatingmethods/HasSize.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,8 @@ | ||
package io.quarkus.arc.test.clientproxy.delegatingmethods; | ||
|
||
public interface HasSize extends HasElement { | ||
|
||
default void setSize(String size) { | ||
getElement(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...cts/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/delegatingmethods/MyBean.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.arc.test.clientproxy.delegatingmethods; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class MyBean extends Component implements HasSize { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public MyBean() { | ||
setSize("5px"); | ||
} | ||
|
||
} |