@Test public void testCheck() { ZipFileMeta zipFileMeta = new ZipFileMeta(); zipFileMeta.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<>(); zipFileMeta.check( remarks, transMeta, stepInfo, prev, new String[]{"input"}, new String[]{"output"}, info, new Variables(), repos, metastore ); assertEquals( 2, remarks.size() ); assertEquals( "Source Filename field is missing!", remarks.get( 0 ).getText() ); assertEquals( "Step is receiving info from other steps.", remarks.get( 1 ).getText() ); remarks = new ArrayList<>(); zipFileMeta = new ZipFileMeta(); zipFileMeta.setDynamicSourceFileNameField( "sourceFileField" ); zipFileMeta.check( remarks, transMeta, stepInfo, prev, new String[0], new String[]{"output"}, info, new Variables(), repos, metastore ); assertEquals( 2, remarks.size() ); assertEquals( "Target Filename field was specified", remarks.get( 0 ).getText() ); assertEquals( "No input received from other steps!", remarks.get( 1 ).getText() ); }
public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); 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 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(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); 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 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(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); static final String[] operationTypeDesc; static final String[] operationTypeCode; static final int OPERATION_TYPE_NOTHING; static final int OPERATION_TYPE_MOVE; static final int OPERATION_TYPE_DELETE; }