Section 6.24. Testing Iteration 3

6.24. Testing Iteration 3

Now that we've developed all the code and infrastructure for buying a car, let's test the application to ensure that everything works properly. Here are the steps to build and deploy the application:

  • Type ant in the root directory of ch06-c to build the project.

  • Shut down JBoss so the Ant script can clean up the JBoss deployment area.

  • Type ant colddeploy to deploy the EAR file (jaw.ear) to the $JBOSS_HOME/server/default/deploy directory.

  • Start JBoss back up.

  • Go to the ch06-c/sql sub-directory and type ant to modify the database.

  • Visit http://localhost:8080/jaw in a web browser.

When you click on the "View Inventory" on the JAW Motors home page, the Controller Servlet takes you to the Inventory page where you can view, add, edit, delete, or buy cars in JAW Motors' Inventory. Click on one of the "Buy" links and the Controller will route you to the Buy Car page. Enter a price in the form and press the "Save" button. The Controller Servlet then takes you back to the Car Inventory page. The car that was just purchased is no longer available, so it won't show up on the Car Inventory page.

As a final test, we need to ensure that the transaction was recorded properly in the database. Go to the ch06-c/sql sub-directory and type: "ant query". The query target queries the CAR and ACCOUNTING tables. Depending on which car you bought, you should see something like this on the command console:

 query:     [echo] Checking the CAR and ACCOUNTING tables ...     [sql] Executing commands     [sql] ID,MAKE,MODEL,MODEL_YEAR,STATUS     [sql] 99,Toyota,Camry,2005,Sold     [sql] 100,Toyota,Corolla,1999,Available     [sql] 101,Ford,Explorer,2005,Available     [sql] 0 rows affected     [sql] ID,CAR_ID,PRICE,SALE_DATE     [sql] 0,99,12000.0,2005-06-01     [sql] 0 rows affected     [sql] 2 of 2 SQL statements executed successfully 

JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: