@Test public void testSaveRep() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(); tableOutputMeta.loadXML( getTestNode(), databases, metaStore ); StringObjectId id_step = new StringObjectId( "stepid" ); StringObjectId id_transformation = new StringObjectId( "transid" ); Repository rep = mock( Repository.class ); tableOutputMeta.saveRep( rep, metaStore, id_transformation, id_step ); verify( rep ).saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", null ); verify( rep ).saveStepAttribute( id_transformation, id_step, "schema", "public" ); verify( rep ).saveStepAttribute( id_transformation, id_step, "table", "sales_csv" ); verify( rep ).saveStepAttribute( id_transformation, id_step, "commit", "1000" ); verify( rep ).saveStepAttribute( id_transformation, id_step, "truncate", true ); verify( rep ).saveStepAttribute( id_transformation, id_step, "ignore_errors", false ); verify( rep ).saveStepAttribute( id_transformation, id_step, "use_batch", true ); verify( rep ).saveStepAttribute( id_transformation, id_step, "specify_fields", true ); verify( rep ).saveStepAttribute( id_transformation, id_step, "partitioning_enabled", false ); verify( rep ).saveStepAttribute( id_transformation, id_step, "partitioning_field", null ); verify( rep ).saveStepAttribute( id_transformation, id_step, "partitioning_daily", false ); verify( rep ).saveStepAttribute( id_transformation, id_step, "partitioning_monthly", true ); verify( rep ).saveStepAttribute( id_transformation, id_step, "tablename_in_field", false ); verify( rep ).saveStepAttribute( id_transformation, id_step, "tablename_field", null ); verify( rep ).saveStepAttribute( id_transformation, id_step, "tablename_in_table", true ); verify( rep ).saveStepAttribute( id_transformation, id_step, "return_keys", false ); verify( rep ).saveStepAttribute( id_transformation, id_step, "return_field", null ); verify( rep ).saveStepAttribute( id_transformation, id_step, 0, "column_name", "ORDERNUMBER" ); verify( rep ).saveStepAttribute( id_transformation, id_step, 0, "stream_name", "ORDERNUMBER" ); verify( rep ).saveStepAttribute( id_transformation, id_step, 1, "column_name", "QUANTITYORDERED" ); verify( rep ).saveStepAttribute( id_transformation, id_step, 1, "stream_name", "QUANTITYORDERED" ); verify( rep ).saveStepAttribute( id_transformation, id_step, 2, "column_name", "PRICEEACH" ); verify( rep ).saveStepAttribute( id_transformation, id_step, 2, "stream_name", "PRICEEACH" ); verifyNoMoreInteractions( rep ); }
public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta ); rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName ); rep.saveStepAttribute( id_transformation, id_step, "table", tableName ); rep.saveStepAttribute( id_transformation, id_step, "commit", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "truncate", truncateTable ); rep.saveStepAttribute( id_transformation, id_step, "ignore_errors", ignoreErrors ); rep.saveStepAttribute( id_transformation, id_step, "use_batch", useBatchUpdate ); rep.saveStepAttribute( id_transformation, id_step, "specify_fields", specifyFields ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_enabled", partitioningEnabled ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_field", partitioningField ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_daily", partitioningDaily ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_monthly", partitioningMonthly ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_field", tableNameInField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_field", tableNameField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_table", tableNameInTable ); rep.saveStepAttribute( id_transformation, id_step, "return_keys", returningGeneratedKeys ); rep.saveStepAttribute( id_transformation, id_step, "return_field", generatedKeyField ); int nrRows = ( fieldDatabase.length < fieldStream.length ? fieldStream.length : fieldDatabase.length ); for ( int idx = 0; idx < nrRows; idx++ ) { String columnName = ( idx < fieldDatabase.length ? fieldDatabase[idx] : "" ); String streamName = ( idx < fieldStream.length ? fieldStream[idx] : "" ); rep.saveStepAttribute( id_transformation, id_step, idx, "column_name", columnName ); rep.saveStepAttribute( id_transformation, id_step, idx, "stream_name", streamName ); } if ( databaseMeta != null ) { rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() ); } } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } }
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta ); rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName ); rep.saveStepAttribute( id_transformation, id_step, "table", tableName ); rep.saveStepAttribute( id_transformation, id_step, "commit", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "truncate", truncateTable ); rep.saveStepAttribute( id_transformation, id_step, "ignore_errors", ignoreErrors ); rep.saveStepAttribute( id_transformation, id_step, "use_batch", useBatchUpdate ); rep.saveStepAttribute( id_transformation, id_step, "specify_fields", specifyFields ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_enabled", partitioningEnabled ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_field", partitioningField ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_daily", partitioningDaily ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_monthly", partitioningMonthly ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_field", tableNameInField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_field", tableNameField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_table", tableNameInTable ); rep.saveStepAttribute( id_transformation, id_step, "return_keys", returningGeneratedKeys ); rep.saveStepAttribute( id_transformation, id_step, "return_field", generatedKeyField ); int nrRows = ( fieldDatabase.length < fieldStream.length ? fieldStream.length : fieldDatabase.length ); for ( int idx = 0; idx < nrRows; idx++ ) { String columnName = ( idx < fieldDatabase.length ? fieldDatabase[idx] : "" ); String streamName = ( idx < fieldStream.length ? fieldStream[idx] : "" ); rep.saveStepAttribute( id_transformation, id_step, idx, "column_name", columnName ); rep.saveStepAttribute( id_transformation, id_step, idx, "stream_name", streamName ); } if ( databaseMeta != null ) { rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() ); } } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } } }
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta ); rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName ); rep.saveStepAttribute( id_transformation, id_step, "table", tableName ); rep.saveStepAttribute( id_transformation, id_step, "commit", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "truncate", truncateTable ); rep.saveStepAttribute( id_transformation, id_step, "ignore_errors", ignoreErrors ); rep.saveStepAttribute( id_transformation, id_step, "use_batch", useBatchUpdate ); rep.saveStepAttribute( id_transformation, id_step, "specify_fields", specifyFields ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_enabled", partitioningEnabled ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_field", partitioningField ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_daily", partitioningDaily ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_monthly", partitioningMonthly ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_field", tableNameInField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_field", tableNameField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_table", tableNameInTable ); rep.saveStepAttribute( id_transformation, id_step, "return_keys", returningGeneratedKeys ); rep.saveStepAttribute( id_transformation, id_step, "return_field", generatedKeyField ); int nrRows = ( fieldDatabase.length < fieldStream.length ? fieldStream.length : fieldDatabase.length ); for ( int idx = 0; idx < nrRows; idx++ ) { String columnName = ( idx < fieldDatabase.length ? fieldDatabase[idx] : "" ); String streamName = ( idx < fieldStream.length ? fieldStream[idx] : "" ); rep.saveStepAttribute( id_transformation, id_step, idx, "column_name", columnName ); rep.saveStepAttribute( id_transformation, id_step, idx, "stream_name", streamName ); } if ( databaseMeta != null ) { rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() ); } } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } } TableOutputMeta(); }
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta ); rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName ); rep.saveStepAttribute( id_transformation, id_step, "table", tableName ); rep.saveStepAttribute( id_transformation, id_step, "commit", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "truncate", truncateTable ); rep.saveStepAttribute( id_transformation, id_step, "ignore_errors", ignoreErrors ); rep.saveStepAttribute( id_transformation, id_step, "use_batch", useBatchUpdate ); rep.saveStepAttribute( id_transformation, id_step, "specify_fields", specifyFields ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_enabled", partitioningEnabled ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_field", partitioningField ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_daily", partitioningDaily ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_monthly", partitioningMonthly ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_field", tableNameInField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_field", tableNameField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_table", tableNameInTable ); rep.saveStepAttribute( id_transformation, id_step, "return_keys", returningGeneratedKeys ); rep.saveStepAttribute( id_transformation, id_step, "return_field", generatedKeyField ); int nrRows = ( fieldDatabase.length < fieldStream.length ? fieldStream.length : fieldDatabase.length ); for ( int idx = 0; idx < nrRows; idx++ ) { String columnName = ( idx < fieldDatabase.length ? fieldDatabase[idx] : "" ); String streamName = ( idx < fieldStream.length ? fieldStream[idx] : "" ); rep.saveStepAttribute( id_transformation, id_step, idx, "column_name", columnName ); rep.saveStepAttribute( id_transformation, id_step, idx, "stream_name", streamName ); } if ( databaseMeta != null ) { rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() ); } } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } } TableOutputMeta(); String getGeneratedKeyField(); void setGeneratedKeyField( String generatedKeyField ); boolean isReturningGeneratedKeys(); void setReturningGeneratedKeys( boolean returningGeneratedKeys ); boolean isTableNameInTable(); void setTableNameInTable( boolean tableNameInTable ); String getTableNameField(); void setTableNameField( String tableNameField ); boolean isTableNameInField(); void setTableNameInField( boolean tableNameInField ); boolean isPartitioningDaily(); void setPartitioningDaily( boolean partitioningDaily ); boolean isPartitioningMonthly(); void setPartitioningMonthly( boolean partitioningMontly ); boolean isPartitioningEnabled(); void setPartitioningEnabled( boolean partitioningEnabled ); String getPartitioningField(); void setPartitioningField( String partitioningField ); void allocate( int nrRows ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); String getCommitSize(); void setCommitSize( int commitSizeInt ); void setCommitSize( String commitSize ); String getTableName(); void setTableName( String tableName ); @Deprecated String getTablename(); @Deprecated void setTablename( String tablename ); boolean truncateTable(); void setTruncateTable( boolean truncateTable ); void setIgnoreErrors( boolean ignoreErrors ); boolean ignoreErrors(); void setSpecifyFields( boolean specifyFields ); boolean specifyFields(); void setUseBatchUpdate( boolean useBatchUpdate ); boolean useBatchUpdate(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep,
      VariableSpace space, Repository repository, IMetaStore metaStore ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
      RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
      Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
      TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
      RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
      IMetaStore metaStore ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
      Repository repository, IMetaStore metaStore ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String tk,
      boolean use_autoinc, String pk ); RowMetaInterface getRequiredFields( VariableSpace space ); DatabaseMeta[] getUsedDatabaseConnections(); String[] getFieldStream(); void setFieldStream( String[] fieldStream ); @Override RowMeta getRowMeta( StepDataInterface stepData ); @Override List<String> getDatabaseFields(); @Override List<String> getStreamFields(); String[] getFieldDatabase(); void setFieldDatabase( String[] fieldDatabase ); String getSchemaName(); void setSchemaName( String schemaName ); boolean supportsErrorHandling(); @Override String getMissingDatabaseConnectionInformationMessage(); @Override TableOutputMetaInjection getStepMetaInjectionInterface(); List<StepInjectionMetaEntry> extractStepMetadataEntries(); }
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta ); rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName ); rep.saveStepAttribute( id_transformation, id_step, "table", tableName ); rep.saveStepAttribute( id_transformation, id_step, "commit", commitSize ); rep.saveStepAttribute( id_transformation, id_step, "truncate", truncateTable ); rep.saveStepAttribute( id_transformation, id_step, "ignore_errors", ignoreErrors ); rep.saveStepAttribute( id_transformation, id_step, "use_batch", useBatchUpdate ); rep.saveStepAttribute( id_transformation, id_step, "specify_fields", specifyFields ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_enabled", partitioningEnabled ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_field", partitioningField ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_daily", partitioningDaily ); rep.saveStepAttribute( id_transformation, id_step, "partitioning_monthly", partitioningMonthly ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_field", tableNameInField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_field", tableNameField ); rep.saveStepAttribute( id_transformation, id_step, "tablename_in_table", tableNameInTable ); rep.saveStepAttribute( id_transformation, id_step, "return_keys", returningGeneratedKeys ); rep.saveStepAttribute( id_transformation, id_step, "return_field", generatedKeyField ); int nrRows = ( fieldDatabase.length < fieldStream.length ? fieldStream.length : fieldDatabase.length ); for ( int idx = 0; idx < nrRows; idx++ ) { String columnName = ( idx < fieldDatabase.length ? fieldDatabase[idx] : "" ); String streamName = ( idx < fieldStream.length ? fieldStream[idx] : "" ); rep.saveStepAttribute( id_transformation, id_step, idx, "column_name", columnName ); rep.saveStepAttribute( id_transformation, id_step, idx, "stream_name", streamName ); } if ( databaseMeta != null ) { rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() ); } } catch ( Exception e ) { throw new KettleException( "Unable to save step information to the repository for id_step=" + id_step, e ); } } TableOutputMeta(); String getGeneratedKeyField(); void setGeneratedKeyField( String generatedKeyField ); boolean isReturningGeneratedKeys(); void setReturningGeneratedKeys( boolean returningGeneratedKeys ); boolean isTableNameInTable(); void setTableNameInTable( boolean tableNameInTable ); String getTableNameField(); void setTableNameField( String tableNameField ); boolean isTableNameInField(); void setTableNameInField( boolean tableNameInField ); boolean isPartitioningDaily(); void setPartitioningDaily( boolean partitioningDaily ); boolean isPartitioningMonthly(); void setPartitioningMonthly( boolean partitioningMontly ); boolean isPartitioningEnabled(); void setPartitioningEnabled( boolean partitioningEnabled ); String getPartitioningField(); void setPartitioningField( String partitioningField ); void allocate( int nrRows ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); String getCommitSize(); void setCommitSize( int commitSizeInt ); void setCommitSize( String commitSize ); String getTableName(); void setTableName( String tableName ); @Deprecated String getTablename(); @Deprecated void setTablename( String tablename ); boolean truncateTable(); void setTruncateTable( boolean truncateTable ); void setIgnoreErrors( boolean ignoreErrors ); boolean ignoreErrors(); void setSpecifyFields( boolean specifyFields ); boolean specifyFields(); void setUseBatchUpdate( boolean useBatchUpdate ); boolean useBatchUpdate(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep,
      VariableSpace space, Repository repository, IMetaStore metaStore ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
      RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
      Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
      TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
      RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
      IMetaStore metaStore ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
      Repository repository, IMetaStore metaStore ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String tk,
      boolean use_autoinc, String pk ); RowMetaInterface getRequiredFields( VariableSpace space ); DatabaseMeta[] getUsedDatabaseConnections(); String[] getFieldStream(); void setFieldStream( String[] fieldStream ); @Override RowMeta getRowMeta( StepDataInterface stepData ); @Override List<String> getDatabaseFields(); @Override List<String> getStreamFields(); String[] getFieldDatabase(); void setFieldDatabase( String[] fieldDatabase ); String getSchemaName(); void setSchemaName( String schemaName ); boolean supportsErrorHandling(); @Override String getMissingDatabaseConnectionInformationMessage(); @Override TableOutputMetaInjection getStepMetaInjectionInterface(); List<StepInjectionMetaEntry> extractStepMetadataEntries();  }