Issue Details (XML | Word | Printable)

Key: APF-1112
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Matt Raible
Reporter: Rob Harrington
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
AppFuse

static ResourceBundle in BaseManagerTestCase

Created: 26/Nov/08 03:00 PM   Updated: 12/Dec/08 12:25 AM   Resolved: 12/Dec/08 12:25 AM
Component/s: Build, Test, or Deploy Process
Affects Version/s: 2.0.2
Fix Version/s: 2.1.0-M1

Environment: Windows XP, AppFuse 2.0.2, full-source, struts2-modular


 Description  « Hide
Currently, as checked in to trunk, org.appfuse.service.BaseManagerTestCase
contains:

protected static ResourceBundle rb = null;

During tests, UserManagerTest populates a User from a properties file that
gets loaded into this static variable. Works fine out of the box.

I am adding my own manager(s) (in my own local project based on AppFuse) and would similarly like to be able to read
from a properties file to populate a different model object. For instance I
have 'Partner' model, a PartnerDao, and a PartnerManager, and now a
PartnerManagerTest, which subclasses BaseManagerTestCase.

Looks like what's happening is that since 'rb' is static, the last object to
get instantiated sets rb going forward. During tests, all the Test classes
are instantiated, then the tests are run. The result is that my
PartnerManagerTest tries to load UserManagerTest.properties into my Partner
object, instead of PartnerManagerTest.properties (which exists). This is
due to the fact that a UserManagerTest happened to get instantiated last,
prior to all tests actually being run. *ManagerTest share the
ResourceBundle.

Making 'rb' an instance variable solved my problem. Not sure if that has
other impacts though as I'm just getting into the details of AppFuse.


Matt Raible made changes - 26/Nov/08 03:03 PM
Field Original Value New Value
Fix Version/s 2.1 [ 10031 ]
3183 by  Matt Raible (1 file)
12/Dec/08 12:25 AM (20 months, 9 days ago)
Matt Raible made changes - 12/Dec/08 12:25 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]