Jmeter ftp requests with different file names - ftp

I am new to the jmeter. I prepared some jmeter scripts to move file from local directory to remote ftp directory. I have succeeded doing this by using jmeter FTP sampler. Now I am facing a challenge in changing the filename every time before I put it in remote directory. I want to process multiple ftp requests with different file names.
Is there any way that I can change the filename in every FTP request before moving to FTP request. jmeter version 2.13.
Thanks,
Ajeesh

Do you have a test plan that looks something like the following?
If you right click on "FTP Request" in the tree in the pane on the left, you can select "Duplicate" to add another FTP request as part of this test plan.
You can change the remote / local file in the pane on the right for the newly added FTP request.

You could use an csv configuration element, this talks about the same problem but for http.
First you need to add an FTP sampler:
And you need to load the file names from a csv configuration file:
.
It will use a CSV entry per each iteration, it will replace the name by the variable ${files}.

Related

Download one file at a time through the same session in Apache Camel FTP

I want to implement following use case with Apache Camel FTP:
On a remote location I have 0 to n amount of files stored.
When I receive a command, using FTP, I want to download one file as a byte array (which one does not matter), if any files are available.
When the file is downloaded, I want to save it in a database as a blob.
Then I want to delete the stored/processed file on the remote location
Wait for the next download command and once received go back to step 1.
The files have to be downloaded through the same FTP session.
My problem is that if I use a normal FTP route, it downloads all available files.
When I tell the route to only download one, I have to create a new route for the other files and I cannot reuse the FTP session.
Is there a way to implement this use case with Apache Camel FTP?
Camel-ftp doesn't consume all available files at once it consumes them individually one after another meaning that each file gets processed separately. If you need to process them in some specific order you can try using file-name or modified date with sortBy option.
If you want to control when file gets downloaded i.e when command gets called you can call FTP Consumer endpoint using pollEnrich
Example:
// 1. Loads one file from ftp-server with timeout of 3 seconds.
// 2. logs the body and headers
from("direct:example")
.pollEnrich("ftp:host:port/directoryName", 3000)
.to("log:loggerName?showBody=true&showHeaders=true");
You can call the direct consumer endpoint with ProducerTemplate you can obtain from CamelContext or change it to whatever consumer endpoint fits your use case.
If you need to use dynamic URI you can use simple to provide the URI for poll-enrich and also also provide timeout afterwards.
from("direct:example")
.pollEnrich()
.simple("ftp:host:port/directoryName?fileName=${headers.targetFile}")
.timeout(3000)
.to("log:loggerName?showBody=true&showHeaders=true");

Transferring multiple files though Informatica FTP connection

I have a requirement to generate the target file in Informatica with date/time appended to it. How will the Informatica FTP connection identify such dynamic file name with date appended to its name?
Also I would like to know if it is possible to FTP multiple files at a time via Informatica FTP connection. Please someone help me on this.
Its actually pretty simple, you just have to use the part of the file name that is constant and then place a *
for eg:
Myfile_20190607.txt
Myfile_20190507.txt
If i specify Myfile_2019* , this is good enough to pickup the files soecified above. You may have to play with the * and criteria to fit the files that you need.
Note: if you are sending files to third party, try to use SFTP instead of plain old ftp and most organization blocked ftp to outside ip's.
As far as I know until Informatica 9.x, it is neither possible to generate dynamic filename nor create multiple files using FTP connection. Only option was to create the files on Informatica server and then run a script to FTP them over to the destination server.
Here is how:
edit your workflow, choose variables tab, create a workflow
variable with datatype NSTRING; assume the variable name is
$wf_timestamp;
create an assignment task and assign TO_CHAR(SYSDATE,'YYYYMMDD')
to the variable in the assignment task;
edit session: Choose Mapping tab, choose your target; then
Connections; then edit FTP Value; then in the Remote Filename
attribute, enter your filename with the timestemp, eg,
myfile_$$$wf_timestamp.csv;
put your assignment before you session in your workflow.
that's it.

JMeter - Multiple users reading requests from a directory

I have a directory of XML files, and I wanted to configure Jmeter such a way that multiple users(threads) should be able to read the XML files(SOAP requests) concurrently (in a round-robin way or some other way) and submit them to Web Service Endpoint, which means I wanted them to share the input files.. for example if my directory contains 100 XML files then all of my configured users(threads) should share the load and jointly have to process the XML files. (Each user should not process all the 100 files independently).
Is there any way to test the above scenario?
Thanks,
Siva
I believe Directory Listing Config plugin would be the easiest option to use
Just provide path to the directory where your XML files live, configure the plugin according to your test scenario and that's it, you will be able to use just one HTTP Request sampler and refer the file name (or path) as ${filename} where required.
You can install Directory Listing Config plugin and keep it up-to-date via JMeter Plugins Manager.

SMTP Sampler executes receives IOExeception while sending message

I'm using jmeter 3.2, I want run a SMTP Sampler in Jmeter where I have done the necessary configuration by adding the javamail file in the lib folder of Jmeter and adding necessary credentials in the mail setting, though when executed I am getting an error of IOException.
Am I missing any step?
There was a change in SMTP Sampler in jmeter 3.2 which created several bugs.
You open a bug to jmeter with a sample if it's a different scenario.
If you can downgrade to Jmeter 3.1 if it can work.
EDIT
You can download a fix to the issue in jmeter-3.3
If you are trying to send a file as an attachment you have 2 options:
If you are using relative path (just filename) make sure you put the file into JMeter's "bin" folder. So JMeter could find it. Check out jmeter.log file to know where JMeter is expecting the file to be.
Use full path (like c:\somefolder\someotherfolder\somefile.eml)
In case if you still experience the problem update your question with your email server configuration and jmeter.log file contents. In the meantime check out Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article

How can i upload different files per thread in jmeter

I can currently upload a file to a web service using a POST and path of the files.
JMeter 2.13
When running the tests with 1 thread it uploads all the files in the directory to the web service. If I run it with 2 threads it uploads all the files twice.
I want to be able to send x amount random files per thread but don't want to send the same files again.
Any advice on how I can do this without using a CSV file?
I can see at least 2 possible solutions:
Using HTTP Simple Table Server plugin. It has KEEP=FALSE option so the file will be removed from the list after uploading. You can install HTTP Simple Table Server using JMeter Plugins Manager
Use the following approach:
in setUp Thread Group use JSR223 Sampler to copy folder with your test files into a temporary location, the relevant Groovy code will be something like:
org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File('/path/to/source/folder'), new File('/path/to/destination/folder'))
after file upload request you can delete the file which has already been used in the JSR223 PostProcessor like:
new File('/path/to/the/file').delete()

Resources