[Mpango-core] mpango - spring tests
Status: Pre-Alpha
Brought to you by:
edvera
From: <ugl...@gm...> - 2011-05-31 12:24:59
|
Hello. I've tried to set up project to permform test with spring beans(facades, services, dao), but unfortunately I am stuck. My steps: I've created basic testing class net.sourceforge.mpango.BasicSpringTest: @TransactionConfiguration @Transactional @ContextConfiguration("classpath*:spring-core-test-beans.xml") @RunWith(SpringJUnit4ClassRunner.class) public class BaseSpringTest extends AbstractTransactionalJUnit4SpringContextTests { @Test public void testSpring() { } } Next, I've created spring configuration file(spring-core-test-beans.xml), by altering spring-beans.xml from main resources,and put it in src/test/resources Content: <bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>org.hsqldb.jdbcDriver</value> </property> <property name="url"> <value>jdbc:hsqldb:mem:sample</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value></value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="datasource" /> <property name="configLocation" value="classpath:hibernate.cfg.xml" /> <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> <prop key="hibernate.hbm2ddl.auto">create-drop</prop> </props> </property> </bean> <bean name="userDAO" class="net.sourceforge.mpango.directory.UserDAOHibernate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean name="authService" class="net.sourceforge.mpango.service.AuthenticationService"> <property name="userDAO" ref="userDAO" /> </bean> <bean name="authFacade" class="net.sourceforge.mpango.facade.AuthenticationFacade"> <property name="authService" ref="authService" /> </bean> The hibernate configuration file i copied unchanged. During performing the test from junit plugin, or from maven I get ClassNotFoundException: Caused by: java.lang.ClassNotFoundException: net.sourceforge.mpango.directory.UserDAOHibernate at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at org.springframework.util.ClassUtils.forName(ClassUtils.java:257) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408) at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1256) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1227) ... 34 more Any ideas what I did wrong? Regards Andrzej |