Using SimpleHttpFileServer with Gradle - gradle

I'm running some unit tests on Android, and I have to run an http server locally to get images from it during my tests. Until now, I'm using a python script that run the SimpleHttpServer of python, then call Gradle, then kill the server at the end.
I've found that there is a SimpleHttpFileServer that could be used in Gradle.
But I can't make it work. I found absolutely nothing about usage of this
class, except the doc here :
https://gradle.org/docs/current/javadoc/org/gradle/plugins/javascript/envjs/http/simple/SimpleHttpFileServer.html
that doesn't say much. What is a Stoppable for instance? No doc about it.
When I try to use it, I have this error :
Could not find matching constructor for:
org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServer
Anyone here has played with that? Or do you see any other way to do it? Another idea was to run the python server from Gradle, then kill it at the end, probably using task.finalizedBy, but I didn't success either.
Any help on any of those methods would be appreciated.
Thanks,
GĂ©rald

Related

bash script invoked in freeradius

Can you please help me insert my bash script into freeradius. I would like to start my script each time a user is allowed access via freeradius to my network.
I tried to insert my script into queries (/etc/freeradius/3.0/mods-config/sql/main/mysql/queries.conf), but the script is not invoked.
If you have any idea on how to do this please let me know.
Thank you in advance!
Adding random things to the SQL configuration isn't going to help here.
You need to configure the exec module, the best example is in mods-enabled/echo (though also see mods-enabled/exec). There are examples in that file on how to point to the script that you want to run, and what it should return.
Then to ensure that it is run after a successful authentication, make sure that echo (or whatever instance name you gave to the module configuration) is listed in the post-auth{} section of the correct virtual server, most likely sites-enabled/default.
Note that calling out to external scripts is nearly always a bad idea, it will cause performance to drop significantly. There is usually a better way to solve the problem.

Restart Go's net/http server on file-change like Django

I'm trying out Martini, which adds some nice functionality upon Go's basic net/http package.
I was wondering tho. How can I, like Django does too, let the server restart itself on source-file changes? I know how to monitor a file, but I'm not sure how to retrigger the Server within the same process.
I'm guessing to trigger http.ListenAndServe again, but I have a feeling it doesn't go well with instance already running.
Do I need to spawn a subprocess/daemon to get this working?
Maybe you need gin ?
Made by the creator of Martini.
You may give it a try
Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file.
You'll need to use an external tool that can watch a directory/files and run a command. I'd recommend reflex which is written in Go itself:
(modifying the example in the README):
# Rerun make whenever a .go file changes
reflex -r '\.go$' ./mymartiniapp

Working with Flask-Script and cron jobs

So I've been meaning to create a cron job on my prototype Flask app running on Heroku. Searching the web I found that the best way is by using Flask-Script but I fail to see the point of using it. Do I get easier access to my app logic and storage info? And if I do use Flask-Script, how do I organize it around my app? I'm using it right now to start my server without really knowing the benefits. My folder structure is like this:
/app
/manage.py
/flask_prototype
all my Flask code
Should I put the 'script.py' to be run by the Heroku Scheduler on app folder, the same level as manage.py? If so, do I get access to the models defined within flask_prototype?
Thank you for any info
Flask-Script just provides a framework under which you can create your script(s). It does not give you any better access to the application than what you can obtain when you write a standalone script. But it handles a few mundane tasks for you, like command line arguments and help output. It also folds all of your scripts into a single, consistent command line master script (this is manage.py, in case it isn't clear).
As far as where to put the script, it does not really matter. As long as manage.py can import it and register it with Flask-Script, and that your script can import what it needs from the application you should be fine.

waitForElementPresent command fails in (Jenkins SeleniumHQ) but succeeds in SeleniumIDE

I am fighting an issue where my Selenium IDE Test succeeds when searching for specific elements on a page (Command=waitForElementPresent and Target=link=Related Sites) but that same command is failing when I run it from within Jenkins 'SeleniumHQ htmlSuite Run'.
As an example;
waitForElementPresent link=Related Sites Timed out after 30000ms
I don't want to give the impression that all 'waitForElementtPresent' commands are failing because some are succeeding.
I just don't know if I'm dealing with a timing issue or I have to code the test differently when it will run within Jenkins 'SeleniumHQ htmlSuite Run'.
Any advice to help me understand why I get different behavior for the same command is perplexing me and am unsure how to solve.
Thank you in advance for assistance.
I guess your script has a default timeout set, that's why you are facing the problem.
Just try using selenium.setTimeout("0") in the constructor where you start selenium.

How to execute a Unix shell script via GWT?

Im building an GUI that will help my team mates to execute some jars without going using the terminal (with all the validating and stuff).
At some stage, the gui sould gather params from the gui and execute them, something like : --start -Xbootclasspath/p:lib/OB-4.3.4.jar:lib/OBNaming-4.3.4.jar -Dmy.property.ns=corbaloc:iiop:localhost:900/NameService -Dmachine=energie -Dexecutable=MOREventd -DtypeArbo=1 -jar MOREventd
I was wondering how could i do that since Runtime Exec doesn't work with Google Web Toolkit)
thx for any help.
The GWT module will need to send details about the invocation to a server by using GWT-RPC, RequestFactory, or some other communication package. The server will then execute the commands on behalf of the browser client.

Resources