1 17 package org.alfresco.util; 18 19 import org.hibernate.Session; 20 import org.hibernate.SessionFactory; 21 import org.springframework.orm.hibernate3.SessionFactoryUtils; 22 import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; 23 24 34 public abstract class BaseSpringTest extends AbstractTransactionalDataSourceSpringContextTests 35 { 36 37 protected SessionFactory sessionFactory; 38 39 42 public BaseSpringTest() 43 { 44 } 45 46 51 public void setSessionFactory(SessionFactory sessionFactory) 52 { 53 this.sessionFactory = sessionFactory; 54 } 55 56 60 protected Session getSession() 61 { 62 return SessionFactoryUtils.getSession(sessionFactory, true); 63 } 64 65 70 protected void flushAndClear() 71 { 72 getSession().flush(); 73 getSession().clear(); 74 } 75 76 81 protected String [] getConfigLocations() 82 { 83 if (logger.isDebugEnabled()) 84 { 85 logger.debug("Getting config locations"); 86 } 87 return ApplicationContextHelper.CONFIG_LOCATIONS; 88 } 89 } 90 | Popular Tags |