public StepBreakpoint addStepBreakpoint(
      String workflowId,
      long version,
      long instanceId,
      long runId,
      String stepId,
      long stepAttemptId,
      User user) {
    final String revisedWorkflowId = getRevisedWorkflowId(workflowId, stepId, true);
    return withMetricLogError(
        () ->
            withRetryableTransaction(
                conn -> {
                  try (PreparedStatement stmt = conn.prepareStatement(ADD_STEP_BREAKPOINT)) {
                    int idx = 0;
                    stmt.setString(++idx, revisedWorkflowId);
                    stmt.setLong(++idx, version);
                    stmt.setLong(++idx, instanceId);
                    stmt.setLong(++idx, runId);
                    stmt.setString(++idx, stepId);
                    stmt.setLong(++idx, stepAttemptId);
                    stmt.setString(++idx, toJson(user));
                    try (ResultSet rs = stmt.executeQuery()) {
                      if (rs.next()) {
                        return stepBreakpointFromResultSet(rs);
                      } else {
                        throw new MaestroBadRequestException(
                            Collections.emptyList(),
                            "Breakpoint could not be set with identifier [%s][%d][%d][%d][%s][%d]",
                            workflowId,
                            version,
                            instanceId,
                            runId,
                            stepId,
                            stepAttemptId);
                      }
                    }
                  }
                }),
        "addStepBreakpointForStepIdentifier",
        "Failed to addStepBreakpointForStepIdentifier [{}][{}][{}][{}][{}][{}]",
        workflowId,
        version,
        instanceId,
        runId,
        stepId,
        stepAttemptId);
  }
@Test
  public void testAddBreakpoint() {
    when(workflowDao.getWorkflowDefinition(anyString(), anyString())).thenReturn(wfd);
    StepBreakpoint bp =
        maestroStepBreakpointDao.addStepBreakpoint(
            TEST_WORKFLOW_ID2,
            TEST_WORKFLOW_VERSION1,
            TEST_WORKFLOW_INSTANCE1,
            Constants.MATCH_ALL_RUNS,
            TEST_STEP_ID1,
            Constants.MATCH_ALL_STEP_ATTEMPTS,
            TEST_USER);
    assertEquals(TEST_WORKFLOW_ID2, bp.getWorkflowId());
    assertEquals(TEST_STEP_ID1, bp.getStepId());
    assertEquals(TEST_WORKFLOW_INSTANCE1, bp.getWorkflowInstanceId().longValue());
    assertEquals(TEST_WORKFLOW_VERSION1, bp.getWorkflowVersionId().longValue());
    assertNull(bp.getWorkflowRunId());
    assertNull(bp.getStepAttemptId());
    bp =
        maestroStepBreakpointDao.addStepBreakpoint(
            TEST_WORKFLOW_ID1,
            Constants.MATCH_ALL_WORKFLOW_VERSIONS,
            Constants.MATCH_ALL_WORKFLOW_INSTANCES,
            Constants.MATCH_ALL_RUNS,
            TEST_STEP_ID1,
            Constants.MATCH_ALL_STEP_ATTEMPTS,
            TEST_USER);
    assertEquals(TEST_WORKFLOW_ID1, bp.getWorkflowId());
    assertEquals(TEST_STEP_ID1, bp.getStepId());
    assertNull(bp.getWorkflowVersionId());
    assertNull(bp.getWorkflowInstanceId());
    assertNull(bp.getWorkflowRunId());
    assertNull(bp.getStepAttemptId());
  }