added unit test for plugin updates

This commit is contained in:
Sebastian Sdorra
2014-12-07 18:28:24 +01:00
parent 4e0d29a392
commit 1bd4743444
4 changed files with 49 additions and 1 deletions

View File

@@ -77,6 +77,9 @@ import javax.xml.bind.JAXBException;
public final class PluginProcessor
{
/** Field description */
private static final String INSTALLEDNAME_FORMAT = "%s.%03d";
/** Field description */
private static final String DIRECTORY_CLASSES = "classes";
@@ -640,7 +643,23 @@ public final class PluginProcessor
Files.createDirectories(installedDirectory);
}
Files.move(archive, installedDirectory.resolve(archive.getFileName()));
Path installed = null;
for (int i = 0; i < 1000; i++)
{
String name = String.format(INSTALLEDNAME_FORMAT, archive.getFileName(), i);
installed = installedDirectory.resolve(name);
if (!Files.exists(installed))
{
break;
}
}
logger.debug("move installed archive to {}", installed);
Files.move(archive, installed);
}
//~--- inner classes --------------------------------------------------------