Announcement Announcement Module
Collapse
No announcement yet.
delete product ,failed! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • delete product ,failed!

    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <!-- the test application context definition for the jdbc based tests -->

    <bean id="productDao" class="springapp.repository.JdbcProductDao">
    <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
    </bean>
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath:jdbc.properties</value>
    </list>
    </property>
    </bean>

    <bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource" ref="dataSource" />
    </bean>

    </beans>
    public void testFindProductByErrorId() {

    productDao = (ProductDao) applicationContext.getBean("productDao");

    try {
    productDao.findProductById(-1);
    }
    catch (DataAccessException ex) {
    fail(ex.getMessage());
    }

    }
    /*
    * 测试delete记录*
    */
    public void testDeleteProductById() {

    productDao = (ProductDao) applicationContext.getBean("productDao");

    assertEquals(jdbcTemplate.update("delete from products where id = 1 ")
    , productDao.deleteProductById(1));
    }


    testfind**byId passed,but when I run DeleteProductById, find**byid the same id not found,in fact the find test passed![email protected]
Working...
X