Hi Guru,
I know I am bad, I didn't write unit testing and integration testing for my project. But know I am trying to be a good boy and I am having a hard time setting up the environment. So please help. =)
I have my application context under WEB-INF/applicationContext*.xml and in my applicationContext.xml, it has a reference to a properties file for DB user/pass, LDAP host, etc
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/spring-config/dev.properties</value>
</list>
</property>
</bean>
and I have another properties for log4j config (diff config for DEV/Staging/Production)
<!-- log4j setting -->
<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
<property name="targetMethod" value="initLogging" />
<property name="arguments">
<list>
<value>${webapp.root}/${log4j.properties.location}</value>
</list>
</property>
</bean>
Where webapp.root came from web.xml
And now I am trying to throw in a test class.
@Override
protected String[] getConfigLocations() {
return new String[]{
"file:trunk/code/web/WEB-INF/applicationContext.xml",
};
}
which references my xml correctly, but all the properties are screwed up.
my question is... is there a way to set up in the test class properly? if not, should I move these classes? and how can I set up log4j if there is a reference to webroot which only exist in a container?! What is the best practice of spring config location?
Please Advise
Thanks