6.24. Testing Iteration 3Now 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:
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 |