@Test public void should_return_fatal_item_status_when_no_hash_in_batch_result() throws Exception { WorkflowBatchResults batchResults = getWorkflowBatchResults(emptyHashOutputExtra(getOutputPreservation(GENERATE))); TestHandlerIO testHandlerIO = new TestHandlerIO(); testHandlerIO.addOutputResult(0, batchResults); testHandlerIO.setInputs(batchResults); InputStream objectGroupStream = getClass().getResourceAsStream("/preservation/objectGroupDslResponse.json"); RequestResponse<JsonNode> responseOK = new RequestResponseOK<JsonNode>() .addResult(JsonHandler.getFromInputStream(objectGroupStream)) .setHttpCode(Response.Status.OK.getStatusCode()); given(metaDataClient.getObjectGroupByIdRaw(ArgumentMatchers.any())).willReturn(responseOK); List<ItemStatus> itemStatuses = plugin.executeList(parameter, testHandlerIO); assertThat(itemStatuses) .extracting(ItemStatus::getGlobalStatus) .containsOnly(FATAL); }
@Override public List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler) { LOGGER.info("Starting {}", PLUGIN_NAME); WorkflowBatchResults results = (WorkflowBatchResults) handler.getInput(0); List<WorkflowBatchResult> workflowBatchResults = results.getWorkflowBatchResults(); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { return workflowBatchResults.stream() .map(w -> updateObjectGroupModel(w, metaDataClient)) .collect(Collectors.toList()); } }
PreservationUpdateObjectGroupPlugin extends ActionHandler { @Override public List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler) { LOGGER.info("Starting {}", PLUGIN_NAME); WorkflowBatchResults results = (WorkflowBatchResults) handler.getInput(0); List<WorkflowBatchResult> workflowBatchResults = results.getWorkflowBatchResults(); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { return workflowBatchResults.stream() .map(w -> updateObjectGroupModel(w, metaDataClient)) .collect(Collectors.toList()); } } }
PreservationUpdateObjectGroupPlugin extends ActionHandler { @Override public List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler) { LOGGER.info("Starting {}", PLUGIN_NAME); WorkflowBatchResults results = (WorkflowBatchResults) handler.getInput(0); List<WorkflowBatchResult> workflowBatchResults = results.getWorkflowBatchResults(); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { return workflowBatchResults.stream() .map(w -> updateObjectGroupModel(w, metaDataClient)) .collect(Collectors.toList()); } } PreservationUpdateObjectGroupPlugin(); @VisibleForTesting  PreservationUpdateObjectGroupPlugin(MetaDataClientFactory metaDataClientFactory); }
PreservationUpdateObjectGroupPlugin extends ActionHandler { @Override public List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler) { LOGGER.info("Starting {}", PLUGIN_NAME); WorkflowBatchResults results = (WorkflowBatchResults) handler.getInput(0); List<WorkflowBatchResult> workflowBatchResults = results.getWorkflowBatchResults(); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { return workflowBatchResults.stream() .map(w -> updateObjectGroupModel(w, metaDataClient)) .collect(Collectors.toList()); } } PreservationUpdateObjectGroupPlugin(); @VisibleForTesting  PreservationUpdateObjectGroupPlugin(MetaDataClientFactory metaDataClientFactory); @Override List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler); }
PreservationUpdateObjectGroupPlugin extends ActionHandler { @Override public List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler) { LOGGER.info("Starting {}", PLUGIN_NAME); WorkflowBatchResults results = (WorkflowBatchResults) handler.getInput(0); List<WorkflowBatchResult> workflowBatchResults = results.getWorkflowBatchResults(); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { return workflowBatchResults.stream() .map(w -> updateObjectGroupModel(w, metaDataClient)) .collect(Collectors.toList()); } } PreservationUpdateObjectGroupPlugin(); @VisibleForTesting  PreservationUpdateObjectGroupPlugin(MetaDataClientFactory metaDataClientFactory); @Override List<ItemStatus> executeList(WorkerParameters workerParameters, HandlerIO handler);  }