NumExecutionsDao { public int fetchNumExecutableFlows() throws ExecutorManagerException { try { return this.dbOperator.query(IntHandler.NUM_EXECUTIONS, new IntHandler()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching num executions", e); } } @Inject  NumExecutionsDao(final DatabaseOperator dbOperator); int fetchNumExecutableFlows(); int fetchNumExecutableFlows(final int projectId, final String flowId); int fetchNumExecutableNodes(final int projectId, final String jobId);  }
@Test public void testFetchNumExecutableFlows() throws Exception { final ExecutableFlow flow1 = TestUtils.createTestExecutableFlow("exectest1", "exec1"); flow1.setStatus(Status.PREPARING); this.executionFlowDao.uploadExecutableFlow(flow1); final ExecutableFlow flow2 = TestUtils.createTestExecutableFlow("exectest1", "exec2"); flow2.setStatus(Status.RUNNING); this.executionFlowDao.uploadExecutableFlow(flow2); final ExecutableFlow flow2b = TestUtils.createTestExecutableFlow("exectest1", "exec2"); flow2b.setStatus(Status.FAILED); this.executionFlowDao.uploadExecutableFlow(flow2b); final int count = this.numExecutionsDao.fetchNumExecutableFlows(); assertThat(count).isEqualTo(3); final int flow2Count = this.numExecutionsDao .fetchNumExecutableFlows(1, "derived-member-data-2"); assertThat(flow2Count).isEqualTo(2); }