Java Extreme Programming Cookbook (O'Reilly, ebook, programowanie, nowy katalog

[ Pobierz całość w formacie PDF ]
Java™ Extreme Programming Cookbook
By
Eric M. Burke
,
Brian M. Coyner
Publisher: O'Reilly
Pub Date: March 2003
ISBN: 0-596-00387-0
Pages: 288
Brimming with over 100 "recipes" for getting down to business and actually doing XP,
the
Java Extreme Programming Cookbook
doesn't try to "sell" you on XP; it
succinctly documents the most important features of popular open source tools for XP
in Java-- including Ant, Junit, HttpUnit, Cactus, Tomcat, XDoclet-- and then digs right
in, providing recipes for implementing the tools in real-world environments.
Copyright
Dedication
Preface
About the Recipes
Organization
Conventions Used in This Book
Comments and Questions
Acknowledgments
Chapter 1. XP Tools
Section 1.2. Tools and Philosophies
Section 1.3. Open Source Toolkit
Chapter 2. XP Overview
Section 2.2. Coding
Section 2.3. Unit Testing
Section 2.4. Refactoring
Section 2.5. Design
Section 2.6. Builds
Chapter 3. Ant
Section 3.1. Introduction
Section 3.2. Writing a Basic Buildfile
Section 3.3. Running Ant
Section 3.4. Providing Help
Section 3.5. Using Environment Variables
Section 3.6. Passing Arguments to a Buildfile
Section 3.7. Checking for the Existence of Properties
Section 3.8. Defining a Classpath
Section 3.9. Defining Platform-Independent Paths
Audience
Section 1.1. Java and XP
Section 2.1. What Is XP?
Section 3.10. Including and Excluding Files
Section 3.11. Implementing Conditional Logic
Section 3.12. Defining a Consistent Environment
Section 3.13. Preventing Build Breaks
Section 3.14. Building JAR Files
Section 3.15. Installing JUnit
Section 3.16. Running Unit Tests
Section 3.17. Running Specific Tests
Section 3.18. Generating a Test Report
Section 3.19. Checking Out Code from CVS
Section 3.20. Bootstrapping a Build
Chapter 4. JUnit
Section 4.1. Introduction
Section 4.2. Getting Started
Section 4.3. Running JUnit
Section 4.4. assertXXX( ) Methods
Section 4.5. Unit Test Granularity
Section 4.6. Set Up and Tear Down
Section 4.7. One-Time Set Up and Tear Down
Section 4.8. Organizing Tests into Test Suites
Section 4.9. Running a Test Class Directly
Section 4.10. Repeating Tests
Section 4.11. Test Naming Conventions
Section 4.12. Unit Test Organization
Section 4.13. Exception Handling
Section 4.14. Running Tests Concurrently
Section 4.15. Testing Asynchronous Methods
Section 4.16. Writing a Base Class for Your Tests
Section 4.17. Testing Swing Code
Section 4.18. Avoiding Swing Threading Problems
Section 4.19. Testing with the Robot
Section 4.20. Testing Database Logic
Section 4.21. Repeatedly Testing the Same Method
Chapter 5. HttpUnit
Section 5.1. Introduction
Section 5.2. Installing HttpUnit
Section 5.3. Preparing for Test-First Development
Section 5.4. Checking a Static Web Page
Section 5.5. Following Hyperlinks
Section 5.6. Writing Testable HTML
Section 5.7. Testing HTML Tables
Section 5.8. Testing a Form Tag and Refactoring Your Tests
Section 5.9. Testing for Elements on HTML Forms
Section 5.10. Submitting Form Data
Section 5.11. Testing Through a Firewall
Section 5.12. Testing Cookies
Section 5.13. Testing Secure Pages
Chapter 6. Mock Objects
Section 6.1. Introduction
Section 6.2. Event Listener Testing
Section 6.3. Mock Object Self-Validation
Section 6.4. Writing Testable JDBC Code
Section 6.5. Testing JDBC Code
Section 6.6. Generating Mock Objects with MockMaker
Section 6.7. Breaking Up Methods to Avoid Mock Objects
Section 6.8. Testing Server-Side Business Logic
Chapter 7. Cactus
Section 7.2. Configuring Cactus
Section 7.3. Setting Up a Stable Build Environment
Section 7.4. Creating the cactus.properties File
Section 7.5. Generating the cactus.properties File Automatically
Section 7.6. Writing a Cactus Test
Section 7.7. Submitting Form Data
Section 7.8. Testing Cookies
Section 7.9. Testing Session Tracking Using HttpSession
Section 7.10. Testing Servlet Initialization Parameters
Section 7.11. Testing Servlet Filters
Section 7.12. Securing Cactus Tests
Section 7.13. Using HttpUnit to Perform Complex Assertions
Section 7.14. Testing the Output of a JSP
Section 7.15. When Not to Use Cactus
Section 7.16. Designing Testable JSPs
Chapter 8. JUnitPerf
Section 8.1. Introduction
Section 8.2. When to Use JUnitPerf
Section 8.3. Creating a Timed Test
Section 8.4. Creating a LoadTest
Section 8.5. Creating a Timed Test for Varying Loads
Section 8.6. Testing Individual Response Times Under Load
Section 8.7. Running a TestSuite with Ant
Section 8.8. Generating JUnitPerf Tests
Chapter 9. XDoclet
Section 9.2. Setting Up a Development Environment for Generated Files
Section 9.3. Setting Up Ant to Run XDoclet
Section 9.4. Regenerating Files That Have Changed
Section 9.5. Generating the EJB Deployment Descriptor
Section 9.6. Specifying Different EJB Specifications
Section 9.7. Generating EJB Home and Remote Interfaces
Section 7.1. Introduction
Section 9.1. Introduction
Section 9.8. Creating and Executing a Custom Template
Section 9.9. Extending XDoclet to Generate Custom Files
Section 9.10. Creating an Ant XDoclet Task
Section 9.11. Creating an XDoclet Tag Handler
Section 9.12. Creating a Template File
Section 9.13. Creating an XDoclet xdoclet.xml File
Section 9.14. Creating an XDoclet Module
Chapter 10. Tomcat and JBoss
Section 10.2. Managing Web Applications Deployed to Tomcat
Section 10.3. Hot-Deploying to Tomcat
Section 10.4. Removing a Web Application from Tomcat
Section 10.5. Checking If a Web Application Is Deployed
Section 10.6. Starting Tomcat with Ant
Section 10.7. Stopping Tomcat with Ant
Section 10.8. Setting Up Ant to Use Tomcat's Manager Web Application
Section 10.9. Hot-Deploying to JBoss
Section 10.10. Hot-Deploying a Web Application to JBoss
Section 10.11. Testing Against Multiple Servers
Chapter 11. Additional Topics
Section 11.2. Testing XML Files
Section 11.3. Enterprise JavaBeans Testing Tools
Section 11.4. Avoiding EJB Testing
Section 11.5. Testing Swing GUIs
Section 11.6. Testing Private Methods
Colophon
Index
Copyright © 2003 O'Reilly & Associates, Inc.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O'Reilly & Associates books may be purchased for educational, business, or sales promotional use.
Online editions are also available for most titles (
). For more information,
contact our corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com
.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of
O'Reilly & Associates, Inc. Java and all Java-based trademarks and logos are trademarks or registered
trademarks of Sun Microsystems, Inc., in the United States and other countries. O'Reilly &
Associates, Inc. is independent of Sun Microsystems. The licenses for all the open source tools
presented in this book are included with the online examples. Many of the designations used by
manufacturers and sellers to distinguish their products are claimed as trademarks. Where those
designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the
Section 10.1. Introduction
Section 11.1. Introduction
designations have been printed in caps or initial caps. The association between the image of a bison
and the topic of Java programming is a trademark of O'Reilly & Associates, Inc.
While every precaution has been taken in the preparation of this book, the publisher and authors
assume no responsibility for errors or omissions, or for damages resulting from the use of the
information contained herein.
Dedication
For Jennifer, Aidan, and Tanner
—Eric M. Burke
For Mom and Dad
—Brian M. Coyner
Preface
Anyone involved with the open source community or using open source software knows there are tons
of tools available on the market. Keeping up with these tools, and knowing which tools to use and
how to use them, is an intimidating road to travel. We hope to simplify your journey by showing
concise, useful recipes for some of the more popular open source Java tools on the market today.
We show you tools like JUnit, JUnitPerf, Mock Objects (more of a concept), and Cactus for testing
Java code. We show how to generate EJB files using XDoclet, too. All tools discussed in this book are
completely executable through Ant, allowing for a complete and stable build environment on any
Java-enabled platform.
This is also a book about Extreme Programming (XP), which led us to choose the tools that we did.
The XP software development approach does not depend on a particular set of tools; however, the
right tools certainly make following XP practices easier. For instance, test-first development is a
cornerstone of XP, so most of the tools in this book are testing frameworks. XP also demands
continuous integration, which is where Ant fits in. We are big fans of automation, so we cover the
XDoclet code generator as well as describe ways to automate deployment to Tomcat and JBoss.
Audience
This book is for Java programmers who are interested in creating a stable, efficient, and testable
development environment using open source tools. We do not assume any prior knowledge of XP or
the tools covered in this book, although we do assume that you know Java. The chapters generally
open with simple recipes and progress to more advanced topics.
About the Recipes
This book is a collection of solutions and discussions to real-world Java programming problems. The
recipes include topics such as writing JUnit tests, packaging and deploying server-side tests to
application servers, and generating custom code using XDoclet. Each recipe follows the same format.
A problem and brief solution is presented, followed by in-depth discussion.
[ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • red-hacjenda.opx.pl