ExecutionDAOFacade { public boolean addEventExecution(EventExecution eventExecution) { boolean added = executionDAO.addEventExecution(eventExecution); if (added) { indexEventExecution(eventExecution); } return added; } @Inject  ExecutionDAOFacade(ExecutionDAO executionDAO, QueueDAO queueDAO, IndexDAO indexDAO,
        RateLimitingDAO rateLimitingDao, PollDataDAO pollDataDAO, ObjectMapper objectMapper, Configuration config); @PreDestroy void shutdownExecutorService(); Workflow getWorkflowById(String workflowId, boolean includeTasks); List<Workflow> getWorkflowsByCorrelationId(String workflowName, String correlationId, boolean includeTasks); List<Workflow> getWorkflowsByName(String workflowName, Long startTime, Long endTime); List<Workflow> getPendingWorkflowsByName(String workflowName, int version); List<String> getRunningWorkflowIds(String workflowName, int version); long getPendingWorkflowCount(String workflowName); String createWorkflow(Workflow workflow); String updateWorkflow(Workflow workflow); void removeFromPendingWorkflow(String workflowType, String workflowId); void removeWorkflow(String workflowId, boolean archiveWorkflow); void removeWorkflowWithExpiry(String workflowId, boolean archiveWorkflow, int ttlSeconds); void resetWorkflow(String workflowId); List<Task> createTasks(List<Task> tasks); List<Task> getTasksForWorkflow(String workflowId); Task getTaskById(String taskId); List<Task> getTasksByName(String taskName, String startKey, int count); List<Task> getPendingTasksForTaskType(String taskType); long getInProgressTaskCount(String taskDefName); void updateTask(Task task); void updateTasks(List<Task> tasks); void removeTask(String taskId); List<PollData> getTaskPollData(String taskName); List<PollData> getAllPollData(); PollData getTaskPollDataByDomain(String taskName, String domain); void updateTaskLastPoll(String taskName, String domain, String workerId); boolean addEventExecution(EventExecution eventExecution); void updateEventExecution(EventExecution eventExecution); void removeEventExecution(EventExecution eventExecution); boolean exceedsInProgressLimit(Task task); boolean exceedsRateLimitPerFrequency(Task task, TaskDef taskDef); void addTaskExecLog(List<TaskExecLog> logs); void addMessage(String queue, Message message); SearchResult<String> searchWorkflows(String query, String freeText, int start, int count, List<String> sort); SearchResult<String> searchTasks(String query, String freeText, int start, int count, List<String> sort); List<TaskExecLog> getTaskExecutionLogs(String taskId);  }
@Test public void testAddEventExecution() { when(executionDAO.addEventExecution(any())).thenReturn(false); boolean added = executionDAOFacade.addEventExecution(new EventExecution()); assertFalse(added); verify(indexDAO, never()).addEventExecution(any()); when(executionDAO.addEventExecution(any())).thenReturn(true); added = executionDAOFacade.addEventExecution(new EventExecution()); assertTrue(added); verify(indexDAO, times(1)).asyncAddEventExecution(any()); }