Fixed issue with doseq over deftests in the events tests
(PDB-454) - Added environment support for querying reports, events, event-counts and aggregate-event-counts

This commit has the last set of environment query API changes. Reports and events
both allowing environment in the query criteria and return environments in the result.
Event counts and aggregate event counts allow events in the query criteria.
Merge pull request #914 from senior/ticket/master/pdb-454-events-query-with-environments

(PDB-454) - Added environment support for querying reports, events, event-counts and aggregate-event-counts
PDB-521: Switch to using /dev/urandom

This was discussed on IRC a while ago and a agreed upon. The rationale
for wanting this is explained in: https://tickets.puppetlabs.com/browse/PDB-521
(PDB-574) 404 should be returned when querying for a missing catalog

Previously a schema validation error was being thrown (returning a 500).
Now 404 is returned with an error message indicating it could not find
the catalog.
(PDB-526) Garbage collect unreferenced environments

This patch adds a new step for garbage-collect! which removes any environments
that are no longer referenced by reports, facts or catalogs.

It also changes the order that garbage-collect! runs compared to the other
db related cleanup tasks. This is so that unreferenced environments are
cleaned up immediately after nodes and reports are purged, as apposed to
having to wait for the next scheduled internal.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #917 from daenney/dev-urandom

PDB-521: Switch to using /dev/urandom
Merge pull request #918 from senior/ticket/master/pdb-574-404-when-catalog-not-found

(PDB-574) 404 should be returned when querying for a missing catalog
Merge pull request #919 from kbarber/ticket/master/pdb-526-cleanup-old-envs

(PDB-526) Garbage collect unreferenced environments
(PDB-457) - Update import/export/anonymization for v4 API

This involves adding supporting the new wire formats (with environments) and
adding anonymization for environments. This commit also adds full stack testing
of PuppetDB from within Clojure.
Merge pull request #916 from senior/ticket/master/pdb-457-import-export-environments

(PDB-457) - Update import/export/anonymization for v4 API
fix storeconfig export for array values

For exported Resources with parameters which value is a Array the storeconfig export fails to collect them. Instead of collecting all the parameter values into a array it simply override the value with each value in turn.
Added tests around exporting storeconfigs with resources containing
arrays for param values.

Also added activerecord and sqlite to the Gemfile (currently the
storeconfigs tests are not running because those dependencies are missing).
Merge pull request #920 from senior/ticket/1.6.x/pdb-518-storeconfigs-export-arrays

(PDB-518) Fixing storeconfig exports containing arrays
Only pull in activerecord and sqlite3 on new versions of Ruby (1.9.3). This will cause
the storeconfigs spec tests to only run on newer Rubies.
Merge pull request #921 from senior/maint/1.6.x/storeconfigs-tests-only-on-ruby-193

Only pull in activerecord and sqlite3 on new versions of Ruby (1.9.3)
Changed the storeconfig acceptance tests to verify import by querying

Previously the test was comparing a store config export tarball (v3 wire format)
with a regular export tarball (v4 wire format) which caused the tests to break
Merge pull request #923 from senior/maint/master/storeconfig-acceptance-test-fix

Changed the storeconfig acceptance tests to verify import by querying
(PDB-581) Add subqueries to events query endpoint
(PDB-581) Add tests and minor cleanups for event subqueries

This patch augments Dalen's patch by adding tests. For symmetry I've rolled up
the v3 & v4 version of the events test into one.

I've also moved some of the functions in query/events.clj into query.clj to
match the other related code for facts, resources and nodes.

Signed-off-by: Ken Barber <ken@bob.sh>