@Test public void testReadRepException() throws Exception { XMLOutputMeta xmlOutputMeta = new XMLOutputMeta(); Repository rep = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); ObjectId oid = new StringObjectId( "oid" ); when( rep.getStepAttributeString( oid, "encoding" ) ).thenThrow( new RuntimeException( "encoding exception" ) ); try { xmlOutputMeta.readRep( rep, metastore, oid, Collections.singletonList( dbMeta ) ); } catch ( KettleException e ) { assertEquals( "encoding exception", e.getCause().getMessage() ); } }
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { encoding = rep.getStepAttributeString( id_step, "encoding" ); nameSpace = rep.getStepAttributeString( id_step, "name_space" ); mainElement = rep.getStepAttributeString( id_step, "xml_main_element" ); repeatElement = rep.getStepAttributeString( id_step, "xml_repeat_element" ); fileName = rep.getStepAttributeString( id_step, "file_name" ); extension = rep.getStepAttributeString( id_step, "file_extention" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" ); stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" ); dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" ); timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" ); SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ); omitNullValues = rep.getStepAttributeBoolean( id_step, "omit_null_values" ); date_time_format = rep.getStepAttributeString( id_step, "date_time_format" ); addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); zipped = rep.getStepAttributeBoolean( id_step, "file_zipped" ); int nrfields = rep.countNrStepAttributes( id_step, "field_name" ); allocate( nrfields ); for ( int i = 0; i < nrfields; i++ ) { outputFields[i] = new XMLField(); outputFields[i].setContentType( ContentType.valueOf( Const.NVL( rep.getStepAttributeString( id_step, i, "field_content_type" ), ContentType.Element.name() ) ) ); outputFields[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) ); outputFields[i].setElementName( rep.getStepAttributeString( id_step, i, "field_element" ) ); outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) ); outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) ); outputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) ); outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) ); outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) ); outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) ); outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) ); outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) ); } } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { encoding = rep.getStepAttributeString( id_step, "encoding" ); nameSpace = rep.getStepAttributeString( id_step, "name_space" ); mainElement = rep.getStepAttributeString( id_step, "xml_main_element" ); repeatElement = rep.getStepAttributeString( id_step, "xml_repeat_element" ); fileName = rep.getStepAttributeString( id_step, "file_name" ); extension = rep.getStepAttributeString( id_step, "file_extention" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" ); stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" ); dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" ); timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" ); SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ); omitNullValues = rep.getStepAttributeBoolean( id_step, "omit_null_values" ); date_time_format = rep.getStepAttributeString( id_step, "date_time_format" ); addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); zipped = rep.getStepAttributeBoolean( id_step, "file_zipped" ); int nrfields = rep.countNrStepAttributes( id_step, "field_name" ); allocate( nrfields ); for ( int i = 0; i < nrfields; i++ ) { outputFields[i] = new XMLField(); outputFields[i].setContentType( ContentType.valueOf( Const.NVL( rep.getStepAttributeString( id_step, i, "field_content_type" ), ContentType.Element.name() ) ) ); outputFields[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) ); outputFields[i].setElementName( rep.getStepAttributeString( id_step, i, "field_element" ) ); outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) ); outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) ); outputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) ); outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) ); outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) ); outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) ); outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) ); outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) ); } } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } } }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { encoding = rep.getStepAttributeString( id_step, "encoding" ); nameSpace = rep.getStepAttributeString( id_step, "name_space" ); mainElement = rep.getStepAttributeString( id_step, "xml_main_element" ); repeatElement = rep.getStepAttributeString( id_step, "xml_repeat_element" ); fileName = rep.getStepAttributeString( id_step, "file_name" ); extension = rep.getStepAttributeString( id_step, "file_extention" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" ); stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" ); dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" ); timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" ); SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ); omitNullValues = rep.getStepAttributeBoolean( id_step, "omit_null_values" ); date_time_format = rep.getStepAttributeString( id_step, "date_time_format" ); addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); zipped = rep.getStepAttributeBoolean( id_step, "file_zipped" ); int nrfields = rep.countNrStepAttributes( id_step, "field_name" ); allocate( nrfields ); for ( int i = 0; i < nrfields; i++ ) { outputFields[i] = new XMLField(); outputFields[i].setContentType( ContentType.valueOf( Const.NVL( rep.getStepAttributeString( id_step, i, "field_content_type" ), ContentType.Element.name() ) ) ); outputFields[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) ); outputFields[i].setElementName( rep.getStepAttributeString( id_step, i, "field_element" ) ); outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) ); outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) ); outputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) ); outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) ); outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) ); outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) ); outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) ); outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) ); } } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } } XMLOutputMeta(); }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { encoding = rep.getStepAttributeString( id_step, "encoding" ); nameSpace = rep.getStepAttributeString( id_step, "name_space" ); mainElement = rep.getStepAttributeString( id_step, "xml_main_element" ); repeatElement = rep.getStepAttributeString( id_step, "xml_repeat_element" ); fileName = rep.getStepAttributeString( id_step, "file_name" ); extension = rep.getStepAttributeString( id_step, "file_extention" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" ); stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" ); dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" ); timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" ); SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ); omitNullValues = rep.getStepAttributeBoolean( id_step, "omit_null_values" ); date_time_format = rep.getStepAttributeString( id_step, "date_time_format" ); addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); zipped = rep.getStepAttributeBoolean( id_step, "file_zipped" ); int nrfields = rep.countNrStepAttributes( id_step, "field_name" ); allocate( nrfields ); for ( int i = 0; i < nrfields; i++ ) { outputFields[i] = new XMLField(); outputFields[i].setContentType( ContentType.valueOf( Const.NVL( rep.getStepAttributeString( id_step, i, "field_content_type" ), ContentType.Element.name() ) ) ); outputFields[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) ); outputFields[i].setElementName( rep.getStepAttributeString( id_step, i, "field_element" ) ); outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) ); outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) ); outputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) ); outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) ); outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) ); outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) ); outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) ); outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) ); } } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } } XMLOutputMeta(); boolean isDateInFilename(); void setDateInFilename( boolean dateInFilename ); String getExtension(); void setExtension( String extension ); boolean isDoNotOpenNewFileInit(); void setDoNotOpenNewFileInit( boolean doNotOpenNewFileInit ); String getFileName(); void setFileName( String fileName ); int getSplitEvery(); void setSplitEvery( int splitEvery ); boolean isStepNrInFilename(); void setStepNrInFilename( boolean stepNrInFilename ); boolean isTimeInFilename(); void setTimeInFilename( boolean timeInFilename ); boolean isAddToResultFiles(); void setAddToResultFiles( boolean addtoresultfilenamesin ); boolean isSpecifyFormat(); void setSpecifyFormat( boolean SpecifyFormat ); String getDateTimeFormat(); void setDateTimeFormat( String date_time_format ); boolean isZipped(); void setZipped( boolean zipped ); XMLField[] getOutputFields(); void setOutputFields( XMLField[] outputFields ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrfields ); Object clone(); String getNewLine( String fformat ); void setDefault(); String[] getFiles( VariableSpace space ); String buildFilename( VariableSpace space, int stepnr, int splitnr, boolean ziparchive ); void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep,
      VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getRequiredFields( VariableSpace space ); 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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, 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(); String getEncoding(); void setEncoding( String encoding ); String getMainElement(); void setMainElement( String mainElement ); String getRepeatElement(); void setRepeatElement( String repeatElement ); String getNameSpace(); void setNameSpace( String nameSpace ); void setOmitNullValues( boolean omitNullValues ); boolean isOmitNullValues(); boolean isServletOutput(); void setServletOutput( boolean servletOutput ); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
      ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); boolean passDataToServletOutput(); }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { encoding = rep.getStepAttributeString( id_step, "encoding" ); nameSpace = rep.getStepAttributeString( id_step, "name_space" ); mainElement = rep.getStepAttributeString( id_step, "xml_main_element" ); repeatElement = rep.getStepAttributeString( id_step, "xml_repeat_element" ); fileName = rep.getStepAttributeString( id_step, "file_name" ); extension = rep.getStepAttributeString( id_step, "file_extention" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" ); splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" ); stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" ); dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" ); timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" ); SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ); omitNullValues = rep.getStepAttributeBoolean( id_step, "omit_null_values" ); date_time_format = rep.getStepAttributeString( id_step, "date_time_format" ); addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" ); zipped = rep.getStepAttributeBoolean( id_step, "file_zipped" ); int nrfields = rep.countNrStepAttributes( id_step, "field_name" ); allocate( nrfields ); for ( int i = 0; i < nrfields; i++ ) { outputFields[i] = new XMLField(); outputFields[i].setContentType( ContentType.valueOf( Const.NVL( rep.getStepAttributeString( id_step, i, "field_content_type" ), ContentType.Element.name() ) ) ); outputFields[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) ); outputFields[i].setElementName( rep.getStepAttributeString( id_step, i, "field_element" ) ); outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) ); outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) ); outputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) ); outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) ); outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) ); outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) ); outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) ); outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) ); } } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step information from the repository", e ); } } XMLOutputMeta(); boolean isDateInFilename(); void setDateInFilename( boolean dateInFilename ); String getExtension(); void setExtension( String extension ); boolean isDoNotOpenNewFileInit(); void setDoNotOpenNewFileInit( boolean doNotOpenNewFileInit ); String getFileName(); void setFileName( String fileName ); int getSplitEvery(); void setSplitEvery( int splitEvery ); boolean isStepNrInFilename(); void setStepNrInFilename( boolean stepNrInFilename ); boolean isTimeInFilename(); void setTimeInFilename( boolean timeInFilename ); boolean isAddToResultFiles(); void setAddToResultFiles( boolean addtoresultfilenamesin ); boolean isSpecifyFormat(); void setSpecifyFormat( boolean SpecifyFormat ); String getDateTimeFormat(); void setDateTimeFormat( String date_time_format ); boolean isZipped(); void setZipped( boolean zipped ); XMLField[] getOutputFields(); void setOutputFields( XMLField[] outputFields ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrfields ); Object clone(); String getNewLine( String fformat ); void setDefault(); String[] getFiles( VariableSpace space ); String buildFilename( VariableSpace space, int stepnr, int splitnr, boolean ziparchive ); void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep,
      VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getRequiredFields( VariableSpace space ); 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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, 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(); String getEncoding(); void setEncoding( String encoding ); String getMainElement(); void setMainElement( String mainElement ); String getRepeatElement(); void setRepeatElement( String repeatElement ); String getNameSpace(); void setNameSpace( String nameSpace ); void setOmitNullValues( boolean omitNullValues ); boolean isOmitNullValues(); boolean isServletOutput(); void setServletOutput( boolean servletOutput ); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
      ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); boolean passDataToServletOutput();  }