-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #5385 from stuartwdouglas/5326
Use Class.forName to prevent IllegalAccessError
- Loading branch information
Showing
9 changed files
with
130 additions
and
7 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...ns/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/BeanGenerationTest.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,32 @@ | ||
package io.quarkus.resteasy.test.cdi; | ||
|
||
import static io.restassured.RestAssured.when; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.resteasy.test.cdi.internal.PublicHello; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
/** | ||
* | ||
*/ | ||
public class BeanGenerationTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addPackage(PublicHello.class.getPackage()) | ||
.addClasses(Greeting.class, MorningGreeting.class, GreetingEndpoint.class)); | ||
|
||
@Test | ||
public void testInvocation() throws Exception { | ||
when().get("/cdi-greeting/greet") | ||
.then() | ||
.statusCode(200) | ||
.body(Matchers.is("Good Morning")); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/Greeting.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.resteasy.test.cdi; | ||
|
||
import io.quarkus.resteasy.test.cdi.internal.PublicHello; | ||
|
||
/** | ||
* | ||
*/ | ||
public class Greeting extends PublicHello { | ||
|
||
@Override | ||
public String greet() { | ||
return "Hello user"; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/GreetingEndpoint.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,21 @@ | ||
package io.quarkus.resteasy.test.cdi; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
|
||
/** | ||
* | ||
*/ | ||
@Path("/cdi-greeting") | ||
public class GreetingEndpoint { | ||
|
||
@Inject | ||
Greeting greeting; | ||
|
||
@GET | ||
@Path("/greet") | ||
public String greet() { | ||
return greeting.greet(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...sions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/MorningGreeting.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,15 @@ | ||
package io.quarkus.resteasy.test.cdi; | ||
|
||
import javax.enterprise.context.Dependent; | ||
|
||
/** | ||
* | ||
*/ | ||
@Dependent | ||
public class MorningGreeting extends Greeting { | ||
|
||
@Override | ||
public String greet() { | ||
return "Good Morning"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...nsions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/internal/Hello.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.resteasy.test.cdi.internal; | ||
|
||
/** | ||
* | ||
*/ | ||
class Hello { | ||
|
||
void noop() { | ||
System.out.println("Hello"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.../resteasy/deployment/src/test/java/io/quarkus/resteasy/test/cdi/internal/PublicHello.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.resteasy.test.cdi.internal; | ||
|
||
/** | ||
* | ||
*/ | ||
public class PublicHello extends Hello { | ||
|
||
public String greet() { | ||
return "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
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