import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.nanotek.tests.TestException;
import org.nanotek.util.HibernateUtil;
Dont remember when i wrote (this)... how important is to keep the projects "somewhere".
public SessionFactory getSessionFactory() |
{ |
if (sessionFactory !=null) |
return sessionFactory; |
else |
synchronized (this){ |
return buildSessionFactory(); |
} |
}
TODU:revier date arrangements.
|
* Coordinating the brain otherwise, remains walking on Xircles.
* Ae eles poe um "Indiano Genio" igual ao bichão que entrou. O daqui eh mais pratico.
* Over Giant Shoulders because, where was the old code with the HIBDAO is the
* Big Question. Time has come.
* We just know what we "use"
* "It is not us that choose our friends, it is our friends that choose us." The Jokers...
* Da primeira vez, apareceu um arabe com jeitao milionario muito sinistro
* perguntando informaçoes pra mim. ali na subida da goias com a ceara.
very odd, like the individual didn't seems to be lost, stopped muy to ask something
t hat he seems to know.
* The hunted world citzens on actuality, the christians, need to understand why.
* TODU: Check which types are available from Postgres -> Hibernate <-CustomTypes
* TODU: Change on near Future fora JUnit test.
* TODU: ReUp the MuzicBrains project mixing with The "actual project"
* A => What to test.
* H => How to test.
* W => When to test.
* @author josecanovamauger
*
*/
public class IndexConfigTest {
private SessionFactory sessionFactory;
private Session session;
public IndexConfigTest() { ctx = new ClassPathXmlApplicationContext(new String[] {"conf/indexConfigXmlFile.xml"}); } public static void main(String args[]) { IndexConfigTest ict = new IndexConfigTest(); ict.tearUpHibernate(); ict.testGeneralDAOOperations(IndexConfig.class); ict.tearDownHibernate(); }
@SuppressWarnings("unused")
public void tearUpHibernate(){
try {
HibernateUtil util = new HibernateUtil();
synchronized (this){ if (sessionFactory == null) sessionFactory = util.getSessionFactory(); }
}catch(Exception e)
{
//Nice article from Oracle.
throw new TestException(e);
}
}
public void testIndexConfigWithDao()
{
testGeneralDAOOperations(IndexConfig.class);
}
private void testGeneralDAOOperations(Class<IndexConfig> class1) {
testCreateOperation(class1);
testUpdateOperation(class1);
testDeleteOperation(class1);
}
private void testCreateOperation(Class<IndexConfig> class1) {
}
private void testUpdateOperation(Class<IndexConfig> class1) {
}
private void testDeleteOperation(Class<IndexConfig> class1) {
}
public void tearDownHibernate(){
}
public Session getSession() {
if (sessionFactory !=null)
{
"here we execute the tearUp of the surrougate session"
"se a biqueira ta aberta nois pega uma sessao"
session = sessionFactory.getCurrentSession();
}
return session;
}
}