Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 41.
It is not the current version, and thus it cannot be edited. Part II: Creating new Managers - A HowTo for creating Business Delegates ![]()
About this TutorialThis tutorial will show you how to create a Business Delegate class (and a JUnit Test) to talk to the DAO we created in Part I.In the context of AppFuse, this is called a Manager class. It's main responsibility is converting backend data (POJOs) into front-end data (Struts ActionForms). The main reason I even use Managers, rather than just calling the DAOs directly is testability. It's nice to be able to populate a Form manually (in the test) and call the DAO to persist it, and verify the database gets the proper results. The Business Delegate
Let's get started by creating a new ManagerTest and Manager in AppFuse's architecture. Table of Contents
Create a new ManagerTest to run JUnit tests on the Manager [#1]In Part I, we created a Person object and PersonDao - so let's continue developing this entity. First, let's create a JUnit test for the PersonManager. Create PersonManagerTest in the test/service/**/service directory. We'll want to test the same basic methods (get, save, remove) that our DAO has.
This class should extend BaseManagerTestCase
The code below is what we need for a basic JUnit test of our Managers. It created and destroys our PersonManager. The
|