@Test @RunWithCustomExecutor public void testNonExistingReportData() throws Exception { doThrow(new ContentAddressableStorageNotFoundException("")) .when(handlerIO).getInputStreamFromWorkspace(CleanupReportManager.CLEANUP_REPORT_BACKUP_FILE_NAME); ItemStatus itemStatus = instance.execute(params, handlerIO); assertThat(itemStatus.getGlobalStatus()).isEqualTo(StatusCode.WARNING); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try (StorageClient storageClient = storageClientFactory.getClient()) { Optional<CleanupReportManager> cleanupReportManager = CleanupReportManager.loadReportDataFromWorkspace(handler); if (!cleanupReportManager.isPresent()) { LOGGER.warn("No report information available..."); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.WARNING); } cleanupReportManager.get().exportReport(handler, storageClient); LOGGER.info("Ingest cleanup finalization succeeded"); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.OK); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Ingest Cleanup finalization failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, e.getStatusCode(), e.getEventDetails()); } }
IngestCleanupFinalizationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try (StorageClient storageClient = storageClientFactory.getClient()) { Optional<CleanupReportManager> cleanupReportManager = CleanupReportManager.loadReportDataFromWorkspace(handler); if (!cleanupReportManager.isPresent()) { LOGGER.warn("No report information available..."); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.WARNING); } cleanupReportManager.get().exportReport(handler, storageClient); LOGGER.info("Ingest cleanup finalization succeeded"); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.OK); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Ingest Cleanup finalization failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, e.getStatusCode(), e.getEventDetails()); } } }
IngestCleanupFinalizationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try (StorageClient storageClient = storageClientFactory.getClient()) { Optional<CleanupReportManager> cleanupReportManager = CleanupReportManager.loadReportDataFromWorkspace(handler); if (!cleanupReportManager.isPresent()) { LOGGER.warn("No report information available..."); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.WARNING); } cleanupReportManager.get().exportReport(handler, storageClient); LOGGER.info("Ingest cleanup finalization succeeded"); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.OK); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Ingest Cleanup finalization failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, e.getStatusCode(), e.getEventDetails()); } } IngestCleanupFinalizationPlugin(); @VisibleForTesting  IngestCleanupFinalizationPlugin(
        StorageClientFactory storageClientFactory); }
IngestCleanupFinalizationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try (StorageClient storageClient = storageClientFactory.getClient()) { Optional<CleanupReportManager> cleanupReportManager = CleanupReportManager.loadReportDataFromWorkspace(handler); if (!cleanupReportManager.isPresent()) { LOGGER.warn("No report information available..."); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.WARNING); } cleanupReportManager.get().exportReport(handler, storageClient); LOGGER.info("Ingest cleanup finalization succeeded"); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.OK); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Ingest Cleanup finalization failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, e.getStatusCode(), e.getEventDetails()); } } IngestCleanupFinalizationPlugin(); @VisibleForTesting  IngestCleanupFinalizationPlugin(
        StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); }
IngestCleanupFinalizationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try (StorageClient storageClient = storageClientFactory.getClient()) { Optional<CleanupReportManager> cleanupReportManager = CleanupReportManager.loadReportDataFromWorkspace(handler); if (!cleanupReportManager.isPresent()) { LOGGER.warn("No report information available..."); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.WARNING); } cleanupReportManager.get().exportReport(handler, storageClient); LOGGER.info("Ingest cleanup finalization succeeded"); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, StatusCode.OK); } catch (ProcessingStatusException e) { LOGGER.error(String.format("Ingest Cleanup finalization failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(INGEST_CLEANUP_FINALIZATION, e.getStatusCode(), e.getEventDetails()); } } IngestCleanupFinalizationPlugin(); @VisibleForTesting  IngestCleanupFinalizationPlugin(
        StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler);  }