| <?xml version="1.0" encoding="UTF-8"?> |
| <?xml-stylesheet type="text/xsl" href="../../../../wtp.xsl"?> |
| <html> |
| <head> |
| <meta |
| name="root" |
| content="../../../../.." /> |
| <title>test plan: Web validation</title> |
| </head> |
| |
| <body> |
| <h1>jst j2ee</h1> |
| <h2>Introduction</h2> |
| <p> |
| Validation is provided for Web Application of version 2.1, 2.2 and 2.3. |
| When validation runs both the web project structure, as well as the |
| web.xml and any web related artifacts are validated. The following test |
| scenario is aimed at exercising all validation checks to insure they are |
| working properly. In order to properly test the validation, invalid |
| states must be created by the user by editing the web.xml as well as the |
| project structure. The following scenario gives a list of states the |
| validator checks and instructions on how to edit your web app to achieve |
| these "invalid" states. |
| <br /> |
| <br /> |
| Import each of the following web application (one for each spec version) |
| which contains examples needed to run all War related validation checks. |
| Follow every step below for each archive web application. |
| <br /> |
| For each of the following steps, open the web.xml....make the change |
| needed, save then run validation (by building or selecting "Run |
| Validation" after right clicking on the project) and check the |
| problems view (note: you may need to open the Problems view by hand |
| </p> |
| |
| <h2>Steps</h2> |
| <p> |
| <ol> |
| |
| <LI> |
| <B>Servlet Mapping</B> |
| <br /> |
| Navigate to the |
| <FONT color="#0000ff"><servlet-mapping></FONT> |
| tag |
| <br /> |
| <UL> |
| <LI> |
| Change the name to "HellowServlet1". Save and |
| run validaiton to see a warning |
| <br /> |
| CHKJ3004W: The servlet mapping "/HelloServlet" |
| refers to a servlet that is not defined. web.xml |
| WebValidationTest23/WebContent/WEB-INF |
| </LI> |
| <LI> |
| Undo this change and continue |
| <br /> |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Authorized role for a servlet mapping</B> |
| <br /> |
| Add the following to the dd after the |
| <FONT color="#0000ff"><welcome-file-list></FONT> |
| . Save and run validation. There should be no errors |
| <br /> |
| <UL> |
| <LI> |
| |
| <B> |
| <security-role> |
| <br /> |
|     <description>This is a |
| user He is cool</description> |
| <br /> |
|     <role-name>user</role-name> |
| <br /> |
| </security-role> |
| <br /> |
| <security-role> |
| <br /> |
|     <description>This is |
| the boss</description> |
| <br /> |
|     <role-name>manager</role-name> |
| <br /> |
| </security-role> |
| </B> |
| |
| <br /> |
| <br /> |
| and add the following to the <servlet> element |
| <br /> |
| <br /> |
| <B> |
| <security-role-ref> |
| <br /> |
|     <role-name>user |
| role</role-name> |
| <br /> |
|     <role-link>user</role-link> |
| <br /> |
| </security-role-ref> |
| </B> |
| </LI> |
| <br /> |
| <br /> |
| <LI> |
| Remove the role-name "user role" in the |
| security-role-ref Error Invalid Security role name |
| </LI> |
| <LI> |
| Remove the role-link "user" in the |
| security-role-ref Error InvalidSecurity role-link |
| </LI> |
| <LI> |
| Remove the role-name "user" on the |
| security-role |
| <br /> |
| Error: Invalid Security role-link: user |
| <br /> |
| Error: Empty entry of type security role name |
| </LI> |
| <LI> |
| Undo this change but leave the security roles |
| <br /> |
| </LI> |
| </UL> |
| <br /> |
| </LI> |
| |
| <LI> |
| <B> |
| <I>User roles that are permitted access to security roles</I> |
| </B> |
| <BR /> |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <BR /> |
| <B> |
| <security-constraint> |
| <BR /> |
|     <web-resource-collection> |
| <BR /> |
|       <web-resource-name>secure |
| content</web-resource-name> |
| <BR /> |
|       <description></description> |
| <BR /> |
|       <url-pattern>/secure</url-pattern> |
| <BR /> |
|       <http-method>PUT</http-method> |
| <BR /> |
|       <http-method>HEAD</http-method> |
| <BR /> |
|     </web-resource-collection> |
| <BR /> |
|     <auth-constraint> |
| <BR /> |
|       <description>this |
| is secure</description> |
| <BR /> |
|       <role-name>user</role-name> |
| <BR /> |
|     </auth-constraint> |
| <BR /> |
|     <user-data-constraint> |
| <BR /> |
|         <transport-guarantee>INTEGRAL</transport-guarantee> |
| <BR /> |
|     </user-data-constraint> |
| <BR /> |
| </security-constraint> |
| <BR /> |
| </B> |
| <BR /> |
| and add the following |
| <BR /> |
| <BR /> |
| <B><web-resource-collection></B> |
| <BR /> |
| <B> |
|       <web-resource-name>WRC1</web-resource-name> |
| <BR /> |
|       <description></description> |
| <BR /> |
|       <http-method>PUT</http-method> |
| <BR /> |
|       <http-method>GET</http-method> |
| <BR /> |
| </web-resource-collection> |
| </B> |
| </LI> |
| |
| <LI> |
| change the PUT or GET to RANDOM or JUNK and save.Notice |
| the new error (then undo). |
| </LI> |
| <LI> |
| Renambe the <transport-guarantee> from INTEGRAL to |
| RANDOM and save. Notice the new error (then undo). |
| </LI> |
| <LI> |
| Rename |
| <FONT color="#0000ff"><role-name></FONT> |
| from user to user 1 and save. Notice the new error (then |
| undo). |
| </LI> |
| </UL> |
| <br /> |
| </LI> |
| |
| <LI> |
| <B> |
| Login Authentication |
| <br /> |
| </B> |
| |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <br /> |
| <B> |
| <login-config> |
| <br /> |
|     <auth-method>FORM</auth-method> |
| <br /> |
|     <form-login-config> |
| <br /> |
|         <form-login-page>/index.html</form-login-page> |
| <br /> |
|         <form-error-page>/error.html</form-error-page> |
| <br /> |
|     </form-login-config> |
| <br /> |
| </login-config> |
| </B> |
| </LI> |
| <LI> |
| Rename |
| <FONT color="#0000ff"><auth-method></FONT> |
| FORM to BASIC and save. Notice the new validation |
| warning. (then undo). |
| </LI> |
| <LI> |
| Rename |
| <FONT color="#0000ff"><auth-method></FONT> |
| FORM to RANDOM and save. Notice the new error (then |
| undo). |
| </LI> |
| <LI> |
| Delete the |
| <FONT color="#0000ff"><url-pattern></FONT> |
| element in the <servlet-mapping>. Notice the new |
| error (then undo). |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Session Timeout</B> |
| |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <br /> |
| <B> |
| <session-config> |
| <br /> |
|     <session-timeout>30</session-timeout> |
| <br /> |
| </session-config> |
| </B> |
| </LI> |
| <LI> |
| Change the 30 to 30.5 and save. Notice the new error |
| (then undo). |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Error Code</B> |
| <br /> |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <br /> |
| <B> |
| <error-page> |
| <br /> |
|     <error-code>404</error-code> |
| <br /> |
|     <location>/error.html</location> |
| <br /> |
| </error-page> |
| <br /> |
| <error-page> |
| <br /> |
|     <exception-type>com.ibm.servlet.PageNotFoundException</exception-type> |
| (Could not find class PageNotFoundException...) |
| <br /> |
|     <location>/error.html</location> |
| <br /> |
| </error-page> |
| </B> |
| </LI> |
| <LI> |
| Verify that only error code can go into |
| <FONT color="#0000ff"><error-code></FONT> |
| by changing 404 to a string and save. Notice the new |
| error (then undo) |
| </LI> |
| <LI> |
| Verify that only Java Exception Class can go into |
| <FONT color="#0000ff"><exception-type></FONT> |
| by changing to RANDOM and save. Notice the new error |
| (then undo) |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Resource References</B> |
| <br /> |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <B> |
| <br /> |
| <resource-ref id="ResourceRef_1"> |
| <br /> |
|     <description></description> |
| <br /> |
|     <res-ref-name>HelloWorld</res-ref-name> |
| <br /> |
|     <res-type>java.lang.Object</res-type> |
| <br /> |
|     <res-auth>Container</res-auth> |
| <br /> |
| </resource-ref> |
| </B> |
| </LI> |
| <LI> |
| Verify |
| <FONT color="#0000ff"><res-auth></FONT> |
| can only be "Application" or |
| "Servlet" by changing both to |
| "RANDOM" and saving. Notice the new error (then |
| undo). |
| <br /> |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Filter</B> |
| <br /> |
| <UL> |
| <LI> |
| In the web.xml navigate to the the |
| <FONT color="#0000ff"><filter></FONT> |
| tag. |
| </LI> |
| <LI> |
| Change |
| <FONT color="#0000ff"><filter-name></FONT> |
| MyFilter |
| <FONT color="#0000ff"></filter-name></FONT> |
| to RANDOM and save. Notice the new error (then undo) |
| </LI> |
| <LI> |
| In the |
| <FONT color="#0000ff"><filter-mapping></FONT> |
| , change |
| <FONT color="#0000ff"><filter-name></FONT> |
| MyFilter |
| <FONT color="#0000ff"></filter-name></FONT> |
| to RANDOM and save. Notice the new error (then undo). |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Listener</B> |
| <UL> |
| <LI> |
| Add the following to the web.xml after the |
| <FONT color="#0000ff"><welcome-filelist></FONT> |
| tag and before the |
| <FONT color="#0000ff"><security-role></FONT> |
| tags |
| <B> |
| <br /> |
| <listener> |
| <br /> |
|     <listener-class>webtooling.MyListener</listener-class> |
| <br /> |
| </listener> |
| </B> |
| </LI> |
| <LI> |
| Change |
| <FONT color="#0000ff"><listener-class></FONT> |
| webtooling.MyListener |
| <FONT color="#0000ff"></listener-class></FONT> |
| to RANDOM and save. Notice the new error (then undo). |
| </LI> |
| </UL> |
| <BR /> |
| </LI> |
| |
| <LI> |
| <B>Validation Enablement</B> |
| <UL> |
| <LI> |
| Right click on one of your web projects and select |
| properties. IN the Validation submenu, select override |
| validation prefernces and deselect "War |
| Validator". Now rerun one of the above steps to |
| insure validation does not run on a build (note: it does |
| by default) and that the Run Validation menu item is |
| disabled. |
| </LI> |
| </UL> |
| <br /> |
| <UL></UL> |
| </LI> |
| |
| </ol> |
| </p> |
| |
| </body> |
| </html> |