public synchronized void insertStepDatabase( ObjectId id_transformation, ObjectId id_step, ObjectId id_database ) throws KettleException {
    // First check if the relationship is already there.
    // There is no need to store it twice!
    RowMetaAndData check = getStepDatabase( id_step );
    if ( check.getInteger( 0 ) == null ) {
      RowMetaAndData table = new RowMetaAndData();

      table.addValue(
        new ValueMetaInteger(
          KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_TRANSFORMATION ),
        id_transformation );
      table.addValue( new ValueMetaInteger(
        KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_STEP ), id_step );
      table
        .addValue(
          new ValueMetaInteger(
            KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_DATABASE ),
          id_database );

      connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_STEP_DATABASE, table );
    }
  }
@Test
  public void testInsertStepDatabase() throws KettleException {
    doReturn( getNullIntegerRow() ).when( repo.connectionDelegate ).getOneRow(
      anyString(), anyString(), any( ObjectId.class ) );
    ArgumentCaptor<String> argumentTableName = ArgumentCaptor.forClass( String.class );
    ArgumentCaptor<RowMetaAndData> argumentTableData = ArgumentCaptor.forClass( RowMetaAndData.class );
    doNothing().when( repo.connectionDelegate ).insertTableRow( argumentTableName.capture(), argumentTableData.capture() );

    repo.insertStepDatabase( new LongObjectId( 654 ), new LongObjectId( 765 ), new LongObjectId( 876 ) );

    RowMetaAndData insertRecord = argumentTableData.getValue();
    assertEquals( KettleDatabaseRepository.TABLE_R_STEP_DATABASE, argumentTableName.getValue() );
    assertEquals( 3, insertRecord.size() );
    assertEquals( ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta( 0 ).getType() );
    assertEquals( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_TRANSFORMATION, insertRecord.getValueMeta( 0 ).getName() );
    assertEquals( Long.valueOf( 654 ), insertRecord.getInteger( 0 ) );
    assertEquals( ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta( 1 ).getType() );
    assertEquals( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_STEP, insertRecord.getValueMeta( 1 ).getName() );
    assertEquals( Long.valueOf( 765 ), insertRecord.getInteger( 1 ) );
    assertEquals( ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta( 2 ).getType() );
    assertEquals( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_DATABASE, insertRecord.getValueMeta( 2 ).getName() );
    assertEquals( Long.valueOf( 876 ), insertRecord.getInteger( 2 ) );
  }