Testable Java EE 7 Maven Archetype, using Arquillian (Tech Tip #34)

There is a Maven archetype to create Java EE 7 application:

It generates a simple “pom.xml” with Java EE 7 API <dependency>. It does the job to get started with building the application. But how do you test this app ?

Of course, you write unit and integration tests. But how do you run these tests, especially in a container-independent manner ?

That’s where Arquillian comes in!

Arquillian guides explain how to write real tests, but you still need to figure out Maven dependencies, create profiles, figure out container dependencies, and more. That’s still too much work :)

Meet a new Maven archetype that generates a Java EE 7 app, with profiles pre-configured for WildFly and GlassFish.

The four profiles are:

  1. wildfly-remote-arquillian
  2. wildfly-managed-arquillian
  3. glassfish-remote-arquillian
  4. glassfish-embedded-arquillian

The first profile is the most natural to start with. It requires to download WildFly 8.1, unzip and start using ./bin/standalone.sh. Then you can run the test as:

to see the result as:

This is useful if tests need to be executed multiple times on the same WildFly instance.

The second profile is the easiest to start with, and does not require any manual downloading. Using the profile downloads WildFly (8.0.0 at this time) to Maven repository, installs it in the “target” directory, starts the server, deploys the WAR file, runs the test, and stops the server.

“glassfish-remote-arquillian” profile is like “wildfly-remote-arquillian” where an instance of GlassFish is started externally and tests are run in the usual manner. This profile does not work at this moment because of ARQ-1596.

“glassfish-embedded-arquillian” is like “wildfly-managed-arquillian” where GlassFish container is downloaded transparently using the Maven dependencies, starts the container, deploys the app, runs the test, and stops the container.

Archetype source code is at: github.com/javaee-samples/javaee7-archetypes/tree/master/javaee7-archetype and the archetype is published at search.maven.org/#search%7Cga%7C1%7Cjavaee7-arquillian-archetype.

Many thanks to @aslakknutsen for publishing this archetype!

A complete working sample can be checked out from github.com/arun-gupta/wildfly-samples/tree/master/arquillian.

Let us know if you find this useful and how would you use it.

Be Sociable, Share!
  • Tweet

14 thoughts on “Testable Java EE 7 Maven Archetype, using Arquillian (Tech Tip #34)

  1. You can saving any documents and any files,it is very simple to recent documents windows 10,now read more about,just click here this site save documents windows 10 get all possible solution,and share this information to all web users.

  2. As I became more established, and well, more discouraged, my affection for perusing tumbled to the wayside. I enjoyed perusing more than really overcoming a book. Various occasions, I’d get more current dream stories and attempt to get into them, however simply was totally unfit. I wound up getting And Then There Were None, something definitely not the same as the science fiction Do My Essay of my childhood, and discovered that despite everything I had that adoration for perusing, however my taste had changed without me regularly knowing.

  3. I gave heaps of individuals my number in school on the main day. This is ordinary, companion making conduct and Do My Homework. Responsibility for number doesn’t compare to a dating commencement. You need to really start the dating part, no implications. damn

  4. On different occasions, I will get more current dream stories and try to enter them, but it is totally unsuitable. However, my taste has changed, no I often know https://www.mypaperwriter.co.uk/.

  5. java is an interesting subject , i am new learner in the field of development. such programming language i enjoy & to create some thing new is always fun full. Experts DO My Assignment

  6. Want to give your kids the best of the best? Well you are at the right place. Our versatile toys collection enables you to choose from a diverse option for your children. Teddy bears, Dinosaurs, arts and crafts, 2 wheeled scooters, board games and what not. Out collection will make your kid the happiest kid on the planet.

  7. The simplest method to begin with Arquillian is to consolidate it into the test suite of an undertaking manufacture that offers reliance administration. Today, the most broadly utilized form instrument in this class is Apache Maven. Supernatural Lucifer Jacket

  8. You discussed really valid and good points in your post and It really happened some person do not have the right idea. But with your awesome tips, one can easily identify it.

  9. Programming language you have used in this article is making it more informative. whole article is quite technical for the new learners. I work for jackets 7 coats brand

  10. Much obliged for the useful post and I don’t see this channel any longer as it is pointless. It powers to play the rehashes of this icon know how bunches of times. Celeb Jacket

  11. Want to give your kids the best of the best? Well you are at the right place. Our versatile toys collection enables you to choose from a diverse option for your children.
    End Reviews

  12. I am grateful to you for sharing this knowledgeable blog. The blog provides complete information about the changes prevailing in the market of a Java application development company.

Leave a Reply

Your email address will not be published. Required fields are marked *