@Test public void should_delete_distribution_file_after_transfer() throws Exception { InputStream query = PropertiesUtils.getResourceAsStream("computeInheritedRules/query.json"); File distributionFile = temporaryFolder.newFile(); WorkerParameters workerParameters = mock(WorkerParameters.class); JsonNode unitResponse = JsonHandler.getFromInputStream(PropertiesUtils.getResourceAsStream("computeInheritedRules/unit.json")); when(metaDataClient.selectUnits(any())).thenReturn(unitResponse); TestHandlerIO handler = new TestHandlerIO(); handler.setJsonFromWorkspace("query.json", JsonHandler.getFromInputStream(query)); handler.setNewLocalFile(distributionFile); ItemStatus itemStatus = computeInheritedRulesPreparationPlugin.execute(workerParameters, handler); StatusCode globalStatus = itemStatus.getGlobalStatus(); assertThat(globalStatus).isEqualTo(StatusCode.OK); File transferredFileToWorkspace = handler.getTransferedFileToWorkspace(UNITS_JSONL_FILE); assertThat(Files.exists(transferredFileToWorkspace.toPath())).isEqualTo(false); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { JsonNode dslQuery = handler.getJsonFromWorkspace("query.json"); try { process(handler, dslQuery); } catch (ComputedInheritedRulesException e) { LOGGER.error(String.format("ComputeInheritedRules preparation failed with status [%s]", e.getStatusCode()), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, e.getStatusCode(), error); } return buildItemStatus(PLUGIN_NAME, StatusCode.OK, null); }
ComputeInheritedRulesPreparationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { JsonNode dslQuery = handler.getJsonFromWorkspace("query.json"); try { process(handler, dslQuery); } catch (ComputedInheritedRulesException e) { LOGGER.error(String.format("ComputeInheritedRules preparation failed with status [%s]", e.getStatusCode()), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, e.getStatusCode(), error); } return buildItemStatus(PLUGIN_NAME, StatusCode.OK, null); } }
ComputeInheritedRulesPreparationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { JsonNode dslQuery = handler.getJsonFromWorkspace("query.json"); try { process(handler, dslQuery); } catch (ComputedInheritedRulesException e) { LOGGER.error(String.format("ComputeInheritedRules preparation failed with status [%s]", e.getStatusCode()), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, e.getStatusCode(), error); } return buildItemStatus(PLUGIN_NAME, StatusCode.OK, null); } ComputeInheritedRulesPreparationPlugin(); @VisibleForTesting  ComputeInheritedRulesPreparationPlugin(MetaDataClientFactory metaDataClientFactory); }
ComputeInheritedRulesPreparationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { JsonNode dslQuery = handler.getJsonFromWorkspace("query.json"); try { process(handler, dslQuery); } catch (ComputedInheritedRulesException e) { LOGGER.error(String.format("ComputeInheritedRules preparation failed with status [%s]", e.getStatusCode()), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, e.getStatusCode(), error); } return buildItemStatus(PLUGIN_NAME, StatusCode.OK, null); } ComputeInheritedRulesPreparationPlugin(); @VisibleForTesting  ComputeInheritedRulesPreparationPlugin(MetaDataClientFactory metaDataClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); }
ComputeInheritedRulesPreparationPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { JsonNode dslQuery = handler.getJsonFromWorkspace("query.json"); try { process(handler, dslQuery); } catch (ComputedInheritedRulesException e) { LOGGER.error(String.format("ComputeInheritedRules preparation failed with status [%s]", e.getStatusCode()), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, e.getStatusCode(), error); } return buildItemStatus(PLUGIN_NAME, StatusCode.OK, null); } ComputeInheritedRulesPreparationPlugin(); @VisibleForTesting  ComputeInheritedRulesPreparationPlugin(MetaDataClientFactory metaDataClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler);  }