Search in sources :

Example 1 with BagVerifier

use of gov.loc.repository.bagit.verify.BagVerifier in project bagit-java by LibraryOfCongress.

the class ReaderWriterVerifierIntegrationTest method testReaderWriterVersion95.

@Test
public void testReaderWriterVersion95() throws Exception {
    BagReader reader = new BagReader();
    Path rootDir = Paths.get(this.getClass().getClassLoader().getResource("bags/v0_95/bag").toURI());
    Bag bag = reader.read(rootDir);
    Path outputDir = Paths.get(folder.newFolder().toURI());
    BagWriter.write(bag, outputDir);
    testBagsEqual(rootDir, outputDir);
    try (BagVerifier verifier = new BagVerifier()) {
        verifier.isValid(reader.read(outputDir), true);
    }
}
Also used : Path(java.nio.file.Path) BagVerifier(gov.loc.repository.bagit.verify.BagVerifier) BagReader(gov.loc.repository.bagit.reader.BagReader) Bag(gov.loc.repository.bagit.domain.Bag) Test(org.junit.Test)

Example 2 with BagVerifier

use of gov.loc.repository.bagit.verify.BagVerifier in project bagit-java by LibraryOfCongress.

the class ReaderWriterVerifierIntegrationTest method testReaderWriterVersion2_0.

@Test
public void testReaderWriterVersion2_0() throws Exception {
    BagReader reader = new BagReader();
    Path rootDir = Paths.get(this.getClass().getClassLoader().getResource("bags/v2_0/bag").toURI());
    Bag bag = reader.read(rootDir);
    Path outputDir = Paths.get(folder.newFolder().toURI());
    BagWriter.write(bag, outputDir);
    testBagsEqual(rootDir, outputDir);
    try (BagVerifier verifier = new BagVerifier()) {
        verifier.isValid(reader.read(outputDir), true);
    }
}
Also used : Path(java.nio.file.Path) BagVerifier(gov.loc.repository.bagit.verify.BagVerifier) BagReader(gov.loc.repository.bagit.reader.BagReader) Bag(gov.loc.repository.bagit.domain.Bag) Test(org.junit.Test)

Example 3 with BagVerifier

use of gov.loc.repository.bagit.verify.BagVerifier in project bagit-java by LibraryOfCongress.

the class ReaderWriterVerifierIntegrationTest method testReaderWriterVersion97.

@Test
public void testReaderWriterVersion97() throws Exception {
    BagReader reader = new BagReader();
    Path rootDir = Paths.get(this.getClass().getClassLoader().getResource("bags/v0_97/bag").toURI());
    Bag bag = reader.read(rootDir);
    Path outputDir = Paths.get(folder.newFolder().toURI());
    BagWriter.write(bag, outputDir);
    testBagsEqual(rootDir, outputDir);
    try (BagVerifier verifier = new BagVerifier()) {
        verifier.isValid(reader.read(outputDir), true);
    }
}
Also used : Path(java.nio.file.Path) BagVerifier(gov.loc.repository.bagit.verify.BagVerifier) BagReader(gov.loc.repository.bagit.reader.BagReader) Bag(gov.loc.repository.bagit.domain.Bag) Test(org.junit.Test)

Example 4 with BagVerifier

use of gov.loc.repository.bagit.verify.BagVerifier in project bagit-java by LibraryOfCongress.

the class ReaderWriterVerifierIntegrationTest method testReaderWriterVersion93.

@Test
public void testReaderWriterVersion93() throws Exception {
    try (BagVerifier verifier = new BagVerifier()) {
        BagReader reader = new BagReader();
        Path rootDir = Paths.get(this.getClass().getClassLoader().getResource("bags/v0_93/bag").toURI());
        Path outputDir = Paths.get(folder.newFolder().toURI());
        Bag bag = reader.read(rootDir);
        verifier.isValid(bag, true);
        BagWriter.write(bag, outputDir);
        testBagsEqual(rootDir, outputDir);
        verifier.isValid(reader.read(outputDir), true);
    }
}
Also used : Path(java.nio.file.Path) BagVerifier(gov.loc.repository.bagit.verify.BagVerifier) BagReader(gov.loc.repository.bagit.reader.BagReader) Bag(gov.loc.repository.bagit.domain.Bag) Test(org.junit.Test)

Example 5 with BagVerifier

use of gov.loc.repository.bagit.verify.BagVerifier in project bagit-java by LibraryOfCongress.

the class ReaderWriterVerifierIntegrationTest method testReaderWriterVersion96.

@Test
public void testReaderWriterVersion96() throws Exception {
    BagReader reader = new BagReader();
    Path rootDir = Paths.get(this.getClass().getClassLoader().getResource("bags/v0_96/bag").toURI());
    Bag bag = reader.read(rootDir);
    Path outputDir = Paths.get(folder.newFolder().toURI());
    BagWriter.write(bag, outputDir);
    testBagsEqual(rootDir, outputDir);
    try (BagVerifier verifier = new BagVerifier()) {
        verifier.isValid(reader.read(outputDir), true);
    }
}
Also used : Path(java.nio.file.Path) BagVerifier(gov.loc.repository.bagit.verify.BagVerifier) BagReader(gov.loc.repository.bagit.reader.BagReader) Bag(gov.loc.repository.bagit.domain.Bag) Test(org.junit.Test)

Aggregations

Bag (gov.loc.repository.bagit.domain.Bag)6 BagReader (gov.loc.repository.bagit.reader.BagReader)6 BagVerifier (gov.loc.repository.bagit.verify.BagVerifier)6 Path (java.nio.file.Path)6 Test (org.junit.Test)6