Comments (4)
hi @scottkurz, I'm not quite clear on what you're referring to as an "application from some other package"?
Do you mean that you have a resource class like com.foo.StarterResource
and the JAX-RS Application
class is from a different package like org.bar.MyApplication
?
from microshed-testing.
hi @scottkurz, I'm not quite clear on what you're referring to as an "application from some other package"?
Do you mean that you have a resource class like
com.foo.StarterResource
and the JAX-RSApplication
class is from a different package likeorg.bar.MyApplication
?
That's right. I was referring to the introspection done by RestClientBuilder.locateApplicationPath()
from microshed-testing.
Ok, I understand the scenario now thanks. A few questions now:
- What packages were being used in your case?
- Did you get a clear error message when this didn't work? Or did it take a while to figure out that the package scanning wasn't working?
Currently a heuristic is used where the first 3 packages of the resource class will be scanned.
So suppose you had com.foo.app.fourth.fifth.sixth.MyResource
. We would scan for an Application
in the com.foo.app.*
package domain. I chose this because usually the first 3 packages are in the format <COM|ORG|etc>.<COMPANY_NAME>.<PROJECT_NAME>
. Would relaxing this a bit to the first 2 packages (i.e. scan com.foo.*
) solve the problem in your case?
Ultimately the auto-package scanning is a heuristic, so currently the backup way is to use RestClientBuilder
. Would it be helpful if we added an optional applicationPath
attribute to the @RESTClient
annotation? Using the original example you could do something like:
@RESTClient(applicationPath = "/api") // since @ApplicationPath cannot be auto-detected from pkg scanning
public static StarterResource appService;
or, we could roll the entire path into a single (more generic) annotation attribute:
@RESTClient(path = "/api/starter")
public static StarterResource appService;
from microshed-testing.
I would say the error msg was reasonably clear. It didn't completely jump out at me but wasn't hard to see looking over it a couple times:
2822 DEBUG org.microshed.testing.jupiter.MicroShedTestExtension - Regsitered JSONB ObjectMapper for REST Assured
2841 DEBUG org.microshed.testing.jaxrs.RestClientBuilder - no classes implementing Application found in pkg: dev.odo.sample
2841 INFO org.microshed.testing.jaxrs.RestClientBuilder - No classes implementing 'javax.ws.rs.core.Application' found on classpath to set as context root for class dev.odo.sample.SampleResource. Defaulting context root to '/'
2939 INFO org.microshed.testing.jaxrs.RestClientBuilder - Building rest client for class dev.odo.sample.SampleResource with base path: http://asi3-5fbcf8d6b8-t28d9:9080/ and providers: [class org.microshed.testing.jaxrs.JsonBProvider]
3311 DEBUG org.microshed.testing.jupiter.MicroShedTestExtension - Injected rest client for public static dev.odo.sample.SampleResource dev.odo.sample.EndpointIT.appService
3332 INFO dev.odo.sample.EndpointIT - In test method: testAppResponse
[INFO] [WARNING ] SRVE0190E: File not found: /resource
My use case has the Application "pre-generated" from the application stack starter (at https://github.com/OpenLiberty/application-stack-starters). This is kind of primitive compared to many starters since the package name isn't customizable. So I always get dev.odo.starter.StarterApplication as my Application but I might want to develop my resources in another package name, e.g. I use dev.odo.sample.SampleResource here.
I'm just looking for something simple-looking and transparent to use with the starter, for people to learn without frustration in simple, getting started apps. Just for this use case it doesn't seem worth engineering too complex a solution.
It seems like:
@RESTClient(applicationPath = "/api") // since @ApplicationPath cannot be auto-detected from pkg scanning
public static StarterResource appService;
could be a simple solution which in a simple sample would be easy to understand to see how the client/server paths align.
from microshed-testing.
Related Issues (20)
- Upgrade to Test Containers 1.15 HOT 4
- Microshed with quarkus 1.12.2-Final cant initialize PostgreSQLContainer HOT 1
- Sample application for Payara Microshed JWT (microshed-testing-jaxrs-mpjwt) is not working
- Tests all fail with mvn verify when there is an application tag in server.xml HOT 6
- [Quarkus] yaml configuration not supported
- Support Podman for container runtime HOT 1
- Building rest client fails with "java.lang.IllegalArgumentException: <FQCN> is not an interface." HOT 1
- Bump liberty adapter base image to support Java 11 or 17 HOT 4
- Support Jakarta namespace HOT 6
- Testing JWT endpoint with RESTassured HOT 1
- Is this resitory still active? HOT 2
- Release 0.9.2 [Proposal] HOT 11
- Update dependabot to non-preview version
- WithExposedPorts fails integrationtests HOT 1
- Create seperate Dockerfile for sample applications
- Get test space upload working for pushes to main branch only
- Update gradle wrapper to support future Java 17
- DCO step in CI removal HOT 2
- Local build on ARM fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microshed-testing.