public void modifyText( ModifyEvent e ) { jobEntry.setChanged(); } };
public JobEntryCopyFilesDialog( Shell parent, JobEntryInterface jobEntryInt, Repository rep, JobMeta jobMeta ) { super( parent, jobEntryInt, rep, jobMeta ); jobEntry = (JobEntryCopyFiles) jobEntryInt; if ( this.jobEntry.getName() == null ) { this.jobEntry.setName( BaseMessages.getString( PKG, "JobCopyFiles.Name.Default" ) ); } }
@Override protected Map<String, String> createSettersMap() { return toMap( "copy_empty_folders", "setCopyEmptyFolders", "arg_from_previous", "setArgFromPrevious", "overwrite_files", "setoverwrite_files", "include_subfolders", "setIncludeSubfolders", "remove_source_files", "setRemoveSourceFiles", "add_result_filesname", "setAddresultfilesname", "destination_is_a_file", "setDestinationIsAFile", "create_destination_folder", "setCreateDestinationFolder" ); }
protected String loadSourceRep( Repository rep, ObjectId id_jobentry, int a ) throws KettleException { String source_filefolder = rep.getJobEntryAttributeString( id_jobentry, a, SOURCE_FILE_FOLDER ); String ncName = rep.getJobEntryAttributeString( id_jobentry, a, SOURCE_CONFIGURATION_NAME ); return loadURL( source_filefolder, ncName, getMetaStore(), configurationMappings ); }
@Test public void fileNotCopied() throws Exception { entry.source_filefolder = new String[] { EMPTY }; entry.destination_filefolder = new String[] { EMPTY }; entry.wildcard = new String[] { EMPTY }; entry.execute( new Result(), 0 ); verify( entry, never() ).processFileFolder( anyString(), anyString(), anyString(), any( Job.class ), any( Result.class ) ); }
public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException { try { rep.saveJobEntryAttribute( id_job, getObjectId(), "copy_empty_folders", copy_empty_folders ); rep.saveJobEntryAttribute( id_job, getObjectId(), "arg_from_previous", arg_from_previous ); rep.saveJobEntryAttribute( id_job, getObjectId(), "overwrite_files", overwrite_files ); rep.saveJobEntryAttribute( id_job, getObjectId(), "include_subfolders", include_subfolders ); rep.saveJobEntryAttribute( id_job, getObjectId(), "remove_source_files", remove_source_files ); rep.saveJobEntryAttribute( id_job, getObjectId(), "add_result_filesname", add_result_filesname ); rep.saveJobEntryAttribute( id_job, getObjectId(), "destination_is_a_file", destination_is_a_file ); rep.saveJobEntryAttribute( id_job, getObjectId(), "create_destination_folder", create_destination_folder ); // save the arguments... if ( source_filefolder != null ) { for ( int i = 0; i < source_filefolder.length; i++ ) { saveSourceRep( rep, id_job, getObjectId(), i, source_filefolder[i] ); saveDestinationRep( rep, id_job, getObjectId(), i, destination_filefolder[i] ); rep.saveJobEntryAttribute( id_job, getObjectId(), i, "wildcard", wildcard[i] ); } } } catch ( KettleDatabaseException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "JobCopyFiles.Error.Exception.UnableSaveRep" ) + id_job, dbe ); } }
if ( isDetailed() ) { logDetailed( "Folder " + KettleVFS.getFriendlyURI( folder ) + " does not exist !" ); if ( isDetailed() ) { logDetailed( "Folder parent was created." ); logError( "Folder " + KettleVFS.getFriendlyURI( folder ) + " does not exist !" ); return false; logError( "Couldn't created parent folder " + KettleVFS.getFriendlyURI( folder ), e ); } finally { if ( folder != null ) {
@Before public void setUp() { entry = new JobEntryCopyFiles(); Job parentJob = new Job(); entry.setParentJob( parentJob ); JobMeta mockJobMeta = mock( JobMeta.class ); mockNamedClusterEmbedManager = mock( NamedClusterEmbedManager.class ); when( mockJobMeta.getNamedClusterEmbedManager() ).thenReturn( mockNamedClusterEmbedManager ); entry.setParentJobMeta( mockJobMeta ); entry = spy( entry ); }
public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases, List<SlaveServer> slaveServers ) throws KettleException { try { copy_empty_folders = rep.getJobEntryAttributeBoolean( id_jobentry, "copy_empty_folders" ); arg_from_previous = rep.getJobEntryAttributeBoolean( id_jobentry, "arg_from_previous" ); overwrite_files = rep.getJobEntryAttributeBoolean( id_jobentry, "overwrite_files" ); include_subfolders = rep.getJobEntryAttributeBoolean( id_jobentry, "include_subfolders" ); remove_source_files = rep.getJobEntryAttributeBoolean( id_jobentry, "remove_source_files" ); add_result_filesname = rep.getJobEntryAttributeBoolean( id_jobentry, "add_result_filesname" ); destination_is_a_file = rep.getJobEntryAttributeBoolean( id_jobentry, "destination_is_a_file" ); create_destination_folder = rep.getJobEntryAttributeBoolean( id_jobentry, "create_destination_folder" ); // How many arguments? int argnr = rep.countNrJobEntryAttributes( id_jobentry, "source_filefolder" ); allocate( argnr ); // Read them all... for ( int a = 0; a < argnr; a++ ) { source_filefolder[a] = loadSourceRep( rep, id_jobentry, a ); destination_filefolder[a] = loadDestinationRep( rep, id_jobentry, a ); wildcard[a] = rep.getJobEntryAttributeString( id_jobentry, a, "wildcard" ); } } catch ( KettleException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "JobCopyFiles.Error.Exception.UnableLoadRep" ) + id_jobentry, dbe ); } }
public void check( List<CheckResultInterface> remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( !res ) { return; } ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); } }
protected void saveDestinationRep( Repository rep, ObjectId id_job, ObjectId id_jobentry, int i, String value ) throws KettleException { String namedCluster = configurationMappings.get( value ); rep.saveJobEntryAttribute( id_job, getObjectId(), i, DESTINATION_FILE_FOLDER, value ); rep.saveJobEntryAttribute( id_job, id_jobentry, i, DESTINATION_CONFIGURATION_NAME, namedCluster ); }
public Object clone() { JobEntryCopyFiles je = (JobEntryCopyFiles) super.clone(); if ( source_filefolder != null ) { int nrFields = source_filefolder.length; je.allocate( nrFields ); System.arraycopy( source_filefolder, 0, je.source_filefolder, 0, nrFields ); System.arraycopy( destination_filefolder, 0, je.destination_filefolder, 0, nrFields ); System.arraycopy( wildcard, 0, je.wildcard, 0, nrFields ); } return je; }
protected String loadSource( Node fnode ) { String source_filefolder = XMLHandler.getTagValue( fnode, SOURCE_FILE_FOLDER ); String ncName = XMLHandler.getTagValue( fnode, SOURCE_CONFIGURATION_NAME ); return loadURL( source_filefolder, ncName, getMetaStore(), configurationMappings ); }
@Test public void filesCopied() throws Exception { String[] srcPath = new String[] { "path1", "path2", "path3" }; String[] destPath = new String[] { "dest1", "dest2", "dest3" }; entry.source_filefolder = srcPath; entry.destination_filefolder = destPath; entry.wildcard = new String[] { EMPTY, EMPTY, EMPTY }; Result result = entry.execute( new Result(), 0 ); verify( entry, times( srcPath.length ) ).processFileFolder( anyString(), anyString(), anyString(), any( Job.class ), any( Result.class ) ); assertFalse( result.getResult() ); assertEquals( 3, result.getNrErrors() ); }
public void widgetSelected( SelectionEvent e ) { jobEntry.setChanged(); } };
@Override protected Map<String, String> createGettersMap() { return toMap( "copy_empty_folders", "isCopyEmptyFolders", "arg_from_previous", "isArgFromPrevious", "overwrite_files", "isoverwrite_files", "include_subfolders", "isIncludeSubfolders", "remove_source_files", "isRemoveSourceFiles", "add_result_filesname", "isAddresultfilesname", "destination_is_a_file", "isDestinationIsAFile", "create_destination_folder", "isCreateDestinationFolder" ); }
protected void saveSourceRep( Repository rep, ObjectId id_job, ObjectId id_jobentry, int i, String value ) throws KettleException { String namedCluster = configurationMappings.get( value ); rep.saveJobEntryAttribute( id_job, getObjectId(), i, SOURCE_FILE_FOLDER, value ); rep.saveJobEntryAttribute( id_job, id_jobentry, i, SOURCE_CONFIGURATION_NAME, namedCluster ); }
protected String loadDestination( Node fnode ) { String destination_filefolder = XMLHandler.getTagValue( fnode, DESTINATION_FILE_FOLDER ); String ncName = XMLHandler.getTagValue( fnode, DESTINATION_CONFIGURATION_NAME ); return loadURL( destination_filefolder, ncName, getMetaStore(), configurationMappings ); }
private void cancel() { jobEntry.setChanged( changed ); jobEntry = null; dispose(); }
protected String loadDestinationRep( Repository rep, ObjectId id_jobentry, int a ) throws KettleException { String destination_filefolder = rep.getJobEntryAttributeString( id_jobentry, a, DESTINATION_FILE_FOLDER ); String ncName = rep.getJobEntryAttributeString( id_jobentry, a, DESTINATION_CONFIGURATION_NAME ); return loadURL( destination_filefolder, ncName, getMetaStore(), configurationMappings ); }