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.
ArC - producers - change the client proxy class package
- use the package of the return type/field type - previously, the package of the declaring class was used - resolves quarkusio#22815
- Loading branch information
Showing
9 changed files
with
155 additions
and
10 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...o/quarkus/arc/test/unproxyable/ProducerReturnTypePackagePrivateNoArgsConstructorTest.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,50 @@ | ||
package io.quarkus.arc.test.unproxyable; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Instance; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.test.unproxyable.some.Resource; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
// This test aims to test the https://github.com/quarkusio/quarkus/issues/22815 in Quarkus integration | ||
// There is a duplicate test for ArC standalone: io.quarkus.arc.test.clientproxy.constructor.ProducerReturnTypePackagePrivateNoArgsConstructorTest | ||
public class ProducerReturnTypePackagePrivateNoArgsConstructorTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root | ||
.addClasses(ProducerReturnTypePackagePrivateNoArgsConstructorTest.class, ResourceProducer.class, | ||
Resource.class)); | ||
|
||
@Inject | ||
Instance<Resource> instance; | ||
|
||
@Test | ||
public void testProducer() throws IOException { | ||
assertTrue(instance.isResolvable()); | ||
assertEquals(5, instance.get().ping()); | ||
} | ||
|
||
@Singleton | ||
static class ResourceProducer { | ||
|
||
@ApplicationScoped | ||
@Produces | ||
Resource resource() { | ||
return Resource.from(5); | ||
} | ||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/some/Resource.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,20 @@ | ||
package io.quarkus.arc.test.unproxyable.some; | ||
|
||
public abstract class Resource { | ||
|
||
Resource() { | ||
} | ||
|
||
public static Resource from(int ping) { | ||
return new Resource() { | ||
|
||
@Override | ||
public int ping() { | ||
return ping; | ||
} | ||
}; | ||
} | ||
|
||
public abstract int ping(); | ||
|
||
} |
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
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
44 changes: 44 additions & 0 deletions
44
...c/test/clientproxy/constructor/ProducerReturnTypePackagePrivateNoArgsConstructorTest.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,44 @@ | ||
package io.quarkus.arc.test.clientproxy.constructor; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
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 io.quarkus.arc.test.clientproxy.constructor.some.Resource; | ||
import java.io.IOException; | ||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Singleton; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
// This test aims to test the https://github.com/quarkusio/quarkus/issues/22815 in ArC standalone | ||
// There is a duplicate test for Quarkus integration: io.quarkus.arc.test.unproxyable.ProducerReturnTypePackagePrivateNoArgsConstructorTest | ||
public class ProducerReturnTypePackagePrivateNoArgsConstructorTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = new ArcTestContainer(ResourceProducer.class); | ||
|
||
@Test | ||
public void testProducer() throws IOException { | ||
Resource res = Arc.container().instance(Resource.class).get(); | ||
assertNotNull(res); | ||
assertTrue(res instanceof ClientProxy); | ||
assertEquals(5, res.ping()); | ||
} | ||
|
||
@Singleton | ||
static class ResourceProducer { | ||
|
||
@ApplicationScoped | ||
@Produces | ||
Resource resource() { | ||
return Resource.from(5); | ||
} | ||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...ts/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/some/Resource.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,20 @@ | ||
package io.quarkus.arc.test.clientproxy.constructor.some; | ||
|
||
public abstract class Resource { | ||
|
||
Resource() { | ||
} | ||
|
||
public static Resource from(int ping) { | ||
return new Resource() { | ||
|
||
@Override | ||
public int ping() { | ||
return ping; | ||
} | ||
}; | ||
} | ||
|
||
public abstract int ping(); | ||
|
||
} |