Introduction
As you already saw on the parametrization page, we find the action input argument to parametrize by its name.
Sometimes it turns out in the same queue of actions there is more than one parameter with the same name. This is the case when you want to upload a file twice in a row.
Example
private static final String PARAMETRIZED_USER = "username"; private static final String PARAMETRIZED_SMALL_FILE = "localFilePath"; private static final String PARAMETRIZED_LARGE_FILE = "localFilePath"; public void paremetrizedFileTransfers() throws Exception { // create a load client and provide the loader it works on LoadClient loader = new LoadClient( LOADER_ADDRESS ); // set some threading pattern loader.setThreadingPattern( new AllAtOncePattern( 5, true ) ); // set as many as needed data configurators loader.addParameterDataConfigurator( new RangeDataConfig( PARAMETRIZED_USER, "vuser{0}", 10, 100 ) ); // we now add 2 File Name patterns loader.addParameterDataConfigurator( new FileNamesDataConfig( PARAMETRIZED_SMALL_FILE, "C:/temp/small_files/", ParameterProviderLevel.PER_INVOCATION ) ); loader.addParameterDataConfigurator( new FileNamesDataConfig( PARAMETRIZED_LARGE_FILE, "C:/temp/large_files/", ParameterProviderLevel.PER_INVOCATION ) ); // give a name to your action queue loader.startQueueing( "FTP transfer" ); // list all the actions you want to run FileTransferAction ftAction = new FileTransferAction(); ftAction.connect( ftpServer, ftpPort, PARAMETRIZED_USER, ftpPassword ); ftAction.upload( PARAMETRIZED_SMALL_FILE ); ftAction.upload( PARAMETRIZED_LARGE_FILE ); ftAction.disconnect(); // now execute the requested action queue according to the threading pattern loader.executeQueuedActions(); }
As you can we call the upload action twice and we have provided two File Name generation patterns - each of them specifies a different folder to pull the files from and each of them attached to one call of the upload action.
One iteration of this queue will result in:
- connect
- upload a file from the folder with small files
- upload a file from the folder with large files
- disconnect
Back to parent page
Go to Table of Contents