2016-05-10 18:59:52 +02:00
|
|
|
package org.dclermonte.siba.model;
|
|
|
|
|
2016-05-15 16:56:10 +02:00
|
|
|
import java.io.File;
|
2016-05-10 18:59:52 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import org.apache.commons.compress.archivers.ArchiveException;
|
|
|
|
import org.testng.Assert;
|
|
|
|
import org.testng.annotations.Test;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author cpm
|
|
|
|
*/
|
|
|
|
public class SibaManagerTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void aFooTest()
|
|
|
|
{
|
|
|
|
Assert.assertTrue(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-05-15 16:56:10 +02:00
|
|
|
*
|
2016-05-10 18:59:52 +02:00
|
|
|
* @throws IOException
|
|
|
|
* @throws ArchiveException
|
|
|
|
*/
|
|
|
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
|
|
|
public void backupTest01() throws ArchiveException, IOException
|
|
|
|
{
|
|
|
|
SibaManager.backup(null, null);
|
|
|
|
}
|
2016-05-15 16:56:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @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);
|
|
|
|
}
|
2016-05-10 18:59:52 +02:00
|
|
|
}
|