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#30001 from Sgitario/29885
Fix AbstractMethodError when injecting generated resource
- Loading branch information
Showing
16 changed files
with
307 additions
and
2 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
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
17 changes: 17 additions & 0 deletions
17
...quarkus/hibernate/orm/rest/data/panache/deployment/AbstractInjectResourcesMethodTest.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,17 @@ | ||
package io.quarkus.hibernate.orm.rest.data.panache.deployment; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.contains; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public abstract class AbstractInjectResourcesMethodTest { | ||
|
||
@Test | ||
void shouldGetListOfItems() { | ||
given().accept("application/json") | ||
.when().get("/call/resource/items") | ||
.then().statusCode(200) | ||
.and().body("id", contains(1, 2)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
.../java/io/quarkus/hibernate/orm/rest/data/panache/deployment/entity/InjectionResource.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,26 @@ | ||
package io.quarkus.hibernate.orm.rest.data.panache.deployment.entity; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.quarkus.panache.common.Page; | ||
import io.quarkus.panache.common.Sort; | ||
|
||
@Path("/call/resource") | ||
public class InjectionResource { | ||
|
||
@Inject | ||
ItemsResource itemsResource; | ||
|
||
@GET | ||
@Path("/items") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<Item> items() { | ||
return itemsResource.list(new Page(5), Sort.by("id")); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...m/rest/data/panache/deployment/entity/PanacheEntityResourceInjectResourcesMethodTest.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,19 @@ | ||
package io.quarkus.hibernate.orm.rest.data.panache.deployment.entity; | ||
|
||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.hibernate.orm.panache.PanacheEntity; | ||
import io.quarkus.hibernate.orm.panache.PanacheEntityBase; | ||
import io.quarkus.hibernate.orm.rest.data.panache.deployment.AbstractInjectResourcesMethodTest; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
class PanacheEntityResourceInjectResourcesMethodTest extends AbstractInjectResourcesMethodTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(PanacheEntityBase.class, PanacheEntity.class, Collection.class, CollectionsResource.class, | ||
AbstractEntity.class, AbstractItem.class, Item.class, ItemsResource.class, InjectionResource.class) | ||
.addAsResource("application.properties") | ||
.addAsResource("import.sql")); | ||
} |
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
17 changes: 17 additions & 0 deletions
17
...us/hibernate/reactive/rest/data/panache/deployment/AbstractInjectResourcesMethodTest.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,17 @@ | ||
package io.quarkus.hibernate.reactive.rest.data.panache.deployment; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.contains; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public abstract class AbstractInjectResourcesMethodTest { | ||
|
||
@Test | ||
void shouldGetListOfItems() { | ||
given().accept("application/json") | ||
.when().get("/call/resource/items") | ||
.then().statusCode(200) | ||
.and().body("id", contains(1, 2)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../io/quarkus/hibernate/reactive/rest/data/panache/deployment/entity/InjectionResource.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,27 @@ | ||
package io.quarkus.hibernate.reactive.rest.data.panache.deployment.entity; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.quarkus.panache.common.Page; | ||
import io.quarkus.panache.common.Sort; | ||
import io.smallrye.mutiny.Uni; | ||
|
||
@Path("/call/resource") | ||
public class InjectionResource { | ||
|
||
@Inject | ||
ItemsResource itemsResource; | ||
|
||
@GET | ||
@Path("/items") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public Uni<List<Item>> items() { | ||
return itemsResource.list(new Page(5), Sort.by("id")); | ||
} | ||
} |
Oops, something went wrong.