Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Dropwizard的Dao测试_Java_Dropwizard - Fatal编程技术网

Java Dropwizard的Dao测试

Java Dropwizard的Dao测试,java,dropwizard,Java,Dropwizard,正在尝试为Dropwizard应用程序编写Dao测试用例。 我已经为AbstractDaoTest类实现了自己的版本,该类与Dropwizard的配置无关。我想知道是否可以使用Dropwizard的hibernate配置,并从Dropwizard的HibernateBundle获取会话工厂 public AbstractDaoTest() { Configuration config=new Configuration(); config.setP

正在尝试为Dropwizard应用程序编写Dao测试用例。 我已经为AbstractDaoTest类实现了自己的版本,该类与Dropwizard的配置无关。我想知道是否可以使用Dropwizard的hibernate配置,并从Dropwizard的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);
    }
有没有办法在我的AbstractDaoTest类中获得Dropwizard的
HibernateBundle