use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class MandatoryVerifierTest method testErrorWhenMissingPayloadDirectory.
@Test(expected = MissingPayloadDirectoryException.class)
public void testErrorWhenMissingPayloadDirectory() throws Exception {
copyBagToTestFolder();
Bag bag = reader.read(Paths.get(folder.getRoot().toURI()));
File dataDir = new File(folder.getRoot(), "data");
deleteDirectory(Paths.get(dataDir.toURI()));
MandatoryVerifier.checkPayloadDirectoryExists(bag);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class MandatoryVerifierTest method testErrorWhenMissingPayloadManifest.
@Test(expected = MissingPayloadManifestException.class)
public void testErrorWhenMissingPayloadManifest() throws Exception {
copyBagToTestFolder();
Bag bag = reader.read(Paths.get(folder.getRoot().toURI()));
File manifestFile = new File(folder.getRoot(), "manifest-md5.txt");
manifestFile.delete();
MandatoryVerifier.checkIfAtLeastOnePayloadManifestsExist(bag.getRootDir(), bag.getVersion());
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class MandatoryVerifierTest method testErrorWhenFetchItemsDontExist.
@Test(expected = FileNotInPayloadDirectoryException.class)
public void testErrorWhenFetchItemsDontExist() throws Exception {
rootDir = Paths.get(new File("src/test/resources/bad-fetch-bag").toURI());
Bag bag = reader.read(rootDir);
MandatoryVerifier.checkFetchItemsExist(bag.getItemsToFetch(), bag.getRootDir());
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class QuickVerifierTest method testExceptionIsThrownWhenPayloadOxumDoesntExist.
@Test(expected = PayloadOxumDoesNotExistException.class)
public void testExceptionIsThrownWhenPayloadOxumDoesntExist() throws Exception {
Bag bag = reader.read(rootDir);
QuickVerifier.quicklyVerify(bag);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class QuickVerifierTest method testInvalidFileCountForQuickVerify.
@Test(expected = InvalidPayloadOxumException.class)
public void testInvalidFileCountForQuickVerify() throws Exception {
Path badRootDir = Paths.get(new File("src/test/resources/badPayloadOxumFileCount/bag").toURI());
Bag bag = reader.read(badRootDir);
QuickVerifier.quicklyVerify(bag);
}
Aggregations