Search in sources :

Example 1 with CDRMETS2N3BagJob

use of edu.unc.lib.boxc.deposit.normalize.CDRMETS2N3BagJob in project box-c by UNC-Libraries.

the class CDRMETS2N3BagJobTest method setup.

@Before
public void setup() throws Exception {
    status = new HashMap<>();
    when(depositStatusFactory.get(anyString())).thenReturn(status);
    when(metsSipSchema.newValidator()).thenReturn(metsValidator);
    makePid(RepositoryPathConstants.CONTENT_BASE);
    data = new File(depositDir, "data");
    data.mkdir();
    Path metsPath = data.toPath().resolve("mets.xml");
    stagingBaseUri = data.toPath().toUri().toString();
    status.put(DepositField.sourceUri.name(), metsPath.toUri().toString());
    job = new CDRMETS2N3BagJob(jobUUID, depositUUID);
    setField(job, "depositModelManager", depositModelManager);
    job.setDepositDirectory(depositDir);
    setField(job, "depositsDirectory", depositsDirectory);
    setField(job, "depositStatusFactory", depositStatusFactory);
    setField(job, "metsSipSchema", metsSipSchema);
    setField(job, "premisLoggerFactory", premisLoggerFactory);
    setField(job, "pidMinter", pidMinter);
    job.setSchematronValidator(schematronValidator);
    when(schematronValidator.validateReportErrors(any(StreamSource.class), eq(METSProfile.CDR_SIMPLE.name()))).thenReturn(new ArrayList<String>());
    when(premisLogger.buildEvent(eq(Premis.Validation))).thenReturn(premisEventBuilder);
    when(premisLogger.buildEvent(eq(Premis.Normalization))).thenReturn(premisEventBuilder);
    job.init();
}
Also used : Path(java.nio.file.Path) CDRMETS2N3BagJob(edu.unc.lib.boxc.deposit.normalize.CDRMETS2N3BagJob) StreamSource(javax.xml.transform.stream.StreamSource) Matchers.anyString(org.mockito.Matchers.anyString) File(java.io.File) Before(org.junit.Before)

Aggregations

CDRMETS2N3BagJob (edu.unc.lib.boxc.deposit.normalize.CDRMETS2N3BagJob)1 File (java.io.File)1 Path (java.nio.file.Path)1 StreamSource (javax.xml.transform.stream.StreamSource)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1