@RunWithCustomExecutor @Test public void shouldCheckIntegrityObjectsOfObjectGroup() throws Exception { HandlerIO handler = mock(HandlerIO.class); VitamThreadUtils.getVitamSession().setTenantId(0); VitamThreadUtils.getVitamSession().setRequestId("opId"); JsonNode jsonl = JsonHandler .getFromInputStream(getClass().getResourceAsStream("/AuditObjectWorkflow/objectGroup_1.json")); WorkerParameters params = WorkerParametersFactory.newWorkerParameters().setWorkerGUID(GUIDFactory.newGUID().getId()) .setContainerName(VitamThreadUtils.getVitamSession().getRequestId()) .setRequestId(VitamThreadUtils.getVitamSession().getRequestId()) .setProcessId(VitamThreadUtils.getVitamSession().getRequestId()) .setObjectName("aebaaaaaaahgotryaauzialjp5zkhgyaaaaq").setObjectMetadata(jsonl.get("params")) .setCurrentStep("StepName"); params.putParameterValue(WorkerParameterName.auditActions, "AUDIT_FILE_INTEGRITY"); AuditCheckObjectGroupResult result = generateOkAuditResult(); when(auditIntegrityService.check(any(), any())).thenReturn(result); doNothing().when(auditReportService).appendEntries(processIdCaptor.capture(), auditReportEntryCaptor.capture()); when(handler.getInput(0)).thenReturn(PropertiesUtils.getResourceFile("AuditObjectWorkflow/strategies.json")); ItemStatus status = auditCheckObjectPlugin.execute(params, handler); assertThat(status.getGlobalStatus()).isEqualTo(StatusCode.OK); assertThat(status.getItemId()).isEqualTo(AuditCheckObjectPlugin.AUDIT_CHECK_OBJECT); assertThat(auditReportEntryCaptor.getValue().size()).isEqualTo(1); assertThat(auditReportEntryCaptor.getValue().get(0).getOutcome()).isEqualTo("AUDIT_FILE_INTEGRITY"); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { LOGGER.debug("Starting audit"); try { return executeAudit(param, handler); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Audit action failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(AUDIT_CHECK_OBJECT, e.getStatusCode(), null); } }
AuditCheckObjectPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { LOGGER.debug("Starting audit"); try { return executeAudit(param, handler); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Audit action failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(AUDIT_CHECK_OBJECT, e.getStatusCode(), null); } } }
AuditCheckObjectPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { LOGGER.debug("Starting audit"); try { return executeAudit(param, handler); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Audit action failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(AUDIT_CHECK_OBJECT, e.getStatusCode(), null); } } AuditCheckObjectPlugin(); @VisibleForTesting  AuditCheckObjectPlugin(AuditExistenceService auditExistenceService, AuditIntegrityService auditIntegrityService,
                           AuditReportService auditReportService); }
AuditCheckObjectPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { LOGGER.debug("Starting audit"); try { return executeAudit(param, handler); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Audit action failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(AUDIT_CHECK_OBJECT, e.getStatusCode(), null); } } AuditCheckObjectPlugin(); @VisibleForTesting  AuditCheckObjectPlugin(AuditExistenceService auditExistenceService, AuditIntegrityService auditIntegrityService,
                           AuditReportService auditReportService); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); }
AuditCheckObjectPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { LOGGER.debug("Starting audit"); try { return executeAudit(param, handler); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Audit action failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(AUDIT_CHECK_OBJECT, e.getStatusCode(), null); } } AuditCheckObjectPlugin(); @VisibleForTesting  AuditCheckObjectPlugin(AuditExistenceService auditExistenceService, AuditIntegrityService auditIntegrityService,
                           AuditReportService auditReportService); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); static final String AUDIT_CHECK_OBJECT; }