Sunday, September 29, 2013

IndexConfigTest -> JUnit - Tutorial -> Dozens of Students Killed at Nigerian College -> JavaXerif -> 'This Week' Exclusive Interview: Iran's Foreign Minister Javad Zarif ABC News

package org.nanotek.tests.hibernate;

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.

<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <!-- Date dateUpdate; --> <hibernate-mapping package="org.nanotek.cms.domain.lucene"> <class name="IndexConfig" table="IndexConfig" > <id name="id" type="long" column="ID"> <generator class="sequence"> <param name="sequence">index_config_id_seq</param> </generator> </id> <property name="path" type="string" column="REFER_URL" length="12000"/> <property name=version type="long" column=VERSION> </property> <property name=openMode type="long" column=OPEN_MODE></property> <property name=indexType type="long" column=INDEX_TYPE></property> <property name=analyzerType type="long" column=ANALYZER_TYPE></property> <property name=dataUpdate type="date" column=DATE_UPDATE></property> <property name=dateInsert type="date" column=DATE_INSERT></property> </class> </hibernate-mapping>

/**
 *  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
 * <A,H,W>
 */

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;
}

}