@Test public void testReadRep() throws Exception { ZipFileMeta zipFileMeta = new ZipFileMeta(); Repository rep = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); StringObjectId oid = new StringObjectId( "oid" ); when( rep.getStepAttributeString( oid, "sourcefilenamefield" ) ).thenReturn( SOURCE_FILENAME ); when( rep.getStepAttributeString( oid, "targetfilenamefield" ) ).thenReturn( TARGET_FILENAME ); when( rep.getStepAttributeString( oid, "baseFolderField" ) ).thenReturn( BASE_FOLDER ); when( rep.getStepAttributeString( oid, "operation_type" ) ).thenReturn( OPERATION_TYPE ); when( rep.getStepAttributeBoolean( oid, "addresultfilenames" ) ).thenReturn( ADD_RESULT_FILENAME ); when( rep.getStepAttributeBoolean( oid, "overwritezipentry" ) ).thenReturn( OVERWRITE_ZIP_ENTRY ); when( rep.getStepAttributeBoolean( oid, "createparentfolder" ) ).thenReturn( CREATE_PARENT_FOLDER ); when( rep.getStepAttributeBoolean( oid, "keepsourcefolder" ) ).thenReturn( KEEP_SOURCE_FOLDER ); when( rep.getStepAttributeString( oid, "movetofolderfield" ) ).thenReturn( MOVE_TO_FOLDER_FIELD ); zipFileMeta.readRep( rep, metastore, oid, Collections.singletonList( dbMeta ) ); assertEquals( SOURCE_FILENAME, zipFileMeta.getDynamicSourceFileNameField() ); assertEquals( TARGET_FILENAME, zipFileMeta.getDynamicTargetFileNameField() ); assertEquals( BASE_FOLDER, zipFileMeta.getBaseFolderField() ); assertEquals( ZipFileMeta.getOperationTypeByDesc( OPERATION_TYPE ), zipFileMeta.getOperationType() ); assertEquals( MOVE_TO_FOLDER_FIELD, zipFileMeta.getMoveToFolderField() ); assertTrue( zipFileMeta.isaddTargetFileNametoResult() ); assertTrue( zipFileMeta.isOverwriteZipEntry() ); assertTrue( zipFileMeta.isKeepSouceFolder() ); assertTrue( zipFileMeta.isCreateParentFolder() ); Mockito.reset( rep, metastore ); StringObjectId transid = new StringObjectId( "transid" ); zipFileMeta.saveRep( rep, metastore, transid, oid ); verify( rep ).saveStepAttribute( transid, oid, "sourcefilenamefield", SOURCE_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "targetfilenamefield", TARGET_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "baseFolderField", BASE_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "operation_type", OPERATION_TYPE ); verify( rep ).saveStepAttribute( transid, oid, "addresultfilenames", ADD_RESULT_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "overwritezipentry", OVERWRITE_ZIP_ENTRY ); verify( rep ).saveStepAttribute( transid, oid, "createparentfolder", CREATE_PARENT_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "keepsourcefolder", KEEP_SOURCE_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "movetofolderfield", MOVE_TO_FOLDER_FIELD ); Mockito.verifyNoMoreInteractions( rep, metastore ); }
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } 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 readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } 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; }