@RunWithCustomExecutor @Test public void givenEmptyFileReturnedWhenExecuteThenReturnResponseOK() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(0); final InputStream rulesUpdated = IOUtils.toInputStream("[]", "UTF-8"); try { params.setProcessId(GUIDFactory.newOperationLogbookGUID(0).toString()); when(handlerIO.getInputStreamFromWorkspace( eq(UpdateWorkflowConstants.PROCESSING_FOLDER + "/" + UpdateWorkflowConstants.UPDATED_RULES_JSON))) .thenReturn(rulesUpdated); final ItemStatus response = plugin.execute(params, handlerIO); assertEquals(StatusCode.OK, response.getGlobalStatus()); } finally { rulesUpdated.close(); } }
@Override public ItemStatus execute(WorkerParameters params, HandlerIO handler) { final ItemStatus itemStatus = new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID); try { try { getRunningIngests(params, handler); } catch (VitamDBException e) { LOGGER.error(e); } itemStatus.increment(StatusCode.OK); } catch (ProcessingException e) { LOGGER.error("Processing exception", e); itemStatus.increment(StatusCode.FATAL); } catch (InvalidParseOperationException e) { LOGGER.error("Cannot parse json", e); itemStatus.increment(StatusCode.KO); } return new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID).setItemsStatus(RUNNING_INGESTS_UPDATE_TASK_ID, itemStatus); }
RunningIngestsUpdateActionPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handler) { final ItemStatus itemStatus = new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID); try { try { getRunningIngests(params, handler); } catch (VitamDBException e) { LOGGER.error(e); } itemStatus.increment(StatusCode.OK); } catch (ProcessingException e) { LOGGER.error("Processing exception", e); itemStatus.increment(StatusCode.FATAL); } catch (InvalidParseOperationException e) { LOGGER.error("Cannot parse json", e); itemStatus.increment(StatusCode.KO); } return new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID).setItemsStatus(RUNNING_INGESTS_UPDATE_TASK_ID, itemStatus); } }
RunningIngestsUpdateActionPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handler) { final ItemStatus itemStatus = new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID); try { try { getRunningIngests(params, handler); } catch (VitamDBException e) { LOGGER.error(e); } itemStatus.increment(StatusCode.OK); } catch (ProcessingException e) { LOGGER.error("Processing exception", e); itemStatus.increment(StatusCode.FATAL); } catch (InvalidParseOperationException e) { LOGGER.error("Cannot parse json", e); itemStatus.increment(StatusCode.KO); } return new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID).setItemsStatus(RUNNING_INGESTS_UPDATE_TASK_ID, itemStatus); } RunningIngestsUpdateActionPlugin(); @VisibleForTesting  RunningIngestsUpdateActionPlugin(ProcessingManagementClientFactory processingManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory, StoreMetaDataUnitActionPlugin storeMetaDataUnitActionPlugin); }
RunningIngestsUpdateActionPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handler) { final ItemStatus itemStatus = new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID); try { try { getRunningIngests(params, handler); } catch (VitamDBException e) { LOGGER.error(e); } itemStatus.increment(StatusCode.OK); } catch (ProcessingException e) { LOGGER.error("Processing exception", e); itemStatus.increment(StatusCode.FATAL); } catch (InvalidParseOperationException e) { LOGGER.error("Cannot parse json", e); itemStatus.increment(StatusCode.KO); } return new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID).setItemsStatus(RUNNING_INGESTS_UPDATE_TASK_ID, itemStatus); } RunningIngestsUpdateActionPlugin(); @VisibleForTesting  RunningIngestsUpdateActionPlugin(ProcessingManagementClientFactory processingManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory, StoreMetaDataUnitActionPlugin storeMetaDataUnitActionPlugin); @Override ItemStatus execute(WorkerParameters params, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); }
RunningIngestsUpdateActionPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handler) { final ItemStatus itemStatus = new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID); try { try { getRunningIngests(params, handler); } catch (VitamDBException e) { LOGGER.error(e); } itemStatus.increment(StatusCode.OK); } catch (ProcessingException e) { LOGGER.error("Processing exception", e); itemStatus.increment(StatusCode.FATAL); } catch (InvalidParseOperationException e) { LOGGER.error("Cannot parse json", e); itemStatus.increment(StatusCode.KO); } return new ItemStatus(RUNNING_INGESTS_UPDATE_TASK_ID).setItemsStatus(RUNNING_INGESTS_UPDATE_TASK_ID, itemStatus); } RunningIngestsUpdateActionPlugin(); @VisibleForTesting  RunningIngestsUpdateActionPlugin(ProcessingManagementClientFactory processingManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory, StoreMetaDataUnitActionPlugin storeMetaDataUnitActionPlugin); @Override ItemStatus execute(WorkerParameters params, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler);  }