updated SibaCLI + SibaManager

This commit is contained in:
Didier Clermonté 2016-05-15 16:56:10 +02:00
parent ae921b7115
commit 79a5b78af3
2 changed files with 28 additions and 4 deletions

View File

@ -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"));

View File

@ -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);
}
}