The TCK provides the VerifySMAP
utility which is used to validate the SMAP
generated by the product being tested.
The TCK does not provide the input files (.smap
or .class
) which need to be
generated by the product being tested.
Tools Required:
- JDK 8+
- Apache Ant 1.10.1+
Steps for building TCK bundle:
-
Set the environment variables:
export JAVA_HOME=<JAVA_INSTALL_DIR> export ANT_HOME=<ANT_INSTALL_DIR> export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
-
Run the ant command
ant clean dist
-
The generated bundle
dsol-tck-<version>.zip
can be found under thedist
directory.
Tools Required:
- JDK 8+
- Apache Ant 1.10.1+
- Glassfish 6.0+
Steps for Testing GlassFish:
-
Set the following init parameters for JSP page compiler and execution servlet in
domains/domain1/config/default-web.xml
.<servlet> <servlet-name>jsp</servlet-name> <servlet-class> org.apache.jasper.servlet.JspServlet </servlet-class> ... <init-param> <param-name>keepgenerated</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>dumpSmap</param-name> <param-value>true</param-value> </init-param> ... </servlet>
-
Start GlassFish server.
-
Create a sample web module by packaging a sample JSP and deploy the web module.
-
Accessing the JSP to get the generated .smap file under the directory
domains/domain1/generated/jsp/<web app name>/org/apache/jsp
. -
Run the smap verifier supplied with TCK
java VerifySMAP domains/domain1/generated/jsp/<web app name>/org/apache/jsp/Hello_jsp.class.smap
Assertion : The output of the java program should report that the
.smap
file is correctly formatted one. Something like below:<GlassFish Home>/domains/domain1/generated/jsp/testclient/org/apache/jsp/Hello_jsp.class.smap is a correctly formatted SMAP
Steps for Negative Testing :
-
Edit the generated
.smap
file such that the syntax becomes invalid as per the specification. -
Run
VerifySMAP
with the invalid.smap
file.Assertion : The output of the java program should report that the
.smap
file is incorrectly formatted one. Something like below:Assertion #1 failed - SMAP syntax error <GlassFish Home>/domains/domain1/generated/jsp/testclient/org/apache/jsp/Hello_jsp.class.smap:14: unexpected end of SMAP Exception in thread "main" VerifySMAP$AssertionViolationException: assertion #1 failed - SMAP syntax error