The verifier tool’s syntax is as follows:
verifier [options] file
The file can be an EAR, WAR, RAR, or JAR file.
The following table shows the options for the verifier tool.
Table 1–2 Verifier Options
For example, the following command runs the verifier on the ejb.jar file with default settings:
verifier ejb.jar
The results files are ejb.jar.txt and ejb.jar.xml.
For a more complex example, the following command runs the verifier on the ejb.jar file in portability mode displaying only failures and with a timestamp:
verifier -p -rf -t ejb.jar
The results files are ejb.jartimestamp.txt and ejb.jartimestamp.xml. The format of the timestamp is yyyyMMddhhmmss.
If the verifier runs successfully and no verification errors occurred, a result code of 0 is returned. A nonzero error code is returned if errors occurred or the verifier fails to run.
You can integrate the verifier into an Ant build file as a target and use the Ant call feature to call the target each time an application or module is assembled. You can use any of the arguments described in Table 1–2. Example code for an Ant verify target is as follows:
<?xml version="1.0" encoding="iso-8859-1"?> <project name="Verifier Launcher" default="verify"> <target name="verify" description="verify using verifier script"> <exec executable="install-dir/bin/verifier" failonerror="true" vmlauncher="false"> <arg line="-d /tmp path-to-app"/> </exec> </target> </project>
Here is a sample results XML file:
<static-verification> <ejb> <failed> <test> <test-name> tests.ejb.session.TransactionTypeNullForContainerTX </test-name> <test-assertion> Session bean with bean managed transaction demarcation test </test-assertion> <test-description> For [ TheGreeter ] Error: Session Beans [ TheGreeter ] with [ Bean ] managed transaction demarcation should not have container transactions defined. </test-description> </test> </failed> </ejb> ... </static-verification>
Here is a sample results TXT file:
--------------------------- STATIC VERIFICATION RESULTS --------------------------- ---------------------------------- NUMBER OF FAILURES/WARNINGS/ERRORS ---------------------------------- # of Failures : 1 # of Warnings : 0 # of Errors : 0 ----------------------------- RESULTS FOR EJB-RELATED TESTS ----------------------------- -------------- FAILED TESTS : -------------- Test Name : tests.ejb.ejb30.BusinessIntfInheritance Test Assertion : A business interface must not extend javax.ejb.EJBObject or javax.ejb.EJBLocalObject. Please refer to EJB 3.0 Simplified API Section #3.2 for further information. Test Description : For [ sessionApp#session-ejb.jar#HelloEJB ] [ com.sun.sample.session.Hello ] extends either javax.ejb.EJBObject or javax.ejb.EJBLocalObject. ---------------------------------- END OF STATIC VERIFICATION RESULTS ----------------------------------