Add a class to encapsulate ImageJ 1.x instances

Often it is desirable to run ImageJ 1.x functionality in an encapsulated
way, e.g. to prevent race conditions between processes that should be
independent (and therefore should have independent ImageJ 1.x contexts,
something ImageJ 1.x does not provide).

This change adds a class that creates a new special-purpose class
loader, loads a patched ImageJ 1.x into it and then offers to run macros
or plugins inside that ImageJ instance.

Naturaly, multiple such legacy environments are guaranteed to be
encapsulated from each other.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a test for calling a fresh headless ImageJ 1.x

The legacy environment will hopefully be very useful for a lot of users.
Better make sure that it works as advertised.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move more tests from ij-legacy into ij1-patcher

All present tests that do not depend on ij-legacy should go into
ij1-patcher, of course, to guarantee that ij1-patcher's functionality
is maintained.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij1-patcher: aggregate test utility functions into the TestUtils class

This is needed because we want to move more tests from ij-legacy into
ij1-patcher (and that project is supposed not to depend on anything
except Javassist).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ExtraPluginDirsTest: use LegacyEnvironment

Better use the proposed solution ourselves...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move ExtraPluginDirsTest into ij1-patcher

It really tests only ij1-patcher functionality.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow to set the macro options in a LegacyEnvironment

When calling run() or runMacro(), one can specify the macro options as a
second parameter. However, when calling runPlugIn(), the second
parameter specifies the 'arg' parameter passed to the plugin's run() or
setup() method.

In this commit, we introduce the 'setMacroOptions()' method that allows
to set the macro options even for runPlugIn() calls.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use the LegacyEnvironment for the LegacyHeadlessTest

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move the LegacyHeadlessTest into ij1-patcher

... where it belongs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Remove obsolete LegacyTestUtils class

No users anymore...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Remove more unused functions from ij-legacy's tests

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>