Red Hat Bugzilla – Bug 796680
asserts not working in alert CLI scripts
Last modified: 2012-02-27 17:24:46 EST
+++ This bug was initially created as a clone of Bug #796405 +++
Description of problem:
The CLI is documented to have a series of assert* functions available for the scripts to use. These don't work in the server because we fail to bundle testng.jar in server's lib.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a CLI script with the following body:
2. Define an alert with the above script as a notification
3. Let the alert fire
The script seems to have succeeded but the server log contains a NoClassDefFoundError of org/testng/Assert.
The assertion should have executed correctly and produced expected result (in this case, it should throw an AssertionError which should make the notification fail and produce an appropriate error message).
--- Additional comment from firstname.lastname@example.org on 2012-02-22 15:21:15 EST ---
can you document a reference to where you see the assert* statements documented? i actually can't find this in the JON documentation (and if it is not documented, clone a doc BZ ... if needed)
--- Additional comment from email@example.com on 2012-02-22 15:28:42 EST ---
This can be solved in 2 ways:
1) bundle the testng.jar with the RHQ server
2) fix bug 786795
I am in favor of the latter since bundling the whole of testng because of a couple of assert functions seems like a complete waste of diskspace and memory.
--- Additional comment from firstname.lastname@example.org on 2012-02-22 15:31:04 EST ---
<lkrejci> sunny-dee: i found this http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/100/html/Running_JON_Command-Line_Scripts/Running_the_CLI-Running_the_JON_CLI.html#Working_with_the_CLI-Implicit_Variables but that doesn't mention the functions
<sunny-dee> the answer is yes -- except for asserts
<sunny-dee> assert functions are missing; i have a sticky note to get that fixed
DOC BZ to add documentation on missing CLI assert functionality
--- Additional comment from email@example.com on 2012-02-23 08:20:15 EST ---
As opposed to the original repro steps, the exception that is going to get thrown is ScriptAssertionException.
Author: Lukas Krejci <firstname.lastname@example.org>
Date: Wed Feb 22 23:54:04 2012 +0100
[BZ 796405] - Catching any throwable while running a CLI script alert
notification. This will ensure that whatever exception happens (that the
script engine doesn't catch and rethrow as ScriptException) will cause the
notification to fail and be reported as such.
triage to JON 3.1 mfoley, crouch
triage 2/27/2012 mfoley, asantos, crouch, loleary