@Test @RunWithCustomExecutor public void testExecute_OnInvalidJsonRequestThenKO() throws Exception { doReturn(new ByteArrayInputStream("INVALID_DATA".getBytes())) .when(handlerIO).getInputStreamFromWorkspace("request.json"); ItemStatus execute = instance.execute(parameters, handlerIO); assertThat(execute.getGlobalStatus()).isEqualTo(StatusCode.KO); verifyNoMoreInteractions(metaDataClient); assertThat(writtenFiles).isEmpty(); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { EliminationRequestBody eliminationRequestBody = loadRequestJsonFromWorkspace(handler); process(eliminationRequestBody, param, handler); LOGGER.info("Elimination analysis preparation succeeded"); EliminationEventDetails eventDetails = new EliminationEventDetails() .setExpirationDate(eliminationRequestBody.getDate()); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, StatusCode.OK, eventDetails); } catch (ProcessingStatusException e) { LOGGER.error("Elimination analysis preparation failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, e.getStatusCode(), e.getEventDetails()); } }
EliminationAnalysisPreparationHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { EliminationRequestBody eliminationRequestBody = loadRequestJsonFromWorkspace(handler); process(eliminationRequestBody, param, handler); LOGGER.info("Elimination analysis preparation succeeded"); EliminationEventDetails eventDetails = new EliminationEventDetails() .setExpirationDate(eliminationRequestBody.getDate()); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, StatusCode.OK, eventDetails); } catch (ProcessingStatusException e) { LOGGER.error("Elimination analysis preparation failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, e.getStatusCode(), e.getEventDetails()); } } }
EliminationAnalysisPreparationHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { EliminationRequestBody eliminationRequestBody = loadRequestJsonFromWorkspace(handler); process(eliminationRequestBody, param, handler); LOGGER.info("Elimination analysis preparation succeeded"); EliminationEventDetails eventDetails = new EliminationEventDetails() .setExpirationDate(eliminationRequestBody.getDate()); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, StatusCode.OK, eventDetails); } catch (ProcessingStatusException e) { LOGGER.error("Elimination analysis preparation failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, e.getStatusCode(), e.getEventDetails()); } } EliminationAnalysisPreparationHandler(); @VisibleForTesting  EliminationAnalysisPreparationHandler(
        MetaDataClientFactory metaDataClientFactory,
        EliminationAnalysisService eliminationAnalysisService); }
EliminationAnalysisPreparationHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { EliminationRequestBody eliminationRequestBody = loadRequestJsonFromWorkspace(handler); process(eliminationRequestBody, param, handler); LOGGER.info("Elimination analysis preparation succeeded"); EliminationEventDetails eventDetails = new EliminationEventDetails() .setExpirationDate(eliminationRequestBody.getDate()); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, StatusCode.OK, eventDetails); } catch (ProcessingStatusException e) { LOGGER.error("Elimination analysis preparation failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, e.getStatusCode(), e.getEventDetails()); } } EliminationAnalysisPreparationHandler(); @VisibleForTesting  EliminationAnalysisPreparationHandler(
        MetaDataClientFactory metaDataClientFactory,
        EliminationAnalysisService eliminationAnalysisService); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId(); }
EliminationAnalysisPreparationHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { EliminationRequestBody eliminationRequestBody = loadRequestJsonFromWorkspace(handler); process(eliminationRequestBody, param, handler); LOGGER.info("Elimination analysis preparation succeeded"); EliminationEventDetails eventDetails = new EliminationEventDetails() .setExpirationDate(eliminationRequestBody.getDate()); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, StatusCode.OK, eventDetails); } catch (ProcessingStatusException e) { LOGGER.error("Elimination analysis preparation failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(ELIMINATION_ANALYSIS_PREPARATION, e.getStatusCode(), e.getEventDetails()); } } EliminationAnalysisPreparationHandler(); @VisibleForTesting  EliminationAnalysisPreparationHandler(
        MetaDataClientFactory metaDataClientFactory,
        EliminationAnalysisService eliminationAnalysisService); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId();  }