Fix nsswitch plugin unit-tests

The nsswitch gPlazma plugin uses JNA to access some native functions
common to various BSD-like OSes (including GNU/Linux).  It implements
the identity-, map- and session- gPlazma plugin functionality.  The
identity- and map- functionality is based on username <--> uid,
group-name <--> gid and a user's group-membership.  The session
functionality provides hard-coded behaviour (which might be better
factored out as a separate plugin).

There are several problems with the current nsswitch unit-tests:

  1. The unit-tests depend on JNA.  Not all JVMs support JNA, so can
     cause problems, especially since JNA relies on a native library,
     which is not available for all OSes.

  2. The unit-tests depend on OS/native functions.  Not all OSes
     support these functions.  While this prevents such OSes from
     using the nsswitch plugin for deployed dCache instances, it
     should not prevent developers from using such OSes.

  3. The unit-tests depend on system configuration.  While most
     Unix-like systems have a user "root" with uid 0 and primary gid
     0; other users and groups are not standardised --- even gid 0 can
     have different group-name ("root" or "wheel")

  4. The existing tests cover only part of the identity functionality.
     The tests do not cover group--gid identity-reverse-mapping, all
     map and session functionality.

This patch addresses these issues by fully mocking the JNA-backed
classes.  That way, the unit-tests are completely isolated from JNA,
the underlying OS and its configuration.  This allows a complete
coverage of the nsswitch plugin's functionality in a portable fashion.

It turns out that mocking the JNA-based classes that nsswitch plugin
uses is particularly tricky as these Java classes inherit from system
classes that make use of static initialisers and make JNI calls from
the constructor.  Mockito-mocked classes solve points 2. to 4., but
will still require a valid JNA, so point 1. is still a problem.

To solve point 1., this patch adds the PowerMock framework.  This is
an extension to mockito that adds support for the byte-code
manipulation needed to avoid static initializer and suppress
superclass constructors.  The nsswitch unit-tests are still written
using junit and mockito; however, in addition, PowerMock is used as
required.  Note that all existing unit-tests continue to function as
normal and the extra PowerMock functionality is only invoked when the
@RunWith(PowerMockRunner.class) annotation is specified.

The existing nsswitch tests are rewritten as BDD tests and additional
tests are added.  Fluent classes and utility methods are used make the
tests as readable as possible, at the risk of somewhat obfuscating
what is actually going on.

Target: master
Requires-notes: no
Requires-book: no
Patch: http://rb.dcache.org/r/5688/
Acked-by: Gerd Behrmann