@Test public void execute_GivenNotFoundUnitsThenExpectFatal() throws Exception { HashSetValuedHashMap<String, String> attachments = new HashSetValuedHashMap<>(); attachments.put("id1", "id2"); HashSetValuedHashMap<String, String> detachments = new HashSetValuedHashMap<>(); detachments.put("id1", "id3"); ReclassificationOrders reclassificationOrders = new ReclassificationOrders(attachments, detachments); doReturn(reclassificationOrders).when(handlerIO).getInput(0); Map<String, UnitGraphInfo> unitGraphInfoMap = new HashMap<>(); unitGraphInfoMap.put("id1", null); addUnitGraph(unitGraphInfoMap, "id2", UnitType.INGEST, "id4"); unitGraphInfoMap.put("id3", null); addUnitGraph(unitGraphInfoMap, "id4", UnitType.INGEST, "id5"); unitGraphInfoMap.put("id5", null); doReturn(unitGraphInfoMap).when(unitGraphInfoLoader).selectAllUnitGraphByIds(eq(metaDataClient), any()); ItemStatus itemStatus = reclassificationPreparationCheckGraphHandler.execute(parameters, handlerIO); assertThat(itemStatus.getGlobalStatus()).isEqualTo(StatusCode.FATAL); ReclassificationEventDetails eventDetails = JsonHandler.getFromString(itemStatus.getEvDetailData(), ReclassificationEventDetails.class); assertThat(eventDetails.getError()).isEqualTo(COULD_NOT_LOAD_UNITS); assertThat(eventDetails.getNotFoundUnits()).containsExactlyInAnyOrder("id1", "id3", "id5"); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); checkGraphCoherence(reclassificationOrders); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification graph check failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification graph check succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, StatusCode.OK, null); }
ReclassificationPreparationCheckGraphHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); checkGraphCoherence(reclassificationOrders); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification graph check failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification graph check succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, StatusCode.OK, null); } }
ReclassificationPreparationCheckGraphHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); checkGraphCoherence(reclassificationOrders); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification graph check failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification graph check succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, StatusCode.OK, null); } ReclassificationPreparationCheckGraphHandler(); @VisibleForTesting  ReclassificationPreparationCheckGraphHandler(
        MetaDataClientFactory metaDataClientFactory, UnitGraphInfoLoader unitGraphInfoLoader,
        int maxGuildListSizeInLogbookOperation); }
ReclassificationPreparationCheckGraphHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); checkGraphCoherence(reclassificationOrders); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification graph check failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification graph check succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, StatusCode.OK, null); } ReclassificationPreparationCheckGraphHandler(); @VisibleForTesting  ReclassificationPreparationCheckGraphHandler(
        MetaDataClientFactory metaDataClientFactory, UnitGraphInfoLoader unitGraphInfoLoader,
        int maxGuildListSizeInLogbookOperation); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId(); }
ReclassificationPreparationCheckGraphHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); checkGraphCoherence(reclassificationOrders); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification graph check failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification graph check succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_CHECK_GRAPH, StatusCode.OK, null); } ReclassificationPreparationCheckGraphHandler(); @VisibleForTesting  ReclassificationPreparationCheckGraphHandler(
        MetaDataClientFactory metaDataClientFactory, UnitGraphInfoLoader unitGraphInfoLoader,
        int maxGuildListSizeInLogbookOperation); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId();  }