Unit Testing
The online technical support application is deployed and tested on the Sun Java System Application Server Platform Edition 8. You can download this application server from:
http://java.sun.com/j2ee/1.4/download.html
Note� | To install Sun Java System Application Server Platform Edition 8, you need to install Java 2 Standard Edition (J2SE) 1.4.2 on the computer. |
To deploy the online technical support application:
Select Programs->Sun Microsystems->J2EE 1.4 SDK ->Start Default Server from the Start menu to start the application server.
Select Programs->Sun Microsystems->J2EE 1.4 SDK ->Deploytool from the Start menu to open the Deployment Tool window.
Select New->Application from the File menu of the Deployment Tool window. The New Application dialog box appears.
Click Browse in the New Application dialog box to display another New Application dialog box.
Select the directory where you want to save the .ear file in the Look In combo box.
Enter the name of the .ear file as OnlineTechnicalSupportApp in the File Name text box, as shown in Figure 4-8:
Figure 4-8: The New Application Dialog BoxClick the New Application button to return to the previous New Application dialog box.
Click OK to create the new application.
Select New->Web Component from the File menu of the Deployment Tool window. The New Web Application Wizard-Introduction dialog box appears.
Click Next. The New Web Application Wizard-WAR File dialog box appears.
Click Edit Contents in the New Web Application Wizard-WAR File dialog box. The Edit Contents of WebApp dialog box appears.
Select all the JSP files, the QueryXMLGenerator.class file, and the path.properties file of the application from the Available Files pane and click Add. Select the xml directory as well from the Available Files pane and click Add. The Contents of WebApp pane of the Edit Contents of WebApp dialog box displays the added files, as shown in Figure 4-9:
Figure 4-9: The Edit Contents of WebApp Dialog BoxClick OK to add the files to the Web application Web Archive (WAR) file.
Click Next in the New Web Application Wizard-WAR File dialog box. The New Web Application Wizard-Choose Component Type dialog box appears.
Select the JSP Page radio button and click Next. The New Web Application Wizard-Component General Properties dialog box appears.
Select Logon.jsp from the JSP Filename drop-down list. The remaining fields get automatically populated with values. Figure 4-10 shows the New Web Application Wizard-Component General Properties dialog box:
Figure 4-10: The New Web Application Wizard-Component General Properties Dialog BoxClick Finish.
In the Deployment Tool window, specify/fourth as the context root of your application in the Context Root text field, as shown in Figure 4-11:
Figure 4-11: The Deployment Tool WindowSelect Save from the File menu of the Deployment Tool window to save the application.
Select Deploy from the Tools menu. The Deploy Module OnlineTechnicalSupportApp dialog box appears.
Specify the application server user name and password in the User Name and Password fields and click OK.
The Distribute Module dialog box appears. It indicates the successful deployment of the application.
To test the deployed application:
Specify the following URL in the address bar of the browser:
http://localhost:8080/fourth/Logon.jsp
In the Logon JSP page, specify Peter in the Logon ID field and peter in the Password field, as shown in Figure 4-12:
Figure 4-12: The Logon JSP PageClick the Logon button. The DoLogon Page appears which displays the Logout and Go to main page hyperlinks.
Select the Go to main page hyperlink. The User Options page appears, as shown in Figure 4-13:
Figure 4-13: The User Options Page Containing HyperlinksSelect the Post a new query hyperlink. The New Query page appears.
Specify a query to post, as shown in Figure 4-14:
Figure 4-14: Posting a QueryClick the Submit Query button to post the query.
Check the querylist.xml file to ensure that your query has been added to the file.
Select the Logout hyperlink in the New Query page. The Logon JSP page appears.
Specify admin in the User ID and Password fields and click Logon. The Administrator Options page appears, as shown in Figure 4-15:
Figure 4-15: The Administrator Options Page Containing HyperlinksSelect the Post reply to query hyperlink. The Query Reply page appears.
Select the title of the query you posted using steps 5 through 7 from the Query title drop-down list. Specify the date of reply and the reply in the Date and Reply fields, as shown in Figure 4-16:
Figure 4-16: Posting a ReplyClick the Post Reply button.
Check the querylist.xml file to ensure that the reply has been added to the file.
Select the Go to main page hyperlink in the Query Reply page.
Select the View query list hyperlink in the Administrator Options page. The View Query page appears.
Select the title of the query you added in the user module from the Query title drop-down list. Select View query in XML from the Output drop-down list, as shown in Figure 4-17:
Figure 4-17: Selecting a Query FormatClick the View Query button. The browser displays the dynamically generated XML content that contains the query information, as shown in Figure 4-18:
Figure 4-18: Dynamically Generated XML ContentClick the Back button of the browser to return to the View Query page.
In the View Query page, select View query in HTML from the Output drop-down list and click View Query.
The style sheet of the application displays the XML content in HTML format, as shown in Figure 4-19:
Figure 4-19: Query in HTML FormatIn the View Query page, select Download query from the Output drop-down list and click View Query.
The File Download dialog box appears, as shown in Figure 4-20:
Figure 4-20: The File Download Dialog BoxClick the Save button to save the content as an XML file. The Save As dialog box appears. From the Save in drop-down list, select the directory in which you want to save the XML file, as shown in Figure 4-21:
Figure 4-21: The Save As Dialog BoxClick Save to save the content as an XML file.
Select Logout in the View Query page to logout from the application.
No comments:
Post a Comment