Trigger more than one URL after IntelliJ Run configuration is run - intellij-idea

I have a Run configuration which builds an exploded web app, deploys it to tomcat, and opens the home page after that. However, I want to hit a few URLs to set some state in the app before opening the home page (Or after opening the homepage; it does not matter). Is there a way to trigger a few URL hits after the run configuration? This feature would be similar to "before launch." Instead, it would be "after launch".

There is no such feature at the moment, you can vote for the related feature request.
It's not as simple as it looks since it's not clear what would trigger the after event. The app server doesn't exit/terminate, but is still running, therefore it's not possible to use another run configuration with your app server added in its Before launch steps, otherwise you could create a Shell script configuration that would call curl/wget.
For the app server the proper after event would be the moment when the artifact deployment is complete which requires the tight integration with this specific app server so that IDE knows the exact moment when it happens and allows to call some custom action.
This might be possible with the custom plug-in as IDE already knows when the artifact deployment is complete.
A really hacky workaround would be to run some tiny HTTP server and open its URL from the IDE instead of your real app server. This custom server would call the URLs/APIs you need and then open a browser for your real app URL.

Related

Start a bat file remotely which never returns anything (jmeter-server.bat)

So we are doing distributed testing of our web-app using JMeter. For that you need to have the jmeter-server.bat file running in background as it acts as sort of a listener. The problem arises when one of the slave machine out of 4 restarts due to the load and the test is effectively stuck right there as the master machine expects some output from the 4th machine. Currently the automation is done via ansible-playbooks which are called in Jenkins. There are more or less 15 tests that are downstream to one another. So even if one test is stuck, the time is wasted until someone check on the machines.
Things I've tried so far:
I've tried using the Windows Task Scheduler and kept the jmeter-server.bat to run without any user loggin in, but it starts the bat file in background which in-turn spawns all the child processes in the background as well i.e. starts Selenium Chrome in headless mode.
I've tried adding the jmeter-server.bat in startup and configuring the system to AutoLogon without any password to trigger a session which will call the startup file. But unfortunately the idea was scrapped by IT for being insecure.
Tried using the ansible playbook by using the win_command but it again gets stuck as the batch file never returns anything.
Created a service as well for the bat file, but again the child processes started in background.
The problem arises when one of the slave machine out of 4 restarts due to the load
Instead of trying to work around the issue I would rather recommend finding the root cause and fixing it.
Make sure to follow JMeter Best Practices
Configure Java to take heap dump on failure
Inspect Windows PerfMon and operating system/application logs
Check presence of .hprof files in the "bin" folder of your JMeter installation and see what do they say
In general using Selenium for conducting the load is not recommended, I would rather suggest using JMeter's HTTP Request samplers for that, given you properly configure JMeter to behave like a real browser from the system under test perspective there won't be any difference whether the load comes from HTTP Request samplers or from the real browser.
The same states documentation on the WebDriver Sampler
Note: It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.

Triggering an old build on buildbot externally?

I am running a buildbot buildserver. I have a job my-job that gets triggered each time a git push is made. All builds are kept and can be rebuild when I am logged in. The URL to an old build looks like this:
http://buildbot.internal:8010/builders/my-job/builds/924
Now I need to trigger an old build from a Java HTTP client implementation I have made (e.g http-get), is that possible?
I have not been able to find any documentation for this type of usage.
In Buildbot-0.8.x, the best way to do this is to simulate a click of the "Rebuild" button in the web UI, which means POSTing the data that a web browser would POST for that form.

Make our own "Application unavailable" page

We need to completly stop our application during an upgrade because we have to execute a critical mysql script.
So our application will be turned off during several minute then Cloudbees will display a basic "Application unavailable" page. We would like to change this by our own page with our logo, like we did it when we have our own apache/tomcat server. Could it be possible ?
Btw, is there a page with active sessions like we have in the Tomcat manager ?
Thanks for your help,
You can use beta-featured blue-green support to switch your application to another instance running a "maintenance" page
with latest SDK (1.3.1), run bees app:proxy:update -a acme-maintenance -al www.acme.com to reconfigure the http router for www.acme.com to the maintenance app, then let your application run the mysql upgrade script, and restore the router configuration after completion.
Warning : this feature is in beta and subject to instabilities / API changes
At the moment there isn't an easy way to do that - but there is a feature which will be out there soon to make that easy (amongst other things).
The only way currently is to have an app (another app) - which is your simple page - you then remove the domain name from your current app and add it to that app (etc) - messy, but possible.
In terms of sessions, the operations tab of the web console shows information like that, there is also the newrelic console which provides other insights.

How do I communicate to the outside world from a Safari extension?

How would I let a running process know that a context menu has been clicked in Safari?
I've read that this is not possible due to security, but that seems wrong because 1Password somehow pulls all of the information from the desktop app's database into the Safari extension. I wrote the extension to display the context menu and was trying to send an XMLRPC request to localhost, but couldn't get it to work.
I'm not certain of this, but I think 1Password does what it does by having a background process (1PasswordAgent) constantly polling for certain changes in the extension's local database and/or config files. For example, to initially get your passwords into the extension, the extension could set a certain flag in its localStorage db, which would get written (by Safari, not by the extension) to a file. The agent would then notice the flag in the file and copy your passwords from the main 1Password database into the extension's local database. Similarly, when the extension creates a new password entry, the agent would notice the change in the extension's database and mirror it to the 1Password database.
Perhaps you could do something similar?
Although I have no idea about the implementation of 1Password, LiveReload achieves the same by using WebSocket to connect to a localhost URL (handled by the application). If you do it from the global page, cross-domain limitations do not apply, so you are free to connect to any URL:
var ws = new WebSocket("ws://localhost:98765");
...
(Be careful with that localhost thing, though, Chrome on Linux wants 0.0.0.0 instead of 127.0.0.1 or localhost. At least it used to want it.)

How to start an application on the server from a webpage

Example:
The user login to the webpage => Click on a button
This action starts the executable "CreatePrettyPicture"
The file "prettypicture.jpg" is created on the server
When the user reloads the page the pretty picture "PrettyPicture.jpg" is shown on the page.
If I could start the application with a parameter it would be even better.
The server is a using Debian and as web server I'm using Apache. Please let me know if you need more information about the server configuration.
The possibility of several users clicking on the button at the same time is not a part of the problem.
You need to read up on CGI Scripts.
It's also possible that PHP is already available on your server, but I wouldn't recommend using it unless you're already familiar with it and know all of the security pitfalls, which from the question appears very unlikely.
You would be better of using a server side script with your apache installation to start the executable. This is probably easier with PHP (which should be easy to install if it isnt already), here are the commands. As long as you dont actually use any input with the page it should be safe enough.