Search in sources :

Example 1 with NormalizeFileObjectsJob

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

the class NormalizeFileObjectsJobTest method init.

@Before
public void init() {
    job = new NormalizeFileObjectsJob();
    job.setDepositUUID(depositUUID);
    job.setDepositDirectory(depositDir);
    job.setDepositStatusFactory(depositStatusFactory);
    setField(job, "depositModelManager", depositModelManager);
    setField(job, "premisLoggerFactory", mockPremisLoggerFactory);
    setField(job, "depositsDirectory", depositsDirectory);
    setField(job, "pidMinter", pidMinter);
    job.init();
    mockPremisEventBuilder = mock(PremisEventBuilder.class, new SelfReturningAnswer());
    when(mockPremisLoggerFactory.createPremisLogger(any(PID.class), any(File.class))).thenReturn(mockPremisLogger);
    when(mockPremisLogger.buildEvent(any(Resource.class))).thenReturn(mockPremisEventBuilder);
    model = job.getWritableModel();
    depBag = model.createBag(depositPid.getRepositoryPath());
    when(pidMinter.mintContentPid()).thenAnswer(new Answer<PID>() {

        @Override
        public PID answer(InvocationOnMock invocation) throws Throwable {
            return makePid(CONTENT_BASE);
        }
    });
}
Also used : SelfReturningAnswer(edu.unc.lib.boxc.common.test.SelfReturningAnswer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Resource(org.apache.jena.rdf.model.Resource) PID(edu.unc.lib.boxc.model.api.ids.PID) NormalizeFileObjectsJob(edu.unc.lib.boxc.deposit.normalize.NormalizeFileObjectsJob) File(java.io.File) PremisEventBuilder(edu.unc.lib.boxc.operations.api.events.PremisEventBuilder) Before(org.junit.Before)

Aggregations

SelfReturningAnswer (edu.unc.lib.boxc.common.test.SelfReturningAnswer)1 NormalizeFileObjectsJob (edu.unc.lib.boxc.deposit.normalize.NormalizeFileObjectsJob)1 PID (edu.unc.lib.boxc.model.api.ids.PID)1 PremisEventBuilder (edu.unc.lib.boxc.operations.api.events.PremisEventBuilder)1 File (java.io.File)1 Resource (org.apache.jena.rdf.model.Resource)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1