Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Java Tools for Extreme programming mastering open source tools including - Hightower R.

Hightower R. Java Tools for Extreme programming mastering open source tools including - Wiley publishing , 2002. - 417 p.
ISBN: 0-471-20708
Download (direct link): javatoolsforextremeprog2002.pdf
Previous << 1 .. 14 15 16 17 18 19 < 20 > 21 22 23 24 25 26 .. 159 >> Next

34
Figure 3.7: JSP Block Diagram for the Baseline Case Study.
The JSPs use the CategorySystem to display the object model of the application. Each page includes header.jsp, which in turn includes category_sys.jsp, which uses jsp:useBean to map in a CategorySystem instance as follows:
<%@page import-'xptoolkit.petstore.model.*'' %>
<jsp:useBean id-'categorySystem'' class-'CategorySystem" scope-
"session"/>
All the JSPs use the categorySystem to create and get objects. For example, here is a partial listing of the Product.jsp page:
Category category = categorySystem.getCurrentCategory(); Subcategory subcategory = categorySystem.getCurrentSubcategory();
String productId = request.getParameter("id");
Product product = subcategory
.getProduct( Integer.parselnt(productld) );
<b><%= product.getName() %></b>
<br>
<%= product.getDescription() %>
The baseline version of the application just reads data out of the database. Later versions of the application will edit, add, and delete products using an extended categorySystem.
35
Build System
This section jumps the gun a bit. We explain how the build system is structured, but we have not yet covered Ant and JUnit. The idea is to give you a glimpse of things to come. Please read this section with the realization that the material covered in this section is explained in detail later.
The case study baseline uses five buildfiles: main model
webapplication test
setupDB
The main buildfile is located in the root directory of the baseline version (see Figure 3.8). The main buildfile orchestrates the execution and deployment of the other buildfiles.
S&NetBeans IDE 3.2.1 (Build 38) [Protect Greek]
HZ]
Fde Edit View Project Buitd Debuts Versioning TooJs Wndow Help
Editing GUI Editing Browsing Running Debugging
BD Explorer [Filesystems] ;
13
9 C\examdesiiCaseSludiesibasetirte 9 _ META-INF
&U application 9 <3 Model ©? Q java 0*[^ build [mode!]
9 ?& Test 0- Q java ©? |.^ build [test)
0-1.:|> buildDB (setupDB]
9 "SI WebApplication 0- Q java 0- ? public-btml 0- [.[?§* build [webapplicahun]
9 13 lito
] j2ee.jar 9 testlib
_] jnnit.jar 9 build [main)
0- setProps
1 [3 Filesv”cm; O Project Greek 'jv' Javadoc ^ Runtime
... ny
HIl M
Figure 3.8: Source Directory Structure of the Baseline.
The model buildfile builds and packages the model and dbmodel classes. The end result of the model buildfile is a JAR file (petmodel.jar) that is stored in the lib directory of the output (see Figure 3.9).
36
Figure 3.9: Output Directory Structure of the Baseline.
The webapplication buildfile compiles and builds the Web application. The end result of the webapplication buildfile is a WAR file (pet.war) that can be deployed to any J2EE-compliant servlet/JSP engine such as WebLogic, Resin, Tomcat, or Orion (see Figure 3.9 and look for pet.war).
The test buildfile packages and builds the test classes (JUnit) and runs the tests. The test results are stored in XML files in the reports directory (see Figure 3.9 and look for the reports directory). Then, the test buildfile transforms the XML into an HTML report (see Figures 3.10 and 3.11, which show the test results in a browser).
37
? pera 5 - [Unit Tests Results.]
[3] tile Edit View Navigation Bookmarks ! mail Messaging News Window Help ..v.J.-IlLTJ
c a b ? o . a New Print Find Hotlist Back Reload OPERA 5 *n OPERA ™ software
* , m The fastest browser on earth.1
Forward Home
5:14 PM
|_| [=) I file://localhost/'Ci/trnp/'petstore/'reports/'html/inde:-;. htrnl Q ?* |<Search with Google here> ^ t
100% V
;Ome
Packages
test, xptoolkit. petstore. model
test.xptoolkit.Detsto re. model Classes
C ate q ?=? rw 5 y 5 te mT est CategoryTest P ro d u ctT 0 ft Sub cat eg or i.1 Test
a
Unit Tests Results.
Unit Tests Results
Designed for use with JUnit and Ant.
Package test.Kptoolkit.petstore.model
Name Tests Errors Failures Time(s)
test, xptoo 1 kit, petstore, model 13 0 0 9.9?4
Classes
Name Tests Errors Failures Time(s)
C ate a o rv S v ste mTe st 5 0 0 9.313
CateaorvTest 4 0 0 0,100
P ro d u ctT e stj 2 0 0 0.300
SubcateaorvTest 2 0 0 0.161
Figure 3.10: Results of all the Tests.
38
? pera 5 - [Unit Tests Results.]
[3] Eile Edit View Navigation Bookmarks ! mail Messaging News Window Help
c a b ? o . a New Print Find Hotlist Back Reload OPERA 5 -H OPERA software
* , m The fastest browser on earth.1 ?
Forward Home
5:16 PM
|_| [=) I file://localhost/'Ci/trnp/'petstore/'reports/'html/inde:-;. htrnl Q ?* |<Search with Google here> ^ t
100% V
Home Unit Tests Results
Packages Designed for use with JUnit and Ant.
test, xotoolkit, Detstore. model Class test.xptoolkit,petstore.model.Cate gory SystemTest
Test?ase CategorySyster nTest
Name Status Type Time(s)
te st.x it tool kit.Detstore. model te stG etc u rr e ntC a te g o ry Success? 7.951
Classes te stG etS u b cate g o ry Success ? ,411
C ate q o ry S y ste mTe st testGstProduct Success 0.S11
Cate a ory Test te stG etc u rr e ntS u b cate g o r y Success ? .?GO
Previous << 1 .. 14 15 16 17 18 19 < 20 > 21 22 23 24 25 26 .. 159 >> Next