Unit Test by Spring+HSQLDB

@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration("classpath:/META-INF/spring/applicationContext-unittest.xml")

@Transactional

public class PaymentOrderDaoTest {

@Autowired

@Qualifier("paymentOrderDao")

PaymentOrderDao paymentOrderDao;

 

@Test

public void testSave() {

fail("Not yet implemented");

}

 

@Test

public void testUpdate() {

fail("Not yet implemented");

}

 

@Test

public void testGet() {

fail("Not yet implemented");

}

 

@Test

public void testDelete() {

fail("Not yet implemented");

}

 

}

 

<context:annotation-config />

 

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

<property name="driverClassName" value="org.hsqldb.JDBCDriver" />

<property name="url" value="jdbc:hsqldb:mem:orders" />

<property name="username" value="sa" />

<property name="password" value="" />

<!-- 

<property name="initialSize" value="5" />

<property name="maxActive" value="10" />

<property name="poolPreparedStatements" value="true" />

<property name="maxOpenPreparedStatements" value="10" />

-->

</bean>

 

 

<!-- Hibernate Session Factory -->

<bean id="sessionFactory"

class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<property name="dataSource" ref="dataSource" />

<property name="annotatedClasses">

<list>

<value>com.gl.pojo.PaymentOrder</value>

</list>

</property>

<property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>

<prop key="hibernate.hbm2ddl.auto">update</prop>

<prop key="hibernate.show_sql">true</prop>

<prop key="hibernate.connection.autocommit">true</prop>

</props>

</property>

</bean>

 

 

<bean id="transactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<property name="sessionFactory" ref="sessionFactory" />

</bean>

 

<bean id="paymentOrderDao" class="com.gl.dao.PaymentOrderDao">

<property name="sessionFactory" ref="sessionFactory"/>

</bean>

 

 

你可能感兴趣的:(unit test)