@Test @RunWithCustomExecutor public void should_generate_report_OK() throws Exception { String operationId = "MY_OPERATION_ID"; WorkerParameters workerParameter = workerParameterBuilder().withContainerName(operationId).build(); TestHandlerIO handlerIO = new TestHandlerIO(); handlerIO.setJsonFromWorkspace("query.json", JsonHandler.createObjectNode().put("Context", "request")); when(logbookOperationsClient.selectOperationById(operationId)) .thenReturn(getLogbookOperationRequestResponseOK()); ItemStatus itemStatus = massUpdateFinalize.execute(workerParameter, handlerIO); assertThat(itemStatus.getGlobalStatus()).isEqualTo(OK); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { storeReportToWorkspace(param, handler); storeReportToOffers(param); cleanupReport(param); return buildItemStatus(MASS_UPDATE_FINALIZE, OK, EventDetails.of("MassUpdate report generation OK.")); } catch (LogbookClientException | VitamClientInternalException | StorageNotFoundClientException | StorageServerClientException | StorageAlreadyExistsClientException | InvalidParseOperationException e) { LOGGER.error(e); return buildItemStatus(MASS_UPDATE_FINALIZE, FATAL, EventDetails.of("Client error when generating report.")); } }
MassUpdateFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { storeReportToWorkspace(param, handler); storeReportToOffers(param); cleanupReport(param); return buildItemStatus(MASS_UPDATE_FINALIZE, OK, EventDetails.of("MassUpdate report generation OK.")); } catch (LogbookClientException | VitamClientInternalException | StorageNotFoundClientException | StorageServerClientException | StorageAlreadyExistsClientException | InvalidParseOperationException e) { LOGGER.error(e); return buildItemStatus(MASS_UPDATE_FINALIZE, FATAL, EventDetails.of("Client error when generating report.")); } } }
MassUpdateFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { storeReportToWorkspace(param, handler); storeReportToOffers(param); cleanupReport(param); return buildItemStatus(MASS_UPDATE_FINALIZE, OK, EventDetails.of("MassUpdate report generation OK.")); } catch (LogbookClientException | VitamClientInternalException | StorageNotFoundClientException | StorageServerClientException | StorageAlreadyExistsClientException | InvalidParseOperationException e) { LOGGER.error(e); return buildItemStatus(MASS_UPDATE_FINALIZE, FATAL, EventDetails.of("Client error when generating report.")); } } MassUpdateFinalize(); @VisibleForTesting  MassUpdateFinalize(BatchReportClientFactory batchReportClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory,
        StorageClientFactory storageClientFactory); }
MassUpdateFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { storeReportToWorkspace(param, handler); storeReportToOffers(param); cleanupReport(param); return buildItemStatus(MASS_UPDATE_FINALIZE, OK, EventDetails.of("MassUpdate report generation OK.")); } catch (LogbookClientException | VitamClientInternalException | StorageNotFoundClientException | StorageServerClientException | StorageAlreadyExistsClientException | InvalidParseOperationException e) { LOGGER.error(e); return buildItemStatus(MASS_UPDATE_FINALIZE, FATAL, EventDetails.of("Client error when generating report.")); } } MassUpdateFinalize(); @VisibleForTesting  MassUpdateFinalize(BatchReportClientFactory batchReportClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory,
        StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); }
MassUpdateFinalize extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { storeReportToWorkspace(param, handler); storeReportToOffers(param); cleanupReport(param); return buildItemStatus(MASS_UPDATE_FINALIZE, OK, EventDetails.of("MassUpdate report generation OK.")); } catch (LogbookClientException | VitamClientInternalException | StorageNotFoundClientException | StorageServerClientException | StorageAlreadyExistsClientException | InvalidParseOperationException e) { LOGGER.error(e); return buildItemStatus(MASS_UPDATE_FINALIZE, FATAL, EventDetails.of("Client error when generating report.")); } } MassUpdateFinalize(); @VisibleForTesting  MassUpdateFinalize(BatchReportClientFactory batchReportClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory,
        StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler);  }