Let the subclasses redefine the configuration file name overriding getHibernateConfigurationFileName() method.

This commit is contained in:
Hernan 2010-11-15 00:17:59 -02:00 committed by adamw
parent 188ec620e8
commit 80ef651e4a
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,7 @@ public abstract class AbstractSessionTest {
@Parameters("auditStrategy") @Parameters("auditStrategy")
public void init(@Optional String auditStrategy) throws URISyntaxException { public void init(@Optional String auditStrategy) throws URISyntaxException {
config = new AnnotationConfiguration(); config = new AnnotationConfiguration();
URL url = Thread.currentThread().getContextClassLoader().getResource("hibernate.test.session-cfg.xml"); URL url = Thread.currentThread().getContextClassLoader().getResource(getHibernateConfigurationFileName());
config.configure(new File(url.toURI())); config.configure(new File(url.toURI()));
if (auditStrategy != null && !"".equals(auditStrategy)) { if (auditStrategy != null && !"".equals(auditStrategy)) {
@ -50,6 +50,9 @@ public abstract class AbstractSessionTest {
protected abstract void initMappings() throws MappingException, URISyntaxException ; protected abstract void initMappings() throws MappingException, URISyntaxException ;
protected String getHibernateConfigurationFileName(){
return "hibernate.test.session-cfg.xml";
}
private SessionFactory getSessionFactory(){ private SessionFactory getSessionFactory(){