amedia/regurgitator — pull request #10 by nostra (2014-12-26 10:26:59+00:00)
Title: Mock client for regurgitator. Creating pull request for Jakob

**The following is from @lazee's mail:**

During the work on the new weather solution in Amedia I had a need for storing a set of mock responses in the Meteos project. Since I knew you already had done a lot of work on Regurgitator I wanted to test it out. And it did actually what I expected, except it didn’t have an easy way of reading stored mock files into my tests. Instead of writing something from scratch to solve this problem, I decided to add the support for this in Regurgitator directly.

Before I continue I will apologise for adding the branch directly to the project. I guess I should have forked the project and then send a pull request instead.

I didn’t plan this to be a lot of work, but as I moved on I felt I had to do things properly. Here is a list of what I have done. Hopefully this is something you think we could merge to master.

Changelist:

* Moved storage classes to regurgitator-storage module. I have removed the Dropwizard dependencies from this part of the code (Hint: Configuration).
* Introduced regurgitator-mock module for use in tests in other projects (Like my project Meteos). This has a dependency on regurgitator-storage, but not service. And this explains why I moved stuff to the storage module in the first place.
* Reformatted the code according to the new code format standard at Amedia. (I didn’t plan to do this in this branch, but since I made some refactorings this made sense in the end)
* Did some minor refactorings to make stuff easier to read. (Most importantly moved the dynamic storage class loading to a class of its own)
* Removed empty javadoc comments all over the code. I just hate them.
* Introduced a small run.sh script to make my life easier.

I also think we could remove the commons-io and commons-lang packages easily from the project. Since Java 7 I don’t think we need those packages for the current usage anymore.
My goal is to have as few dependencies in the mock-module as possible, to avoid dragging to much stuff into the projects using Regurgitator in their tests. But that can be done later.

Meteos is still in a very early phase, but you can take a look on how I’m using the regurgitator-mock module here : https://github.com/amedia/meteos/tree/master/meteos-service/src/test

Again, I hope you think this is a good idea and something we could merge into Master. I think having a mock client makes Regurgitator a way lot more useful as a way of both creating mock files AND actually use these files for something useful.

I’m looking forward to your thoughts on this