I am just working on a plugin when I have some spare cycles (I will tell you which one in a few days :-)
To test the plugin I am using the Standalone Container where I have deployed my plugin, the JMX and the platform plugin.
So when I have compiled a new version of the plugin I just copy it over and start the standalone container:
snert:rhq-agent hrupp$ bin/standalone.sh
Listening for transport dt_socket at address: 8788
Starting the plugin container.
...Loaded plugin: Platforms
...Loaded plugin: JMX
...Loaded plugin: MyNewOne
This takes 3 seconds and then I am ready to discover resources:
:0 > disc s
Discovery took: 2269ms
[Resource[id=-3, type=Secret, key=service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector, name=Secret, parent=snert]]
Now I can test if my
invokeOperation()method from the OperationFacet works:
:-0 > set res -3
:-3 > invoke getProperty name=test
[PropertySimple[id=0, name=result, value=null, override=null]]
So set the resource id to the resource I want to work with and then invoke the getProperty operation with parameter name and value test. The Operation then returned null, as the underlying resource does not know this specific value.
This all took around 10 seconds now for a round trip - you can't really do faster testing :-)
When I want to repeat those steps with an updated version of the plugin, I can save my work:
:-3 > !w /tmp/foo
This creates a file and saves the commands given in it. The name of the file can later be given on the command line to just run the action as a script without any need to manually type in the commands.
There is currently one caveat: Resource ids will change in each startup so the "set" command in step 2 above will not work exactly like this.
I will work on adding variables to the find command in the standalone container which can then be passed to set -- if you want to help out contact me.
What you can do is to use $r as 2nd parameter to set after finding a single resource:
:0 > find r *myFooBar*
-12: MyFooBar ( Resource[id=-3, ... )
:0 > set r $r
With this trick it is now possible to just run the container with the saved file as input again and again
$snert bin/standalone.sh /tmp/foo