@Test public void testCheck() throws Exception { XMLOutputMeta xmlOutputMeta = new XMLOutputMeta(); xmlOutputMeta.setDefault(); TransMeta transMeta = mock( TransMeta.class ); StepMeta stepInfo = mock( StepMeta.class ); RowMetaInterface prev = mock( RowMetaInterface.class ); Repository repos = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); RowMetaInterface info = mock( RowMetaInterface.class ); ArrayList<CheckResultInterface> remarks = new ArrayList<>(); xmlOutputMeta.check( remarks, transMeta, stepInfo, prev, new String[] { "input" }, new String[] { "output" }, info, new Variables(), repos, metastore ); assertEquals( 2, remarks.size() ); assertEquals( "Step is receiving info from other steps.", remarks.get( 0 ).getText() ); assertEquals( "File specifications are not checked.", remarks.get( 1 ).getText() ); XMLField xmlField = new XMLField(); xmlField.setFieldName( "aField" ); xmlField.setType( 1 ); xmlField.setLength( 10 ); xmlField.setPrecision( 3 ); xmlOutputMeta.setOutputFields( new XMLField[] { xmlField } ); when( prev.size() ).thenReturn( 1 ); remarks.clear(); xmlOutputMeta.check( remarks, transMeta, stepInfo, prev, new String[] { "input" }, new String[] { "output" }, info, new Variables(), repos, metastore ); assertEquals( 4, remarks.size() ); assertEquals( "Step is connected to previous one, receiving 1 fields", remarks.get( 0 ).getText() ); assertEquals( "All output fields are found in the input stream.", remarks.get( 1 ).getText() ); assertEquals( "Step is receiving info from other steps.", remarks.get( 2 ).getText() ); assertEquals( "File specifications are not checked.", remarks.get( 3 ).getText() ); }
public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; if ( prev != null && prev.size() > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsReceived", "" + prev.size() ), stepinfo ); remarks.add( cr ); String error_message = ""; boolean error_found = false; for ( int i = 0; i < outputFields.length; i++ ) { int idx = prev.indexOfValue( outputFields[i].getFieldName() ); if ( idx < 0 ) { error_message += "\t\t" + outputFields[i].getFieldName() + Const.CR; error_found = true; } } if ( error_found ) { error_message = BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsNotFound", error_message ); cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.AllFieldsFound" ), stepinfo ); remarks.add( cr ); } } if ( input.length > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputOk" ), stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputError" ), stepinfo ); remarks.add( cr ); } cr = new CheckResult( CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FilesNotChecked" ), stepinfo ); remarks.add( cr ); }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; if ( prev != null && prev.size() > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsReceived", "" + prev.size() ), stepinfo ); remarks.add( cr ); String error_message = ""; boolean error_found = false; for ( int i = 0; i < outputFields.length; i++ ) { int idx = prev.indexOfValue( outputFields[i].getFieldName() ); if ( idx < 0 ) { error_message += "\t\t" + outputFields[i].getFieldName() + Const.CR; error_found = true; } } if ( error_found ) { error_message = BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsNotFound", error_message ); cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.AllFieldsFound" ), stepinfo ); remarks.add( cr ); } } if ( input.length > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputOk" ), stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputError" ), stepinfo ); remarks.add( cr ); } cr = new CheckResult( CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FilesNotChecked" ), stepinfo ); remarks.add( cr ); } }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; if ( prev != null && prev.size() > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsReceived", "" + prev.size() ), stepinfo ); remarks.add( cr ); String error_message = ""; boolean error_found = false; for ( int i = 0; i < outputFields.length; i++ ) { int idx = prev.indexOfValue( outputFields[i].getFieldName() ); if ( idx < 0 ) { error_message += "\t\t" + outputFields[i].getFieldName() + Const.CR; error_found = true; } } if ( error_found ) { error_message = BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsNotFound", error_message ); cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.AllFieldsFound" ), stepinfo ); remarks.add( cr ); } } if ( input.length > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputOk" ), stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputError" ), stepinfo ); remarks.add( cr ); } cr = new CheckResult( CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FilesNotChecked" ), stepinfo ); remarks.add( cr ); } XMLOutputMeta(); }
XMLOutputMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; if ( prev != null && prev.size() > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsReceived", "" + prev.size() ), stepinfo ); remarks.add( cr ); String error_message = ""; boolean error_found = false; for ( int i = 0; i < outputFields.length; i++ ) { int idx = prev.indexOfValue( outputFields[i].getFieldName() ); if ( idx < 0 ) { error_message += "\t\t" + outputFields[i].getFieldName() + Const.CR; error_found = true; } } if ( error_found ) { error_message = BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsNotFound", error_message ); cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.AllFieldsFound" ), stepinfo ); remarks.add( cr ); } } if ( input.length > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputOk" ), stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputError" ), stepinfo ); remarks.add( cr ); } cr = new CheckResult( CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FilesNotChecked" ), stepinfo ); remarks.add( cr ); } 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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; if ( prev != null && prev.size() > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsReceived", "" + prev.size() ), stepinfo ); remarks.add( cr ); String error_message = ""; boolean error_found = false; for ( int i = 0; i < outputFields.length; i++ ) { int idx = prev.indexOfValue( outputFields[i].getFieldName() ); if ( idx < 0 ) { error_message += "\t\t" + outputFields[i].getFieldName() + Const.CR; error_found = true; } } if ( error_found ) { error_message = BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FieldsNotFound", error_message ); cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.AllFieldsFound" ), stepinfo ); remarks.add( cr ); } } if ( input.length > 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputOk" ), stepinfo ); remarks.add( cr ); } else { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.ExpectedInputError" ), stepinfo ); remarks.add( cr ); } cr = new CheckResult( CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString( PKG, "XMLOutputMeta.CheckResult.FilesNotChecked" ), stepinfo ); remarks.add( cr ); } 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();  }