Siba/test/org/dclermonte/siba/model/SibaManagerTest.java

61 lines
1.4 KiB
Java
Raw Normal View History

package org.dclermonte.siba.model;
2016-05-15 16:56:10 +02:00
import java.io.File;
import java.io.IOException;
import org.apache.commons.compress.archivers.ArchiveException;
2016-05-16 23:40:07 +02:00
import org.apache.commons.io.FileUtils;
2016-05-19 18:40:00 +02:00
import org.dclermonte.siba.SibaException;
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
*
* @throws IOException
* @throws ArchiveException
2016-05-16 23:40:07 +02:00
* @throws SibaNullException
*/
2016-05-19 18:40:00 +02:00
@Test(expectedExceptions = SibaException.class)
public void backupTest01() throws ArchiveException, IOException, SibaException
{
SibaManager.backup(null, null);
}
2016-05-15 16:56:10 +02:00
/**
*
* @throws ArchiveException
* @throws IOException
2016-05-16 23:40:07 +02:00
* @throws SibaNullException
2016-05-15 16:56:10 +02:00
*/
@Test
2016-05-19 18:40:00 +02:00
public void backupTest02() throws ArchiveException, IOException, SibaException
2016-05-15 16:56:10 +02:00
{
File source = new File("test/org/dclermonte/siba/data/simplestuff");
File target = SibaManager.backup(source, new File("test/org/dclermonte/siba/data/result"));
System.out.println(target.getName());
2016-05-15 16:56:10 +02:00
// Load md5 file.
2016-05-16 23:40:07 +02:00
String encoding = null;
String md5LineTarget = FileUtils.readFileToString(target, encoding);
File reference = new File("test/org/dclermonte/siba/data/reference/simplestuff-2016-05-18T22h57mn57s.tgz");
String md5LineSource = FileUtils.readFileToString(reference, encoding);
2016-05-15 16:56:10 +02:00
// Test.
Assert.assertEquals(md5LineSource, md5LineTarget);
}
}