@Test public void testGetFields() throws KettleStepException { String outKeyField = "outKeyField"; String outValField = "outValField"; hadoopExitMeta.setOutKeyFieldname( outKeyField ); hadoopExitMeta.setOutValueFieldname( outValField ); RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); ValueMetaInterface key = mock( ValueMetaInterface.class ); ValueMetaInterface keyClone = mock( ValueMetaInterface.class ); ValueMetaInterface value = mock( ValueMetaInterface.class ); ValueMetaInterface valueClone = mock( ValueMetaInterface.class ); when( rowMetaInterface.searchValueMeta( outKeyField ) ).thenReturn( key ); when( rowMetaInterface.searchValueMeta( outValField ) ).thenReturn( value ); when( key.clone() ).thenReturn( keyClone ); when( value.clone() ).thenReturn( valueClone ); hadoopExitMeta.getFields( rowMetaInterface, null, null, null, null ); verify( keyClone ).setName( HadoopExitMeta.OUT_KEY ); verify( valueClone ).setName( HadoopExitMeta.OUT_VALUE ); verify( rowMetaInterface ).clear(); verify( rowMetaInterface ).addValueMeta( keyClone ); verify( rowMetaInterface ).addValueMeta( valueClone ); }
@Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { ValueMetaInterface key = rowMeta.searchValueMeta( getOutKeyFieldname() ); ValueMetaInterface value = rowMeta.searchValueMeta( getOutValueFieldname() ); if ( key == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_KEY_FIELD, getOutKeyFieldname() ) ); } if ( value == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_VALUE_FIELD, getOutValueFieldname() ) ); } ValueMetaInterface keyMeta = key.clone(); ValueMetaInterface valueMeta = value.clone(); keyMeta.setName( OUT_KEY ); valueMeta.setName( OUT_VALUE ); rowMeta.clear(); rowMeta.addValueMeta( keyMeta ); rowMeta.addValueMeta( valueMeta ); }
HadoopExitMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { ValueMetaInterface key = rowMeta.searchValueMeta( getOutKeyFieldname() ); ValueMetaInterface value = rowMeta.searchValueMeta( getOutValueFieldname() ); if ( key == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_KEY_FIELD, getOutKeyFieldname() ) ); } if ( value == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_VALUE_FIELD, getOutValueFieldname() ) ); } ValueMetaInterface keyMeta = key.clone(); ValueMetaInterface valueMeta = value.clone(); keyMeta.setName( OUT_KEY ); valueMeta.setName( OUT_VALUE ); rowMeta.clear(); rowMeta.addValueMeta( keyMeta ); rowMeta.addValueMeta( valueMeta ); } }
HadoopExitMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { ValueMetaInterface key = rowMeta.searchValueMeta( getOutKeyFieldname() ); ValueMetaInterface value = rowMeta.searchValueMeta( getOutValueFieldname() ); if ( key == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_KEY_FIELD, getOutKeyFieldname() ) ); } if ( value == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_VALUE_FIELD, getOutValueFieldname() ) ); } ValueMetaInterface keyMeta = key.clone(); ValueMetaInterface valueMeta = value.clone(); keyMeta.setName( OUT_KEY ); valueMeta.setName( OUT_VALUE ); rowMeta.clear(); rowMeta.addValueMeta( keyMeta ); rowMeta.addValueMeta( valueMeta ); } HadoopExitMeta(); }
HadoopExitMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { ValueMetaInterface key = rowMeta.searchValueMeta( getOutKeyFieldname() ); ValueMetaInterface value = rowMeta.searchValueMeta( getOutValueFieldname() ); if ( key == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_KEY_FIELD, getOutKeyFieldname() ) ); } if ( value == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_VALUE_FIELD, getOutValueFieldname() ) ); } ValueMetaInterface keyMeta = key.clone(); ValueMetaInterface valueMeta = value.clone(); keyMeta.setName( OUT_KEY ); valueMeta.setName( OUT_VALUE ); rowMeta.clear(); rowMeta.addValueMeta( keyMeta ); rowMeta.addValueMeta( valueMeta ); } HadoopExitMeta(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); Object clone(); @Override void setDefault(); @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 ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev,
      String[] input, String[] output, RowMetaInterface info ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
      Trans trans ); StepDataInterface getStepData(); String getOutKeyFieldname(); void setOutKeyFieldname( String arg ); String getOutValueFieldname(); void setOutValueFieldname( String arg ); @Override String getDialogClassName(); }
HadoopExitMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { ValueMetaInterface key = rowMeta.searchValueMeta( getOutKeyFieldname() ); ValueMetaInterface value = rowMeta.searchValueMeta( getOutValueFieldname() ); if ( key == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_KEY_FIELD, getOutKeyFieldname() ) ); } if ( value == null ) { throw new KettleStepException( BaseMessages.getString( PKG, ERROR_INVALID_VALUE_FIELD, getOutValueFieldname() ) ); } ValueMetaInterface keyMeta = key.clone(); ValueMetaInterface valueMeta = value.clone(); keyMeta.setName( OUT_KEY ); valueMeta.setName( OUT_VALUE ); rowMeta.clear(); rowMeta.addValueMeta( keyMeta ); rowMeta.addValueMeta( valueMeta ); } HadoopExitMeta(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); Object clone(); @Override void setDefault(); @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 ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev,
      String[] input, String[] output, RowMetaInterface info ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
      Trans trans ); StepDataInterface getStepData(); String getOutKeyFieldname(); void setOutKeyFieldname( String arg ); String getOutValueFieldname(); void setOutValueFieldname( String arg ); @Override String getDialogClassName(); static final String ERROR_INVALID_KEY_FIELD; static final String ERROR_INVALID_VALUE_FIELD; static final String OUT_KEY; static final String OUT_VALUE; static final String HADOOP_EXIT_META_CHECK_RESULT_NO_DATA_STREAM; static final String HADOOP_EXIT_META_CHECK_RESULT_NO_SPECIFIED_FIELDS; static final String HADOOP_EXIT_META_CHECK_RESULT_STEP_RECEVING_DATA; static final String HADOOP_EXIT_META_CHECK_RESULT_NOT_RECEVING_SPECIFIED_FIELDS; static Class<?> PKG; static final String DIALOG_NAME; static String OUT_KEY_FIELDNAME; static String OUT_VALUE_FIELDNAME; }