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.
Description
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.