标签:
package com.demandforce.dao; import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.Assert; import com.demandforce.model.TextMessageTemplate; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:context/hyperSqlContext.xml"}) public class TextMessageTemplateRetrievalTest { @Autowired private TextMessageTemplateDao textMessageTemplateDao; @Test public void testSelectByBusinessCategory() { Collection<TextMessageTemplate> tmts = textMessageTemplateDao.selectByBusinessCategory( 203, 0); Assert.notNull(tmts); Assert.isTrue(tmts.size() == 2); } }
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"> <jdbc:embedded-database id="dataSource" type="HSQL"> <jdbc:script location="classpath:sql/setup.sql" /> <jdbc:script location="classpath:sql/schema-create.sql" /> <jdbc:script location="classpath:sql/data-insert.sql" /> </jdbc:embedded-database> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <bean name="baseDao" abstract="true"> <property name="dataSource" ref="dataSource" /> </bean> <bean name="textMessageTemplateDao" class="com.demandforce.dao.TextMessageTemplateDaoImpl" parent="baseDao" /> </beans>
-- -- MySQL compatibility mode for Hyper SQL SET DATABASE SQL SYNTAX MYS TRUE;
DROP TABLE IF EXISTS TextMessageTemplate; CREATE TABLE TextMessageTemplate ( ID INT NOT NULL AUTO_INCREMENT, BusinessID INT NOT NULL, Type INT NOT NULL, Template varchar(1000), CreatedDate datetime DEFAULT NULL, LastModifiedDate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, CreatedUserId INT DEFAULT 0, LastModifiedUserId INT DEFAULT 0, Delivery INT DEFAULT 0, DeliveryWindow INT DEFAULT 1, BusinessCalendar INT NOT NULL DEFAULT 0, DeliveryTime datetime DEFAULT NULL, CardCount INT DEFAULT 0, Segment INT DEFAULT 0, FrontImage varchar(255) DEFAULT NULL, IncludeItems INT DEFAULT 1, IncludeReview INT DEFAULT 1, IncludeCoupon INT DEFAULT 1, services varchar(5000) DEFAULT NULL, Industry INT DEFAULT NULL, PRIMARY KEY (ID) );
INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry) VALUES ('0', '203', 'Template1', null); INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry) VALUES ('0', '204', 'Template2', null);
标签:
原文地址:http://blog.csdn.net/dandan8866/article/details/44783063