public void insertPausedStepInstanceAttempt(
      Connection conn,
      String workflowId,
      long version,
      long instanceId,
      long runId,
      String stepId,
      long stepAttemptId)
      throws SQLException {
    try (PreparedStatement stmt = conn.prepareStatement(CREATE_PAUSED_STEP_INSTANCE_ATTEMPT)) {
      int idx = 0;
      stmt.setString(++idx, workflowId);
      stmt.setLong(++idx, version);
      stmt.setLong(++idx, instanceId);
      stmt.setLong(++idx, runId);
      stmt.setString(++idx, stepId);
      stmt.setLong(++idx, stepAttemptId);
      stmt.executeUpdate();
    }
  }
@Test
  public void testInsertPausedStepInstanceAttempt() throws SQLException {
    when(workflowDao.getWorkflowDefinition(anyString(), anyString())).thenReturn(wfd);
    String workflowId = wfd.getPropertiesSnapshot().getWorkflowId();
    maestroStepBreakpointDao.insertPausedStepInstanceAttempt(
        conn,
        workflowId,
        TEST_WORKFLOW_VERSION1,
        TEST_WORKFLOW_INSTANCE1,
        TEST_WORKFLOW_RUN1,
        TEST_STEP_ID1,
        TEST_STEP_ATTEMPT1);
    conn.commit();
    conn.close();
    List<PausedStepAttempt> pausedStepAttempts =
        maestroStepBreakpointDao.getPausedStepAttempts(
            workflowId,
            TEST_WORKFLOW_VERSION1,
            TEST_WORKFLOW_INSTANCE1,
            TEST_WORKFLOW_RUN1,
            TEST_STEP_ID1,
            TEST_STEP_ATTEMPT1);
    assertEquals(1, pausedStepAttempts.size());
    // Also test remove cycle
    when(workflowDao.getWorkflowDefinition(anyString(), anyString())).thenReturn(wfd);
    maestroStepBreakpointDao.addStepBreakpoint(
        workflowId,
        Constants.MATCH_ALL_WORKFLOW_VERSIONS,
        Constants.MATCH_ALL_WORKFLOW_INSTANCES,
        Constants.MATCH_ALL_RUNS,
        TEST_STEP_ID1,
        Constants.MATCH_ALL_STEP_ATTEMPTS,
        TEST_USER);
    int cnt =
        maestroStepBreakpointDao.removeStepBreakpoint(
            workflowId,
            Constants.MATCH_ALL_WORKFLOW_VERSIONS,
            Constants.MATCH_ALL_WORKFLOW_INSTANCES,
            Constants.MATCH_ALL_RUNS,
            TEST_STEP_ID1,
            Constants.MATCH_ALL_STEP_ATTEMPTS,
            false);
    assertEquals(0, cnt);
    maestroStepBreakpointDao.addStepBreakpoint(
        workflowId,
        Constants.MATCH_ALL_WORKFLOW_VERSIONS,
        Constants.MATCH_ALL_WORKFLOW_INSTANCES,
        Constants.MATCH_ALL_RUNS,
        TEST_STEP_ID1,
        Constants.MATCH_ALL_STEP_ATTEMPTS,
        TEST_USER);
    cnt =
        maestroStepBreakpointDao.removeStepBreakpoint(
            workflowId,
            Constants.MATCH_ALL_WORKFLOW_VERSIONS,
            Constants.MATCH_ALL_WORKFLOW_INSTANCES,
            Constants.MATCH_ALL_RUNS,
            TEST_STEP_ID1,
            Constants.MATCH_ALL_STEP_ATTEMPTS,
            true);
    assertEquals(1, cnt);
    pausedStepAttempts =
        maestroStepBreakpointDao.getPausedStepAttempts(
            workflowId,
            TEST_WORKFLOW_VERSION1,
            TEST_WORKFLOW_INSTANCE1,
            TEST_WORKFLOW_RUN1,
            TEST_STEP_ID1,
            TEST_STEP_ATTEMPT1);
    assertEquals(0, pausedStepAttempts.size());
  }