From 79a5b78af3a078090929bb77084df7cc7814cc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clermont=C3=A9?= Date: Sun, 15 May 2016 16:56:10 +0200 Subject: [PATCH] updated SibaCLI + SibaManager --- src/org/dclermonte/siba/cli/SibaCLI.java | 11 +++++++--- .../siba/model/SibaManagerTest.java | 21 ++++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/org/dclermonte/siba/cli/SibaCLI.java b/src/org/dclermonte/siba/cli/SibaCLI.java index 32125fb..75e61e3 100644 --- a/src/org/dclermonte/siba/cli/SibaCLI.java +++ b/src/org/dclermonte/siba/cli/SibaCLI.java @@ -71,9 +71,16 @@ public class SibaCLI } + /** + * + * @param args + * @throws ArchiveException + * @throws IOException + * @throws NoSuchAlgorithmException + */ public static void run(final String[] args) throws ArchiveException, IOException, NoSuchAlgorithmException { - + // This part implements an automate. int numberParameter = args.length; if (numberParameter == 0) { @@ -81,14 +88,12 @@ public class SibaCLI } else { - if ((args[0].equals("-h")) || (args[0].equals("-help")) || (args[0].equals("--help"))) { help(); } else if (args[0].equals("backup")) { - if (numberParameter == 1) { System.out.println(BUNDLE.getString("missingDirectoryToSave.text")); diff --git a/test/org/dclermonte/siba/model/SibaManagerTest.java b/test/org/dclermonte/siba/model/SibaManagerTest.java index 9a3ca20..88effd3 100644 --- a/test/org/dclermonte/siba/model/SibaManagerTest.java +++ b/test/org/dclermonte/siba/model/SibaManagerTest.java @@ -1,5 +1,6 @@ package org.dclermonte.siba.model; +import java.io.File; import java.io.IOException; import org.apache.commons.compress.archivers.ArchiveException; @@ -22,13 +23,31 @@ public class SibaManagerTest } /** + * * @throws IOException * @throws ArchiveException - * */ @Test(expectedExceptions = IllegalArgumentException.class) public void backupTest01() throws ArchiveException, IOException { SibaManager.backup(null, null); } + + /** + * + * @throws ArchiveException + * @throws IOException + */ + @Test + public void backupTest02() throws ArchiveException, IOException + { + String md5LineSource = "qslfjqmlsfjmqlsjfqmlsjfsjf mqlsfjmljdf"; + File target = SibaManager.backup(new File("../data/simplestuff"), new File("/tmp/")); + + // Load md5 file. + String md5LineTarget = FileUtils.load(target); + + // Test. + Assert.assertEquals(md5LineSource, md5LineTarget); + } }