Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7dcb3b58
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7dcb3b58
编写于
1月 23, 2009
作者:
S
Scott Andrews
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixing broken unit test related to SPR-5429
上级
300e4d72
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
39 addition
and
8 deletion
+39
-8
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/config/DbcpDataSourceFactory.java
...ework/samples/petclinic/config/DbcpDataSourceFactory.java
+18
-0
org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/dropTables.txt
...tclinic/src/main/resources/META-INF/hsqldb/dropTables.txt
+7
-0
org.springframework.samples.petclinic/src/main/resources/jdbc.properties
...work.samples.petclinic/src/main/resources/jdbc.properties
+2
-0
org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml
...amework/samples/petclinic/AbstractClinicTests-context.xml
+6
-4
org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml
...rk/samples/petclinic/jpa/applicationContext-jpaCommon.xml
+6
-4
未找到文件。
org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/config/DbcpDataSourceFactory.java
浏览文件 @
7dcb3b58
...
...
@@ -62,6 +62,8 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
private
Resource
dataLocation
;
private
Resource
dropLocation
;
/**
* The object created by this factory.
*/
...
...
@@ -115,6 +117,14 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
this
.
dataLocation
=
testDataLocation
;
}
/**
* Sets the location of the file containing the drop scripts for the database.
* @param testDataLocation the location of the data file
*/
public
void
setDropLocation
(
Resource
testDropLocation
)
{
this
.
dropLocation
=
testDropLocation
;
}
// implementing FactoryBean
// this method is called by Spring to expose the DataSource as a bean
...
...
@@ -163,6 +173,14 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
private
void
populateDataSource
()
{
DatabasePopulator
populator
=
new
DatabasePopulator
(
dataSource
);
if
(
dropLocation
!=
null
)
{
try
{
populator
.
populate
(
this
.
dropLocation
);
}
catch
(
Exception
e
)
{
// ignore
}
}
populator
.
populate
(
this
.
schemaLocation
);
populator
.
populate
(
this
.
dataLocation
);
}
...
...
org.springframework.samples.petclinic/src/main/resources/META-INF/hsqldb/dropTables.txt
0 → 100644
浏览文件 @
7dcb3b58
DROP TABLE visits;
DROP TABLE pets;
DROP TABLE owners;
DROP TABLE types;
DROP TABLE vet_specialties;
DROP TABLE specialties;
DROP TABLE vets;
org.springframework.samples.petclinic/src/main/resources/jdbc.properties
浏览文件 @
7dcb3b58
...
...
@@ -25,6 +25,7 @@ jdbc.password=
jdbc.populate
=
true
jdbc.schemaLocation
=
classpath:/META-INF/hsqldb/initDB.txt
jdbc.dataLocation
=
classpath:/META-INF/hsqldb/populateDB.txt
jdbc.dropLocation
=
classpath:/META-INF/hsqldb/dropTables.txt
# Property that determines which Hibernate dialect to use
# (only applied with "applicationContext-hibernate.xml")
...
...
@@ -49,6 +50,7 @@ jpa.database=HSQL
#jdbc.populate=false
#jdbc.schemaLocation=
#jdbc.dataLocation=
#jdbc.dropLocation=
# Property that determines which Hibernate dialect to use
# (only applied with "applicationContext-hibernate.xml")
...
...
org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml
浏览文件 @
7dcb3b58
...
...
@@ -13,8 +13,10 @@
<tx:annotation-driven/>
<bean
id=
"dataSource"
class=
"org.springframework.
jdbc.datasource.DriverManagerDataSource
"
<bean
id=
"dataSource"
class=
"org.springframework.
samples.petclinic.config.DbcpDataSourceFactory
"
p:driverClassName=
"${jdbc.driverClassName}"
p:url=
"${jdbc.url}"
p:username=
"${jdbc.username}"
p:password=
"${jdbc.password}"
/>
p:username=
"${jdbc.username}"
p:password=
"${jdbc.password}"
p:populate=
"${jdbc.populate}"
p:schemaLocation=
"${jdbc.schemaLocation}"
p:dataLocation=
"${jdbc.dataLocation}"
p:dropLocation=
"${jdbc.dropLocation}"
/>
</beans>
org.springframework.samples.petclinic/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml
浏览文件 @
7dcb3b58
...
...
@@ -11,9 +11,11 @@
<tx:annotation-driven
/>
<bean
id=
"dataSource"
class=
"org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName=
"${jdbc.driverClassName}"
p:url=
"${jdbc.url}"
p:username=
"${jdbc.username}"
p:password=
"${jdbc.password}"
/>
<bean
id=
"dataSource"
class=
"org.springframework.samples.petclinic.config.DbcpDataSourceFactory"
p:driverClassName=
"${jdbc.driverClassName}"
p:url=
"${jdbc.url}"
p:username=
"${jdbc.username}"
p:password=
"${jdbc.password}"
p:populate=
"${jdbc.populate}"
p:schemaLocation=
"${jdbc.schemaLocation}"
p:dataLocation=
"${jdbc.dataLocation}"
p:dropLocation=
"${jdbc.dropLocation}"
/>
<!-- Note: the specific "jpaAdapter" bean sits in adapter context file -->
<bean
id=
"entityManagerFactory"
class=
"org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录