Updater (cmd-line): avoid static usage

The command-line updater was implemented mainly using static
methods. However, we should reuse it to test the updater in the unit
tests, to simplify the test code dramatically. Hence we need to use
an instance (to set the ImageJ root directory other than by an unsafe
global system property).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Updater (cmd-line): only call System.exit() when run stand-alone

As we want to reuse the CommandLine updater in the unit tests,
we cannot allow it to end the current process except when run as a
stand-alone main class.

We do this by teaching the die() method to exit only when the class
was called from the main() method.

To help the compiler detect unreachable code correctly, we do
not simply throw an exception in embedded mode, but return the
RuntimeException that has to be thrown by the caller.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Updater (cmd-line): add the 'remove-update-site' command

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Updater (cmd-line): upload errors should be fatal

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Expose more attributes of the FilesUploader

This change is needed for the upcoming WebDAV uploader.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a WebDAV-based uploader for the ImageJ updater

The idea is to allow more contributors to offer their plugins and
extensions more easily.

To provide a WebDAV-based update site with Apache, make a directory
(preferably in the webspace) and add a file looking roughly like this to
Apache's conf.d/ directory:

	<Location /update>
		DAV on
		AuthType Basic
		AuthName "ImageJ update site"
		AuthUserFile /etc/apache2/webdav-uploaders.db
		Options +Indexes
		<LimitExcept HEAD OPTIONS GET>
			Require valid-user
		</LimitExcept>
	</Location>

Then, initialize the password file like this:

	sudo htpasswd -c /etc/apache2/webdav-uploaders.db rasband

Finally, make sure that the directory referenced in the <Location> tag
is read/writable by the Apache process (typically www-data), and restart
Apache gracefully:

	sudo chown -R www-data.www-data /var/www/update
	sudo apache2ctl graceful

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make test-jars in all projects

This is a useful feature to be able to re-use test classes in dependencees.

Suggested by Curtis Rueden.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Refactor the updater test

The helper methods can now be reused in dependent projects.

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

No need for a 'German' method name, and no need to require a progress
instance, no need to carry around ijRoot and webRoot when a
FilesCollection carries both...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add an integration test for WebDAV

This test is skipped unless a test WebDAV web space is defined via the
webdav.test.url, webdav.test.username and webdav.test.password system
properties.

Any files within the specified directory are expected to be fair game
and could be deleted by this test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
fixup! Add a WebDAV-based uploader for the ImageJ updater
Fix compiler warnings in ij-updater-ssh

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add an SSH upload test

Modeled after the WebDAV test, the SSH test is conditional, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Uploader: Strip updater type from the host

For example, when the host is specified as 'ssh:muahaha.cn', the host
really is 'muahaha.cn', not 'ssh:muahaha.cn'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Updater (cmd-line): a password prompt is incompatible with batch mode

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
While at it, test SFTP uploading, too

SFTP is very similar to SSH, except that it does not require shell
access, therefore we can reuse the test account for SFTP testing, too.

For our test, we need to delete any pre-existing db.xml.gz and
plugins/, so we actually *do* require a shell account, but that's
only before the actual SFTP test...

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