@Test public void execute_whenExportOKThenExpectOK() throws Exception { HashSetValuedHashMap<String, String> attachments = new HashSetValuedHashMap<>(); attachments.putAll("id1", Arrays.asList("id2", "id3")); attachments.putAll("id2", Arrays.asList("id3", "id4")); HashSetValuedHashMap<String, String> detachments = new HashSetValuedHashMap<>(); detachments.put("id1", "id5"); detachments.put("id3", "id5"); ReclassificationOrders reclassificationOrders = new ReclassificationOrders(attachments, detachments); doReturn(reclassificationOrders).when(handlerIO).getInput(0); ItemStatus itemStatus = reclassificationPreparationLoadHandlerPlugin.execute(parameters, handlerIO); assertThat(itemStatus.getGlobalStatus()).isEqualTo(StatusCode.OK); assertThat(transferredFiles).hasSize(4); assertThat(JsonHandler .getFromFile(transferredFiles.get("UnitsToDetach/id1"), String[].class)) .containsExactlyInAnyOrder("id5"); assertThat(JsonHandler .getFromFile(transferredFiles.get("UnitsToDetach/id3"), String[].class)) .containsExactlyInAnyOrder("id5"); assertThat(JsonHandler .getFromFile(transferredFiles.get("UnitsToAttach/id1"), String[].class)) .containsExactlyInAnyOrder("id2", "id3"); assertThat(JsonHandler .getFromFile(transferredFiles.get("UnitsToAttach/id2"), String[].class)) .containsExactlyInAnyOrder("id3", "id4"); verify(metaDataClient) .exportReclassificationChildNodes(eq(new HashSet<>(Arrays.asList("id1", "id2", "id3"))), any(), any()); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); prepareUpdates(reclassificationOrders, handler); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification update distribution failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification update distribution succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, StatusCode.OK, null); }
ReclassificationPreparationUpdateDistributionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); prepareUpdates(reclassificationOrders, handler); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification update distribution failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification update distribution succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, StatusCode.OK, null); } }
ReclassificationPreparationUpdateDistributionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); prepareUpdates(reclassificationOrders, handler); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification update distribution failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification update distribution succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, StatusCode.OK, null); } ReclassificationPreparationUpdateDistributionHandler(); @VisibleForTesting  ReclassificationPreparationUpdateDistributionHandler(MetaDataClientFactory metaDataClientFactory); }
ReclassificationPreparationUpdateDistributionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); prepareUpdates(reclassificationOrders, handler); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification update distribution failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification update distribution succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, StatusCode.OK, null); } ReclassificationPreparationUpdateDistributionHandler(); @VisibleForTesting  ReclassificationPreparationUpdateDistributionHandler(MetaDataClientFactory metaDataClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId(); }
ReclassificationPreparationUpdateDistributionHandler extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { ReclassificationOrders reclassificationOrders = loadReclassificationOrders(handler); prepareUpdates(reclassificationOrders, handler); } catch (ProcessingStatusException e) { LOGGER.error("Reclassification update distribution failed with status [" + e.getStatusCode() + "]", e); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, e.getStatusCode(), e.getEventDetails()); } LOGGER.info("Reclassification update distribution succeeded"); return buildItemStatus(RECLASSIFICATION_PREPARATION_UPDATE_DISTRIBUTION, StatusCode.OK, null); } ReclassificationPreparationUpdateDistributionHandler(); @VisibleForTesting  ReclassificationPreparationUpdateDistributionHandler(MetaDataClientFactory metaDataClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); static String getId();  }