AvroInputMetaBase extends BaseStepMeta implements StepMetaInterface, ResolvableResource { @Override public String getXML() { StringBuffer retval = new StringBuffer( 800 ); final String INDENT = " "; retval.append( INDENT ).append( XMLHandler.addTagValue( "passing_through_fields", passingThruFields ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "dataLocation", getDataLocation() ) ); parentStepMeta.getParentTransMeta().getNamedClusterEmbedManager().registerUrl( getDataLocation() ); retval.append( INDENT ).append( XMLHandler.addTagValue( "sourceFormat", getFormat() ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "dataLocationType", dataLocationType ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "schemaLocation", getSchemaLocation() ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "schemaLocationType", schemaLocationType ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "isCacheSchemas", isCacheSchemas() ) ); retval.append( INDENT ).append( XMLHandler.addTagValue( "allowNullForMissingFields", isAllowNullForMissingFields() ) ); retval.append( " <fields>" ).append( Const.CR ); for ( int i = 0; i < inputFields.length; i++ ) { AvroInputField field = inputFields[ i ]; if ( field.getPentahoFieldName() != null && field.getPentahoFieldName().length() != 0 ) { retval.append( " <field>" ).append( Const.CR ); retval.append( " " ).append( XMLHandler.addTagValue( "path", field.getAvroFieldName() ) ); retval.append( " " ).append( XMLHandler.addTagValue( "name", field.getPentahoFieldName() ) ); retval.append( " " ).append( XMLHandler.addTagValue( "type", field.getTypeDesc() ) ); AvroSpec.DataType avroDataType = field.getAvroType(); if ( avroDataType != null && !avroDataType.equals( AvroSpec.DataType.NULL ) ) { retval.append( " " ).append( XMLHandler.addTagValue( "avro_type", avroDataType.getName() ) ); } else { retval.append( " " ).append( XMLHandler.addTagValue( "avro_type", AvroTypeConverter.convertToAvroType( field.getTypeDesc() ) ) ); } if ( field.getStringFormat() != null ) { retval.append( " " ).append( XMLHandler.addTagValue( "format", field.getStringFormat() ) ); } String indexedValues = field.getIndexedValues(); if ( indexedValues != null && indexedValues.length() > 0 ) { retval.append( " " ).append( XMLHandler.addTagValue( "indexed_vals", indexedValues ) ); } retval.append( " </field>" ).append( Const.CR ); } } retval.append( " </fields>" ).append( Const.CR ); retval.append( " <lookupFields>" ).append( Const.CR ); for ( int i = 0; i < lookupFields.size(); i++ ) { AvroLookupField field = lookupFields.get( i ); if ( field.getFieldName() != null && field.getFieldName().length() != 0 ) { retval.append( " <lookupField>" ).append( Const.CR ); retval.append( " " ).append( XMLHandler.addTagValue( "fieldName", field.getFieldName() ) ); retval.append( " " ).append( XMLHandler.addTagValue( "variableName", field.getVariableName() ) ); retval.append( " " ).append( XMLHandler.addTagValue( "defaultValue", field.getDefaultValue() ) ); retval.append( " </lookupField>" ).append( Const.CR ); } } retval.append( " </lookupFields>" ).append( Const.CR ); return retval.toString(); }  List<AvroLookupField> getLookupFields(); void setLookupFields( List<AvroLookupField> lookupFields ); String getDataLocation(); void setDataLocation( String dataLocation, LocationDescriptor locationDescriptor ); LocationDescriptor getDataLocationType(); void setFormat( int formatIndex ); int getFormat(); String getSchemaLocation(); void setSchemaLocation( String schemaLocation, LocationDescriptor locationDescriptor ); @Override void setDefault(); LocationDescriptor getSchemaLocationType(); boolean isCacheSchemas(); void setCacheSchemas( boolean cacheSchemas ); boolean isAllowNullForMissingFields(); void setAllowNullForMissingFields( boolean allowNullForMissingFields ); String getEncoding(); AvroInputField[] getInputFields(); void setInputFields( AvroInputField[] inputFields ); void setInputFields( List<AvroInputField> inputFields ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); @Override void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Override void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); @Override void resolve(); @Injection( name = "AVRO_FILENAME" ) @Deprecated void setDataFileName( String fileName ); @Injection( name = "STREAM_FIELDNAME" ) @Deprecated void setDataFieldName( String fieldName ); @Injection( name = "SCHEMA_FILENAME" ) @Deprecated void setSchemaFileName( String fileName ); static final Class<?> PKG; @Injection( name = "DATA_LOCATION_TYPE" )
  @VisibleForTesting
  public int dataLocationType; @Injection( name = "PASS_THROUGH_FIELDS" )
  public boolean passingThruFields; @InjectionDeep
  public AvroInputField[] inputFields; }
@Test public void testGetXML() throws KettleStepException { when( field.getPentahoFieldName() ).thenReturn( "SampleName" ); meta.setInputFields( Arrays.asList( field ) ); assertNotNull( meta.getXML() ); verify( meta, atLeastOnce() ).getDataLocation(); verify( meta ).getSchemaLocation(); verify( field ).getAvroFieldName(); verify( field, times( 3 ) ).getPentahoFieldName(); verify( field ).getTypeDesc(); verify( embedManager ).registerUrl( anyString() ); }