Hello dear Stack community,
I am looking for solution for my test execution. I am using Java & Selenium & TestNG tests kept on AzureDevOps.
Each execution needs to load input data from file stored in external source - where client have an access and can easily drag-drop files.
By now files are stored on my companys Share Drive. It works all fine when I run tests from local machine, but when using pipeline, I get FileNotFoundException in line where file is loaded.
Does anyone have an idea why does it happen and how can it be overcome?
Of course if there is any other solution, I would love to hear about it.
It works all fine when I run tests from local machine, but when using pipeline, I get FileNotFoundException in line where file is loaded.
If you use Microsoft-hosted agents to access to files, which are stored on company's Share Drive, you should check whether there is correct connection. If your organization is secured with a firewall or proxy server, you need to add certain IP addresses and domain URLs to the allowlist. See: Allowed address lists and network connections for details.
Also you could use self-hosted agents to access to this shared files so it will communicate with company's Share Drive via your internal network.
Related
How to update an MDB file from other machines remotely over the HTTP?
I have 2 machines that are connected by the internet, on the first, I have an MDB file and on the other, I have a java web application, I want to send an SQL query from the java web application to update the MDB file on the other machine over the HTTP.
I tried to use FTP, but it is transferring the whole file b
A file such as word, or power-point or Access?
Well, a horse is a horse is a horse.
A file is a file is a file.
You don't connect to a word file to update it. You don't connect to a Excel file, or a power-point file. And you don't connect to a Access file. You OPEN a file, and THEN modify it. You can't open nor modify files over FTP, nor can you modify them over HTTP either. And you can't even do that with a plane jane text file. These are files - you have to open them to modify them. Or pull a whole copy to one side. Update that file, and then send it back.
So, you don't want to confuse the concept of a simple file, or file based system like say a text file, excel file, or Access file. These are NOT servers or say a service that you connect to. You never open a MySQL file - you connect to a server + service via tc/ip (a socket conneciton) and then send commands back and forth. You NEVER open or touch that MySQL data file. The server updates that file - not you, and not your code.
So, Access is not a server based, or socket connection based service. It is a file based system - not un-like a text file. You don't connect to a text file, you HAVE to open that file - modify it and then save it. You can't do that over http. In fact you can't even do that with FTP either. You can pull the whole file, modify and then send it back to where you got that file from.
Now, you could however setup + create some web service calls or entry points on the one site. You could send that web site some commands, and then code behind on that web site can open up that text file, word file, or in this case the Access file and make changes . But once again, just like MYSQL or say the web server? You not opening the remote file direct - are you? You are (and can) thus setup some code or web methods (even REST ones) that accept commands, and those (even sql update commands) could then be run by that remote server/service and thus update the file on that target system. In the case of Access data files?
If you look VERY close, even a ODBC connection string ALWAYS ALWAYS resolves to a valid windows path name (and a full legal qualified windows path name at that).
so, while there is a ODBC driver, the software driver still in fact uses a standard windows OS file open command against that plane jane file sitting in the hard disk. So to update that Access file, you need the driver - since it knows how to open that file, and how to update the delicate data file structures inside. So, even via ODBC? Well, it not a socket connection and you not connecting to a server on the other end - but in fact opening a simple windows file. In fact this means that you not only require DIRECT file rights to that access data file - but you actually need the windows file system!
However, sqLite is the SAME thing. There are thus some jdbc drivers. This JDBC concept is VERY similar to ODBC, but is for web based systems. You install a library on one end (where sqlite resides), and then that web service can take your sql commands (updates or query pulls), and thus the web site code now opens that local file, executes sql against it, or does a query pull , and then returns the results of your query - and the web query calls are done via that web service (rest calls) on that server. So, you can in theory shuffle commands between two web servers - and there are some types of "drivers" such as jDBC standards that in theory do wind up giving you a similar experience to ODBC.
Klov reports are working fine. My question is how can i share klov reports with other users?
I have tried running on the local host but if i want share this report how can i ?
ExtentKlovReporter klovReporter = new ExtentKlovReporter();
klovReporter.initMongoDbConnection("localhost", 32017);
You can share it by using your ipaddress. If suppose your ip address is 192.168.55.69, then other recipients can access it by "192.168.55.69:32017" (your ip : port no).
you can share the report link directly, but it may ask the recipient to select project from drop down menu based on your klov version
Actually there're several there're several options.
Run your tests on CI server (like Jenkins) and then publish it as HTML report;
Install an http server (IMHO the simplest is NGINX) and put your files inside, you can use a docker container and deploy it anywhere, locally on the cloud vm, on-prem server and so on.
Create an AWS S3 bucket (or alternatives on other clouds), allow hosting option and then upload your files.
And so, so on...
I have developed a website, one of its operation is to read and write data to text files stored at my local machine such as D://test.txt or C://file.txt, but now I am going to host my website at the external server, i mean over the internet use, i wonder where to keep these files that are associated with read and writing operations. At present I am getting an exception file not found if i am using my local machine location. For your information, I am using GlassFish server.
You will want to create a system property on Glassfish, which represents the file path and name. Then upload the file to that location of your choosing on the server where your website application is deployed.
Depending upon your needs, you may find it easier to deploy the file out with your application. Make sure the file is on the classpath, and you can load it using any number of ways.
One of my requirements is, on load of page, a file is to be created dynamically and downloaded at a particular location on the client's machine.
In case the file is already present, it has to be over written.
is there any way where we can access the client's system and store the file at the required folder?
I feel one cannot access the client machine when the code is being executed on the server..
Senorio:
1-User click on generate document then it took template stream data ,req. data file and then save two file into client machine.
2-After that template open and it fetch the data file from same directory.
Please help me on this. This is an SOS!!
There are probably other solutions, I use a signed applet for this purpose.
As always, there are a few caveats though:
You can't "force" anything against the will of the user. Applets may be disabled in the client's browser, or they may not even have Java installed. Or the target directory might not be writeable by the user.Your server should handle cases where the client doesn't have the correct version of the file gracefully.
You can't do this from the server side obviously but you also really can't do this from a client script either. Browser security will prevent a page script from modifying contents of the file system.
Your only options will be to run a third-party browser plugin software that has elevated permissions.
Examples of such are
Java Applets
Java WebStart
Microsoft Silverlight
ActiveX
Each one is different and most require some level of user interaction to confirm that they allow plugins to run with elevated security.
I've a production env and test env. Production has win2k3+tomcat 6.0+ and network drive mapped to a drive letter for easy access (z:\app instead of \symba\files\app). My test env has windows xp (all the software is same including the source code for servlet) and test also has the same drive letter mapping to the network drive.
Tomcat is running with the same user id in both the systems and am able to access the file via windows explorer in the test m/c and production m/c.
Now the servlet in the windows xp m/c (test m/c) throws a file not found exception if try to access an existing file (reachable via windows explorer). The servlet in production is same as in test env and production servlet happily gives the file when i request it and does not throw any error what so ever.
I've see some posts that using drive letter is not a good idea and should use UNC paths instead and i've not tried this yet. I want to know the reason why test servlet fails to get file whereas production servlet works fine.
Thank you very much for your time and help
Bo
Are you running the application server as a service? Drive letter assignments are reliable only if you use interactive programs not services.
A couple of years ago, I tried to resolve a quite identical problem but, at last, I gave up and I used JCIFS to access the files.
If you run Tomcat with a security manager, the web app code is according to the default configuration only allowed file access to its deployment directory. If you want to change the application policies, you can do that in conf/catalina.policy or you can disable the security manager, if you want your web app code to gain all privileges.
You might want to consider running the Tomcat service as the user who has access to the mapped drive.
As pointed out by andcoz, the mappings will not apply for the SYSTEM user in Windows that I presume is being utilized for running Tomcat. You could change the service configuration to run as the user owning the drive mapping and verify if the failure continues to occur.
Related:
FileNotFoundException thrown when the file does exists.