Home

Awesome

Java EE 7 Samples

This workspace consists of Java EE 7 Samples and unit tests. They are categorized in different directories, one for each Technology/JSR.

Some samples/tests have documentation, otherwise read the code. The Java EE 7 Essentials book refers to most of these samples and provides an explanation. Feel free to add docs and send a pull request.

How to run?

Samples are tested on Payara, GlassFish, Wildfly and more using the Arquillian ecosystem.

A brief instruction how to clone, build, import and run the samples on your local machine @radcortez provides in this sample video https://www.youtube.com/watch?v=BB4b-Yz9cF0

Only one container profile can be active at a given time otherwise there will be dependency conflicts.

There are 16 available container profiles, for 6 different servers:

The containers that download and install a server (the *-ci-managed profiles) allow you to override the version used, e.g.:

To run them in the console do:

  1. In the terminal, mvn test -fae at the top-level directory to start the tests for the default profile.

When developing and runing them from IDE, remember to activate the profile before running the test.

To learn more about Arquillian please refer to the Arquillian Guides

To run only a subset of the tests do at the top-level directory:

  1. Install top level dependencies: mvn clean install -pl "test-utils,util" -am
  2. cd into desired module, e.g.: cd jaspic
  3. Run tests against desired server, e.g.: mvn clean test -P liberty-ci-managed

How to contribute

With your help we can improve this set of samples, learn from each other and grow the community full of passionate people who care about the technology, innovation and code quality. Every contribution matters!

There is just a bunch of things you should keep in mind before sending a pull request, so we can easily get all the new things incorporated into the master branch.

Standard tests are jUnit based - for example this commit. Test classes naming must comply with surefire naming standards **/*Test.java, **/*Test*.java or **/*TestCase.java.

For the sake of clarity and consistency, and to minimize the upfront complexity, we prefer standard jUnit tests using Java, with as additional helpers HtmlUnit, Hamcrest and of course Arquillian. Please don't use alternatives for these technologies. If any new dependency has to be introduced into this project it should provide something that's not covered by these existing dependencies.

Some coding principles

Small Git tips

That's it! Welcome in the community!

CI Job

CI jobs are executed by Travis. Note that by the very nature of the samples provided here it's perfectly normal that not all tests pass. This normally would indicate a bug in the server on which the samples are executed. If you think it's really the test that's faulty, then please submit an issue or provide a PR with a fix.

Run each sample in Docker