Add a with-fixtures helper for running tests in fixtures

Unfortunately, fixture execution is normally tied to `deftest`. Because
`deftest` can't be given a dynamic variable name, it can't really be
used in a loop to test multiple pieces of code that do the same thing.
`with-fixtures` is a new macro which separates invoking fixtures from
`deftest`. Any code inside a call to `with-fixtures` will be surrounded
by the fixtures for the current namespace.
Remove unused tag validation

This should have been removed when we stopped storing classes and tags.
Since we aren't storing them, we needn't validate them.
Add a v2 of 'replace catalog' command that doesn't accept classes/tags

This version is also stricter about which fields are present, failing if
there are any keys missing or any extra keys supplied. There is also a
refactor of catalog parsing included, which replaces
`parse-from-json-string` and `parse-from-json-obj` with a multimethod
`parse-catalog` that can handle parsing from a string, or from version 1
and version 2 wire formats. The result will be a transformed and
validated catalog in version 2 of the PuppetDB format, regardless of the
input.

The 'replace catalog' v2 handler is identical to the v1 handler, and the
actual work has been extracted to `replace-catalog*` (and probably needs
somewhere better to live in the future). The only difference between the
two command processors is the version of input they take, though they
actually both handle it the same, by passing it to `parse-catalog`,
which always results in the same format.
Use version 2 of 'replace catalog' command in the catalog terminus
Allow command payloads to be embedded objects

Previously these were required to be JSON stringified, and would be
automatically serialized by our command helpers. Now, the serialization
must be done by the producer if it's wanted, and the command is free to
choose whether its payload ought to be an object or the string
representation of that object.

For correct backward compatibility, 'replace catalog' v1 now explicitly
requires that its payload be a string. The v2 of the command allows
either a string *or* an object. Other commands are unchanged.
Document the 'replace catalog' v2 command+format
Use non-string form of payload for replace catalog in terminus

This means commands need to stringify their own payloads. Rough times.
Use the correct set of keys when submitting catalogs

Also corrected the documentation of what the wire format actually looks
like.
Restore the missing "replace catalog" log message

This was accidentally lost during a refactor.
(#14763) Regexp operator support

This patchset introduces a new `~` operator into our query language that
will perform a regexp search. The operator works against:

* fact names
* fact values
* node names
* resource metadata (type/title/sourcefile/sourceline/etc)
* resource tags

The code introduces 2 new multimethods: `sql-regexp-match` and
`sql-regexp-array-match`. Each is specialized to work for both
PostgreSQL and HSQLDB.

Note that it's not currently possible to do regexp searches against
parameter values, as those are currently stored as serialized JSON
values (because puppet can hand us strings, hashes, arrays, whatever).

Signed-off-by: Deepak Giridharagopal <deepak@puppetlabs.com>
Configure embedded broker with KahaDB recovery opts

The broker can automatically recover from corrupted journal files, but
only if a few additional options are enabled:

http://activemq.apache.org/kahadb.html

This patchset changes the broker defaults to supply the correct recovery
options.

Signed-off-by: Deepak Giridharagopal <deepak@puppetlabs.com>
Add update-server URL to check-for-updates error message

I was running into an issue where, when my server was starting up,
it was failing to connect to the server on `check-for-updates`.
The error message that showed up in the logs wasn't entirely
intuitive; adding the URL to it makes it at least a bit more clear.
Additional KahaDB recovery options

After further discussion and research, it seems prudent to archive
corrupt journal files on startup (instead of aborting startup, or simply
deleting them). As those are binary files, there's not much that's
recoverable by end-users anyway.

Signed-off-by: Deepak Giridharagopal <deepak@puppetlabs.com>
Merge pull request #341 from cprice-puppet/maint/master/add-url-to-error-message

Add update-server URL to check-for-updates error message
Use default facts operator matching for "~"

Signed-off-by: Deepak Giridharagopal <deepak@puppetlabs.com>
Add a few more regexp test cases

I lifted the heinous regexp from clj-semver as an exemplar "worst case"
kind of test. It involves capturing groups, non-capturing groups,
predefined character classes, custom character classes, character
literals, multiple greedy quantifiers, and probably some Chemical X.

Signed-off-by: Deepak Giridharagopal <deepak@puppetlabs.com>
Merge branch 'master' into no-more-classes-and-tags
Merge pull request #340 from grimradical/kaha_recovery_opts

Configure embedded broker with KahaDB recovery opts
Merge pull request #333 from nicklewis/no-more-classes-and-tags

Add a v2 replace catalog command which doesn't take classes or tags
Merge pull request #338 from grimradical/14763_regexp_support

(#14763) Regexp operator support