Search in sources :

Example 1 with IngestContentObjectsJob

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

the class IngestContentObjectsJobIT method constructJob.

private void constructJob() {
    job = new IngestContentObjectsJob();
    job.setJobUUID(jobUUID);
    job.setDepositUUID(depositUUID);
    job.setDepositDirectory(depositDir);
    job.setPremisLoggerFactory(premisLoggerFactory);
    setField(job, "pidMinter", pidMinter);
    setField(job, "aclService", aclService);
    setField(job, "depositModelManager", depositModelManager);
    setField(job, "depositsDirectory", depositsDirectory);
    setField(job, "depositStatusFactory", depositStatusFactory);
    setField(job, "txManager", txManager);
    setField(job, "jobStatusFactory", jobStatusFactory);
    setField(job, "metricsClient", metricsClient);
    setField(job, "repoObjLoader", repoObjLoader);
    setField(job, "repoObjFactory", repoObjFactory);
    setField(job, "fcrepoClient", fcrepoClient);
    setField(job, "verificationService", verificationService);
    setField(job, "transferService", binaryTransferService);
    setField(job, "locationManager", storageLocationManager);
    setField(job, "updateDescService", updateDescService);
    job.init();
}
Also used : IngestContentObjectsJob(edu.unc.lib.boxc.deposit.fcrepo4.IngestContentObjectsJob)

Example 2 with IngestContentObjectsJob

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

the class IngestContentObjectsJobTest method init.

@Before
public void init() throws Exception {
    job = new IngestContentObjectsJob();
    job.setJobUUID(jobUUID);
    job.setDepositUUID(depositUUID);
    job.setDepositDirectory(depositDir);
    setField(job, "premisLoggerFactory", mockPremisLoggerFactory);
    setField(job, "aclService", aclService);
    setField(job, "depositModelManager", depositModelManager);
    setField(job, "depositsDirectory", depositsDirectory);
    setField(job, "depositStatusFactory", depositStatusFactory);
    setField(job, "jobStatusFactory", jobStatusFactory);
    setField(job, "metricsClient", metricsClient);
    setField(job, "pidMinter", pidMinter);
    setField(job, "repoObjLoader", repoObjLoader);
    setField(job, "repoObjFactory", repoObjFactory);
    setField(job, "fcrepoClient", fcrepoClient);
    setField(job, "txManager", txManager);
    setField(job, "verificationService", verificationService);
    setField(job, "transferService", binaryTransferService);
    setField(job, "locationManager", storageLocationManager);
    setField(job, "updateDescService", updateDescService);
    setField(job, "depositModelManager", depositModelManager);
    job.init();
    depositPid = job.getDepositPID();
    setupDestination();
    FileUtils.copyDirectory(new File("src/test/resources/examples"), depositDir);
    storageLocPath = tmpFolder.newFolder("storageLoc").toPath();
    // Setup logging dependencies
    mockPremisEventBuilder = mock(PremisEventBuilder.class, new SelfReturningAnswer());
    when(mockPremisLoggerFactory.createPremisLogger(any())).thenReturn(mockPremisLogger);
    when(mockPremisLoggerFactory.createPremisLogger(any(PID.class), any(File.class))).thenReturn(mockPremisLogger);
    when(mockPremisLogger.buildEvent(any(Resource.class))).thenReturn(mockPremisEventBuilder);
    when(mockFileObj.getOriginalFile()).thenReturn(mockBinaryObj);
    // Get a writeable model
    model = job.getWritableModel();
    depBag = model.createBag(depositPid.getRepositoryPath());
    when(fcrepoClient.head(any(URI.class))).thenReturn(headBuilder);
    when(txManager.startTransaction()).thenReturn(mockTx);
    doThrow(new TransactionCancelledException()).when(mockTx).cancel(any(Exception.class));
    depBag.addProperty(Cdr.storageLocation, LOC1_ID);
    when(storageLocationManager.getStorageLocationById(anyString())).thenReturn(storageLocation);
    when(binaryTransferService.getSession(any(StorageLocation.class))).thenReturn(mockTransferSession);
}
Also used : TransactionCancelledException(edu.unc.lib.boxc.fcrepo.exceptions.TransactionCancelledException) IngestContentObjectsJob(edu.unc.lib.boxc.deposit.fcrepo4.IngestContentObjectsJob) SelfReturningAnswer(edu.unc.lib.boxc.common.test.SelfReturningAnswer) Resource(org.apache.jena.rdf.model.Resource) PID(edu.unc.lib.boxc.model.api.ids.PID) StorageLocation(edu.unc.lib.boxc.persist.api.storage.StorageLocation) File(java.io.File) URI(java.net.URI) TransactionCancelledException(edu.unc.lib.boxc.fcrepo.exceptions.TransactionCancelledException) JobInterruptedException(edu.unc.lib.boxc.deposit.work.JobInterruptedException) FedoraException(edu.unc.lib.boxc.model.api.exceptions.FedoraException) AccessRestrictionException(edu.unc.lib.boxc.auth.api.exceptions.AccessRestrictionException) ChecksumMismatchException(edu.unc.lib.boxc.fcrepo.exceptions.ChecksumMismatchException) JobFailedException(edu.unc.lib.boxc.deposit.work.JobFailedException) FcrepoOperationFailedException(org.fcrepo.client.FcrepoOperationFailedException) PremisEventBuilder(edu.unc.lib.boxc.operations.api.events.PremisEventBuilder) Before(org.junit.Before)

Aggregations

IngestContentObjectsJob (edu.unc.lib.boxc.deposit.fcrepo4.IngestContentObjectsJob)2 AccessRestrictionException (edu.unc.lib.boxc.auth.api.exceptions.AccessRestrictionException)1 SelfReturningAnswer (edu.unc.lib.boxc.common.test.SelfReturningAnswer)1 JobFailedException (edu.unc.lib.boxc.deposit.work.JobFailedException)1 JobInterruptedException (edu.unc.lib.boxc.deposit.work.JobInterruptedException)1 ChecksumMismatchException (edu.unc.lib.boxc.fcrepo.exceptions.ChecksumMismatchException)1 TransactionCancelledException (edu.unc.lib.boxc.fcrepo.exceptions.TransactionCancelledException)1 FedoraException (edu.unc.lib.boxc.model.api.exceptions.FedoraException)1 PID (edu.unc.lib.boxc.model.api.ids.PID)1 PremisEventBuilder (edu.unc.lib.boxc.operations.api.events.PremisEventBuilder)1 StorageLocation (edu.unc.lib.boxc.persist.api.storage.StorageLocation)1 File (java.io.File)1 URI (java.net.URI)1 Resource (org.apache.jena.rdf.model.Resource)1 FcrepoOperationFailedException (org.fcrepo.client.FcrepoOperationFailedException)1 Before (org.junit.Before)1