rhq-project/rhq-metrics — pull request #78 by jsanda (2014-12-06 16:19:00+00:00)
Title: Simplify REST tests

There are two major changes in this PR. First, Arquillian is no longer used for deploying the WAR. Instead, the WildFly maven plugin is used in conjunction with the FailSafe plugin. I do not see any benefit to using Arquillian as it is only used for deployment. It adds complexity that can be avoided as demonstrated by these changes.

Secondly, tests are written in Groovy. Why Groovy? Let me first start with why **not** Java. Java tends to be verbose. Using libraries like Rest Assured which provide a fluent API help a lot, but there is still one other big problem. Dealing with JSON is still clumsy. Languages with native map (and list) syntax are much easier for dealing with JSON. It is easier to write code that is more concise and more self-documenting.

I chose Groovy in particular for a few reasons. Even if you are not familiar with it, transitioning to Groovy from Java is fairly easy as it provides probably the best interoperability with Java of any language that runs on the JVM. Secondly, Groovy is mature and has really solid tooling support. It has first class support in IntelliJ and from what I understand the Eclipse plugin(s) are very solid as well. It is easy to use with Maven. Lastly, it has fantastic JSON support. See [JsonSlurper](http://groovy-lang.org/json.html) for more details.

I have only ported one test class with this PR. If/when we decide to merge these changes I will port the other tests.