@RunWithCustomExecutor @Test public void shouldFinalizeAudit() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(0); String containerName = GUIDFactory.newGUID().getId(); VitamThreadUtils.getVitamSession().setRequestId(containerName); doReturn(containerName).when(defaultWorkerParameters).getContainerName(); ItemStatus itemStatus = evidenceAuditFinalize.execute(defaultWorkerParameters, handlerIO); assertThat(itemStatus.getGlobalStatus()).isEqualTo(StatusCode.OK); verify(evidenceAuditReportService).storeReportToOffers(containerName); verify(evidenceAuditReportService).cleanupReport(containerName); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_FINALIZE); try { String containerName = param.getContainerName(); evidenceAuditReportService.storeReportToOffers(containerName); evidenceAuditReportService.cleanupReport(containerName); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } catch (ProcessingStatusException e) { LOGGER.error(e); itemStatus.increment(e.getStatusCode()); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } }
EvidenceAuditFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_FINALIZE); try { String containerName = param.getContainerName(); evidenceAuditReportService.storeReportToOffers(containerName); evidenceAuditReportService.cleanupReport(containerName); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } catch (ProcessingStatusException e) { LOGGER.error(e); itemStatus.increment(e.getStatusCode()); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } } }
EvidenceAuditFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_FINALIZE); try { String containerName = param.getContainerName(); evidenceAuditReportService.storeReportToOffers(containerName); evidenceAuditReportService.cleanupReport(containerName); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } catch (ProcessingStatusException e) { LOGGER.error(e); itemStatus.increment(e.getStatusCode()); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } } @VisibleForTesting  EvidenceAuditFinalize(EvidenceAuditReportService evidenceAuditReportService);  EvidenceAuditFinalize(); }
EvidenceAuditFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_FINALIZE); try { String containerName = param.getContainerName(); evidenceAuditReportService.storeReportToOffers(containerName); evidenceAuditReportService.cleanupReport(containerName); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } catch (ProcessingStatusException e) { LOGGER.error(e); itemStatus.increment(e.getStatusCode()); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } } @VisibleForTesting  EvidenceAuditFinalize(EvidenceAuditReportService evidenceAuditReportService);  EvidenceAuditFinalize(); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO); }
EvidenceAuditFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_FINALIZE); try { String containerName = param.getContainerName(); evidenceAuditReportService.storeReportToOffers(containerName); evidenceAuditReportService.cleanupReport(containerName); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } catch (ProcessingStatusException e) { LOGGER.error(e); itemStatus.increment(e.getStatusCode()); return new ItemStatus(EVIDENCE_AUDIT_FINALIZE).setItemsStatus(EVIDENCE_AUDIT_FINALIZE, itemStatus); } } @VisibleForTesting  EvidenceAuditFinalize(EvidenceAuditReportService evidenceAuditReportService);  EvidenceAuditFinalize(); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO);  }