@@ -0,0 +1,3635 @@
+package com.alcedomoreno.sirme.core;%0A%0Aimport java.io.IOException;%0Aimport java.util.Properties;%0A%0Aimport org.apache.commons.dbcp.BasicDataSource;%0Aimport org.hibernate.SessionFactory;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.ComponentScan;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.core.io.DefaultResourceLoader;%0Aimport org.springframework.core.io.Resource;%0Aimport org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;%0Aimport org.springframework.jdbc.datasource.init.DataSourceInitializer;%0Aimport org.springframework.jdbc.datasource.init.DatabasePopulator;%0Aimport org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;%0Aimport org.springframework.orm.hibernate3.HibernateTransactionManager;%0Aimport org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean;%0Aimport org.springframework.orm.hibernate4.LocalSessionFactoryBean;%0Aimport org.springframework.transaction.annotation.EnableTransactionManagement;%0A%0A@Configuration%0A@EnableTransactionManagement%0A@ComponentScan(%7B %22com.alcedomoreno.sirme.core.dao%22 %7D)%0Apublic class AppTestConfig %7B%0A%09%0A%09@Bean%0A    public BasicDataSource dataSource() %7B%0A        final BasicDataSource dataSource = new BasicDataSource();%0A        dataSource.setDriverClassName(%22org.hsqldb.jdbcDriver%22);%0A        dataSource.setUrl(%22jdbc:hsqldb:mem:testdb%22);%0A        dataSource.setUsername(%22sa%22);%0A        dataSource.setPassword(%22%22);%0A%0A        return dataSource;%0A    %7D%0A%0A    @Bean%0A    public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) throws IOException %7B%0A        HibernateTransactionManager txManager = new HibernateTransactionManager();%0A        txManager.setSessionFactory(sessionFactory().getObject());%0A%0A        return txManager;%0A    %7D%0A%0A    @Bean%0A    public PersistenceExceptionTranslationPostProcessor exceptionTranslation() %7B%0A        return new PersistenceExceptionTranslationPostProcessor();%0A    %7D%0A%0A    @Bean%0A    public DatabasePopulator databasePopulator() %7B%0A    %09%0A    %09ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();%0A    %09DefaultResourceLoader resource = new DefaultResourceLoader(); %0A    %09databasePopulator.setScripts(new Resource%5B%5D%7Bresource.getResource(%22classpath:test.sql%22)%7D);%0A    %09%0A    %09return databasePopulator;%0A    %7D%0A%0A    @Bean%0A    public DataSourceInitializer dataSourceInitializer() %7B%0A    %09%0A    %09DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();%0A    %09dataSourceInitializer.setDataSource(dataSource());%0A    %09dataSourceInitializer.setDatabasePopulator(databasePopulator());%0A    %09return dataSourceInitializer;%0A    %7D%0A%0A    @SuppressWarnings(%22serial%22)%0A%09final Properties hibernateProperties() %7B%0A        return new Properties() %7B%0A            %7B%0A                setProperty(%22hibernate.dialect%22, %22org.hibernate.dialect.HSQLDialect%22);%0A                setProperty(%22hibernate.show_sql%22, %22true%22);%0A                setProperty(%22hibernate.hbm2ddl.auto%22, %22create%22);%0A                setProperty(%22hibernate.connection.pool_size%22, %224%22);%0A                %0A            %7D%0A        %7D;%0A    %7D%0A    %0A    @Bean%0A    public AnnotationSessionFactoryBean sessionFactory()  %7B%0A    %09AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();%0A        sessionFactory.setDataSource(dataSource());%0A        sessionFactory.setPackagesToScan(new String%5B%5D %7B %22com.alcedomoreno.sirme.core.data%22,%0A%09%09%09%09 %22com.alcedomoreno.sirme.core.dao%22,%0A%09%09%09%09 %22com.alcedomoreno.sirme.core.util%22 %7D);%0A        sessionFactory.setHibernateProperties(hibernateProperties());%0A%0A        return sessionFactory;%0A    %7D%0A%7D%0A

Create AppTestConfig.java