@Test public void checkManifestHavingObjectOrNot() throws Exception { final CheckNoObjectsActionHandler handler = new CheckNoObjectsActionHandler(); when(handlerIO.getInputStreamFromWorkspace(any())).thenReturn(sedaOK); WorkerParameters parameters = params.putParameterValue(WorkerParameterName.workflowStatusKo, StatusCode.OK.name()) .putParameterValue(WorkerParameterName.logBookTypeProcess, LogbookTypeProcess.INGEST.name()) .setObjectNameList(Lists.newArrayList("objectName.json")); final ItemStatus response = handler.execute(parameters, handlerIO); handler.close(); assertEquals(response.getGlobalStatus(), StatusCode.OK); when(handlerIO.getInputStreamFromWorkspace(any())).thenReturn(sedaKO); final ItemStatus responseKO = handler.execute(parameters, handlerIO); handler.close(); assertEquals(responseKO.getGlobalStatus(), StatusCode.KO); }
@Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) { checkMandatoryParameters(params); final ItemStatus itemStatus = new ItemStatus(HANDLER_ID); try { checkMandatoryIOParameter(handlerIO); if (!checkNoObjectInManifest(handlerIO)) { itemStatus.increment(StatusCode.KO); } else { itemStatus.increment(StatusCode.OK); } } catch (final ProcessingException e) { LOGGER.error(e); itemStatus.increment(StatusCode.FATAL); } return new ItemStatus(HANDLER_ID).setItemsStatus(HANDLER_ID, itemStatus); }
CheckNoObjectsActionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) { checkMandatoryParameters(params); final ItemStatus itemStatus = new ItemStatus(HANDLER_ID); try { checkMandatoryIOParameter(handlerIO); if (!checkNoObjectInManifest(handlerIO)) { itemStatus.increment(StatusCode.KO); } else { itemStatus.increment(StatusCode.OK); } } catch (final ProcessingException e) { LOGGER.error(e); itemStatus.increment(StatusCode.FATAL); } return new ItemStatus(HANDLER_ID).setItemsStatus(HANDLER_ID, itemStatus); } }
CheckNoObjectsActionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) { checkMandatoryParameters(params); final ItemStatus itemStatus = new ItemStatus(HANDLER_ID); try { checkMandatoryIOParameter(handlerIO); if (!checkNoObjectInManifest(handlerIO)) { itemStatus.increment(StatusCode.KO); } else { itemStatus.increment(StatusCode.OK); } } catch (final ProcessingException e) { LOGGER.error(e); itemStatus.increment(StatusCode.FATAL); } return new ItemStatus(HANDLER_ID).setItemsStatus(HANDLER_ID, itemStatus); } CheckNoObjectsActionHandler(); }
CheckNoObjectsActionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) { checkMandatoryParameters(params); final ItemStatus itemStatus = new ItemStatus(HANDLER_ID); try { checkMandatoryIOParameter(handlerIO); if (!checkNoObjectInManifest(handlerIO)) { itemStatus.increment(StatusCode.KO); } else { itemStatus.increment(StatusCode.OK); } } catch (final ProcessingException e) { LOGGER.error(e); itemStatus.increment(StatusCode.FATAL); } return new ItemStatus(HANDLER_ID).setItemsStatus(HANDLER_ID, itemStatus); } CheckNoObjectsActionHandler(); static final String getId(); @Override ItemStatus execute(WorkerParameters params, HandlerIO handlerIO); @Override void checkMandatoryIOParameter(HandlerIO handler); }
CheckNoObjectsActionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) { checkMandatoryParameters(params); final ItemStatus itemStatus = new ItemStatus(HANDLER_ID); try { checkMandatoryIOParameter(handlerIO); if (!checkNoObjectInManifest(handlerIO)) { itemStatus.increment(StatusCode.KO); } else { itemStatus.increment(StatusCode.OK); } } catch (final ProcessingException e) { LOGGER.error(e); itemStatus.increment(StatusCode.FATAL); } return new ItemStatus(HANDLER_ID).setItemsStatus(HANDLER_ID, itemStatus); } CheckNoObjectsActionHandler(); static final String getId(); @Override ItemStatus execute(WorkerParameters params, HandlerIO handlerIO); @Override void checkMandatoryIOParameter(HandlerIO handler);  }