-
-
Notifications
You must be signed in to change notification settings - Fork 44
EAR: add a profile for provisioning the server #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9ada4c3 to
184c500
Compare
|
@WolfgangHG If you want to provision the WildFly server with Maven in the archetype, you can streamline the integration tests:
|
|
@jmesnil Thanks for the suggestion to move the test classes to "ear/src/test", I will give it a try the next few days. But I am not sure whether we can remove the shrinkwrap EAR creation, as we have to enrich the deployed archive with the server side test classes. |
|
@jmesnil I tried to add test classes to "ear/src/test". But this will not work with Eclipse, probably as Eclipse does not support the java nature in ear projects - the nature is not added by default when M2E imports the exiting maven project. And the root project does not seem to support java classes either. So I tried to move the arquillian tests to a separate module/project as suggested here by @jfdenise, and made some progress. I will update this pull request the next few days. |
|
I added a module "integration-tests" to the EAR archetype and moved the arquillian test to this project. This simplifies building the test deployment as you don't have to build the ear yourself by adding the ejb jar and web war output of the sub modules. We can now pick the ear file that was built by maven and just add the test classes to the web module. Now, the "arq-provisioned" profile can be executed in one single step, without having to run an extra profile "provision" before. As the arquillian build now created a provisioned server without the deployment, I added a profile "provision" that is used to provision a server including the deployment. I configured both profiles so that the provisioned server is placed in different directories (using the "provisioningDir" parameter). If you run the profile "provision" and then execute "arq-provisioned" without "mvn clean", it would otherwise probably reuse a server that contains the deployment, and deploying the test ear file would fail. What do you think? |
8f2c28a to
6f6a8a6
Compare
wildfly-jakartaee-ear-archetype/src/main/resources-filtered/archetype-resources/pom.xml
Outdated
Show resolved
Hide resolved
|
|
||
| <dependencies> | ||
|
|
||
| <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you mention JBoss EAP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the text from the other profiles. "JBoss EAP" is there since the first version of the archetype (JBoss 7) ;-). I can remove them all if you consider this reasonable.
...fly-jakartaee-ear-archetype/src/main/resources/archetype-resources/integration-tests/pom.xml
Show resolved
Hide resolved
|
I updated the documentation of the ear archetype and thus remove the "draft" state. |
|
A question to the reviewers: Previously, both the EJB and web project contained a file "arquillian.xml", though the sample test was in the web project. The file in the ejb module existed since the beginning of the archetype, with the argument that here also arquillian tests were possible. As part of the changes of this pull request, I moved "arquillian.xml" and the test class from the web project to the new module "integration_tests". But the ejb project still contains "arquillian.xml" (link to original file: https://github.com/wildfly/wildfly-archetypes/blob/main/wildfly-jakartaee-ear-archetype/src/main/resources/archetype-resources/ejb/src/test/resources/arquillian.xml). Do you think this still makes sense? At least arquillian tests which create a deployment would no longer work in the "arq_provisioned" profile, as the provisioned server is created later during the ear project built. What do you think? |
9494be9 to
e715216
Compare
|
After latest rebase, build failed due to the JBoss repository not being available. Had to do a |
e715216 to
6989be6
Compare
6989be6 to
fad867a
Compare
fad867a to
1783538
Compare
995e765 to
4e4b3dd
Compare
…etype for new integration test project
ca8becb to
72e7d56
Compare
Part three to resolve #145: I added two profiles "provisioning" and "arq-provisioned" to the ear archetype. The first builds the project and provisions a server (without running tests), the second profile runs the arquillian tests using this server.
So the tests have to be invoked like this:
The problem here is that the integration tests of the webapp project are executed before the server is provisioned. So they could not be run using the provisioned server.
There was a dicussion between @jfdenise and me. @jfdenise suggested a bigger change (see #145 (comment)) to separate the tests from the deployment code.
In this pull request, I picked a simpler approach - running the tests on the provisioned server requires two maven runs.
What do you think?
I will mark this request as "draft", as several readmes must be fixed before it is merged. Just wanted to avoid this work in case you prefer the approach suggested by @jfdenise
The provisioning profile required a change to the way the arquillian test deployment is created, see explanation in the webapp archetype.