Dao Test for Dropwizard
Attempting to write sample Dao tests for the Dropwizard app. I have implemented my own version in the AbstractDaoTest class which has nothing to do with the Dropwizard configuration. I wonder if I can use the Dropwizard hibernate config and get the factory session from the Dropbizard HibernateBundle.
public AbstractDaoTest() {
Configuration config=new Configuration();
config.setProperty("hibernate.connection.url","jdbc:mysql://127.0.0.1/testme");
config.setProperty("hibernate.connection.username","haha");
config.setProperty("hibernate.connection.password","haha");
config.setProperty("hibernate.connection.driver_class","com.mysql.jdbc.Driver");
config.setProperty("hibernate.current_session_context_class","thread");
config.setProperty("hibernate.show_sql", "true");
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
sessionFactory = config.buildSessionFactory(serviceRegistry);
}
Is there a way to capture the HibernateBundle
Dropwizard in the AbstarctDaoTest class?
+3
source to share
No one has answered this question yet
Check out similar questions: