RedisMetadataDAO extends BaseDynoDAO implements MetadataDAO { @Override public void removeWorkflowDef(String name, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "WorkflowDef name cannot be null"); Preconditions.checkNotNull(version, "Input version cannot be null"); Long result = dynoClient.hdel(nsKey(WORKFLOW_DEF, name), String.valueOf(version)); if (!result.equals(1L)) { throw new ApplicationException(Code.NOT_FOUND, String.format("Cannot remove the workflow - no such workflow" + " definition: %s version: %d", name, version)); } Optional<Integer> optionMaxVersion = getWorkflowMaxVersion(name); if (!optionMaxVersion.isPresent()) { dynoClient.srem(nsKey(WORKFLOW_DEF_NAMES), name); } recordRedisDaoRequests("removeWorkflowDef"); } @Inject  RedisMetadataDAO(DynoProxy dynoClient, ObjectMapper objectMapper, Configuration config); @Override void createTaskDef(TaskDef taskDef); @Override String updateTaskDef(TaskDef taskDef); @Override TaskDef getTaskDef(String name); @Override List<TaskDef> getAllTaskDefs(); @Override void removeTaskDef(String name); @Override void createWorkflowDef(WorkflowDef def); @Override void updateWorkflowDef(WorkflowDef def); @Override /* * @param name Name of the workflow definition * @return Latest version of workflow definition * @see WorkflowDef */ Optional<WorkflowDef> getLatestWorkflowDef(String name); List<WorkflowDef> getAllVersions(String name); @Override Optional<WorkflowDef> getWorkflowDef(String name, int version); @Override void removeWorkflowDef(String name, Integer version); List<String> findAll(); @Override List<WorkflowDef> getAllWorkflowDefs();  }
@Test(expected = ApplicationException.class) public void removeInvalidWorkflowDef() { WorkflowDef def = new WorkflowDef(); redisMetadataDAO.removeWorkflowDef("hello", 1); }