Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
spring-framework
提交
028a6901
S
spring-framework
项目概览
dk131072
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
028a6901
编写于
2月 23, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
ed98393f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
139 addition
and
138 deletion
+139
-138
spring-core/src/main/java/org/springframework/core/OrderComparator.java
...c/main/java/org/springframework/core/OrderComparator.java
+2
-2
spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java
.../main/java/org/springframework/test/context/jdbc/Sql.java
+21
-21
spring-test/src/main/java/org/springframework/test/context/jdbc/SqlConfig.java
...java/org/springframework/test/context/jdbc/SqlConfig.java
+114
-113
spring-test/src/main/java/org/springframework/test/context/jdbc/SqlGroup.java
.../java/org/springframework/test/context/jdbc/SqlGroup.java
+2
-2
未找到文件。
spring-core/src/main/java/org/springframework/core/OrderComparator.java
浏览文件 @
028a6901
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -203,7 +203,7 @@ public class OrderComparator implements Comparator<Object> {
* Strategy interface to provide an order source for a given object.
* @since 4.1
*/
public
static
interface
OrderSourceProvider
{
public
interface
OrderSourceProvider
{
/**
* Return an order source for the specified object, i.e. an object that
...
...
spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java
浏览文件 @
028a6901
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -68,29 +68,10 @@ import static java.lang.annotation.RetentionPolicy.*;
@Documented
@Inherited
@Retention
(
RUNTIME
)
@Target
({
TYPE
,
METHOD
})
@Target
({
TYPE
,
METHOD
})
@Repeatable
(
SqlGroup
.
class
)
public
@interface
Sql
{
/**
* Enumeration of <em>phases</em> that dictate when SQL scripts are executed.
*/
static
enum
ExecutionPhase
{
/**
* The configured SQL scripts and statements will be executed
* <em>before</em> the corresponding test method.
*/
BEFORE_TEST_METHOD
,
/**
* The configured SQL scripts and statements will be executed
* <em>after</em> the corresponding test method.
*/
AFTER_TEST_METHOD
}
/**
* Alias for {@link #scripts}.
* <p>This attribute may <strong>not</strong> be used in conjunction with
...
...
@@ -173,4 +154,23 @@ public @interface Sql {
*/
SqlConfig
config
()
default
@SqlConfig
();
/**
* Enumeration of <em>phases</em> that dictate when SQL scripts are executed.
*/
enum
ExecutionPhase
{
/**
* The configured SQL scripts and statements will be executed
* <em>before</em> the corresponding test method.
*/
BEFORE_TEST_METHOD
,
/**
* The configured SQL scripts and statements will be executed
* <em>after</em> the corresponding test method.
*/
AFTER_TEST_METHOD
}
}
spring-test/src/main/java/org/springframework/test/context/jdbc/SqlConfig.java
浏览文件 @
028a6901
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -65,12 +65,122 @@ import static java.lang.annotation.RetentionPolicy.*;
@Target
(
TYPE
)
public
@interface
SqlConfig
{
/**
* The bean name of the {@link javax.sql.DataSource} against which the
* scripts should be executed.
* <p>The name is only required if there is more than one bean of type
* {@code DataSource} in the test's {@code ApplicationContext}. If there
* is only one such bean, it is not necessary to specify a bean name.
* <p>Defaults to an empty string, requiring that one of the following is
* true:
* <ol>
* <li>An explicit bean name is defined in a global declaration of
* {@code @SqlConfig}.
* <li>The data source can be retrieved from the transaction manager
* by using reflection to invoke a public method named
* {@code getDataSource()} on the transaction manager.
* <li>There is only one bean of type {@code DataSource} in the test's
* {@code ApplicationContext}.</li>
* <li>The {@code DataSource} to use is named {@code "dataSource"}.</li>
* </ol>
* @see org.springframework.test.context.transaction.TestContextTransactionUtils#retrieveDataSource
*/
String
dataSource
()
default
""
;
/**
* The bean name of the {@link org.springframework.transaction.PlatformTransactionManager
* PlatformTransactionManager} that should be used to drive transactions.
* <p>The name is only used if there is more than one bean of type
* {@code PlatformTransactionManager} in the test's {@code ApplicationContext}.
* If there is only one such bean, it is not necessary to specify a bean name.
* <p>Defaults to an empty string, requiring that one of the following is
* true:
* <ol>
* <li>An explicit bean name is defined in a global declaration of
* {@code @SqlConfig}.
* <li>There is only one bean of type {@code PlatformTransactionManager} in
* the test's {@code ApplicationContext}.</li>
* <li>{@link org.springframework.transaction.annotation.TransactionManagementConfigurer
* TransactionManagementConfigurer} has been implemented to specify which
* {@code PlatformTransactionManager} bean should be used for annotation-driven
* transaction management.</li>
* <li>The {@code PlatformTransactionManager} to use is named
* {@code "transactionManager"}.</li>
* </ol>
* @see org.springframework.test.context.transaction.TestContextTransactionUtils#retrieveTransactionManager
*/
String
transactionManager
()
default
""
;
/**
* The <em>mode</em> to use when determining whether SQL scripts should be
* executed within a transaction.
* <p>Defaults to {@link TransactionMode#DEFAULT DEFAULT}.
* <p>Can be set to {@link TransactionMode#ISOLATED} to ensure that the SQL
* scripts are executed in a new, isolated transaction that will be immediately
* committed.
* @see TransactionMode
*/
TransactionMode
transactionMode
()
default
TransactionMode
.
DEFAULT
;
/**
* The encoding for the supplied SQL scripts, if different from the platform
* encoding.
* <p>An empty string denotes that the platform encoding should be used.
*/
String
encoding
()
default
""
;
/**
* The character string used to separate individual statements within the
* SQL scripts.
* <p>Implicitly defaults to {@code ";"} if not specified and falls back to
* {@code "\n"} as a last resort.
* <p>May be set to
* {@link org.springframework.jdbc.datasource.init.ScriptUtils#EOF_STATEMENT_SEPARATOR}
* to signal that each script contains a single statement without a
* separator.
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_STATEMENT_SEPARATOR
* @see org.springframework.jdbc.datasource.init.ScriptUtils#EOF_STATEMENT_SEPARATOR
*/
String
separator
()
default
""
;
/**
* The prefix that identifies single-line comments within the SQL scripts.
* <p>Implicitly defaults to {@code "--"}.
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_COMMENT_PREFIX
*/
String
commentPrefix
()
default
""
;
/**
* The start delimiter that identifies block comments within the SQL scripts.
* <p>Implicitly defaults to {@code "/*"}.
* @see #blockCommentEndDelimiter
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_BLOCK_COMMENT_START_DELIMITER
*/
String
blockCommentStartDelimiter
()
default
""
;
/**
* The end delimiter that identifies block comments within the SQL scripts.
* <p>Implicitly defaults to <code>"*/"</code>.
* @see #blockCommentStartDelimiter
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_BLOCK_COMMENT_END_DELIMITER
*/
String
blockCommentEndDelimiter
()
default
""
;
/**
* The <em>mode</em> to use when an error is encountered while executing an
* SQL statement.
* <p>Defaults to {@link ErrorMode#DEFAULT DEFAULT}.
* @see ErrorMode
*/
ErrorMode
errorMode
()
default
ErrorMode
.
DEFAULT
;
/**
* Enumeration of <em>modes</em> that dictate whether SQL scripts should be
* executed within a transaction and what the transaction propagation behavior
* should be.
*/
static
enum
TransactionMode
{
enum
TransactionMode
{
/**
* Indicates that the <em>default</em> transaction mode should be used.
...
...
@@ -137,11 +247,12 @@ public @interface SqlConfig {
ISOLATED
}
/**
* Enumeration of <em>modes</em> that dictate how errors are handled while
* executing SQL statements.
*/
static
enum
ErrorMode
{
enum
ErrorMode
{
/**
* Indicates that the <em>default</em> error mode should be used.
...
...
@@ -188,114 +299,4 @@ public @interface SqlConfig {
IGNORE_FAILED_DROPS
}
/**
* The bean name of the {@link javax.sql.DataSource} against which the
* scripts should be executed.
* <p>The name is only required if there is more than one bean of type
* {@code DataSource} in the test's {@code ApplicationContext}. If there
* is only one such bean, it is not necessary to specify a bean name.
* <p>Defaults to an empty string, requiring that one of the following is
* true:
* <ol>
* <li>An explicit bean name is defined in a global declaration of
* {@code @SqlConfig}.
* <li>The data source can be retrieved from the transaction manager
* by using reflection to invoke a public method named
* {@code getDataSource()} on the transaction manager.
* <li>There is only one bean of type {@code DataSource} in the test's
* {@code ApplicationContext}.</li>
* <li>The {@code DataSource} to use is named {@code "dataSource"}.</li>
* </ol>
* @see org.springframework.test.context.transaction.TestContextTransactionUtils#retrieveDataSource
*/
String
dataSource
()
default
""
;
/**
* The bean name of the {@link org.springframework.transaction.PlatformTransactionManager
* PlatformTransactionManager} that should be used to drive transactions.
* <p>The name is only used if there is more than one bean of type
* {@code PlatformTransactionManager} in the test's {@code ApplicationContext}.
* If there is only one such bean, it is not necessary to specify a bean name.
* <p>Defaults to an empty string, requiring that one of the following is
* true:
* <ol>
* <li>An explicit bean name is defined in a global declaration of
* {@code @SqlConfig}.
* <li>There is only one bean of type {@code PlatformTransactionManager} in
* the test's {@code ApplicationContext}.</li>
* <li>{@link org.springframework.transaction.annotation.TransactionManagementConfigurer
* TransactionManagementConfigurer} has been implemented to specify which
* {@code PlatformTransactionManager} bean should be used for annotation-driven
* transaction management.</li>
* <li>The {@code PlatformTransactionManager} to use is named
* {@code "transactionManager"}.</li>
* </ol>
* @see org.springframework.test.context.transaction.TestContextTransactionUtils#retrieveTransactionManager
*/
String
transactionManager
()
default
""
;
/**
* The <em>mode</em> to use when determining whether SQL scripts should be
* executed within a transaction.
* <p>Defaults to {@link TransactionMode#DEFAULT DEFAULT}.
* <p>Can be set to {@link TransactionMode#ISOLATED} to ensure that the SQL
* scripts are executed in a new, isolated transaction that will be immediately
* committed.
* @see TransactionMode
*/
TransactionMode
transactionMode
()
default
TransactionMode
.
DEFAULT
;
/**
* The encoding for the supplied SQL scripts, if different from the platform
* encoding.
* <p>An empty string denotes that the platform encoding should be used.
*/
String
encoding
()
default
""
;
/**
* The character string used to separate individual statements within the
* SQL scripts.
* <p>Implicitly defaults to {@code ";"} if not specified and falls back to
* {@code "\n"} as a last resort.
* <p>May be set to
* {@link org.springframework.jdbc.datasource.init.ScriptUtils#EOF_STATEMENT_SEPARATOR}
* to signal that each script contains a single statement without a
* separator.
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_STATEMENT_SEPARATOR
* @see org.springframework.jdbc.datasource.init.ScriptUtils#EOF_STATEMENT_SEPARATOR
*/
String
separator
()
default
""
;
/**
* The prefix that identifies single-line comments within the SQL scripts.
* <p>Implicitly defaults to {@code "--"}.
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_COMMENT_PREFIX
*/
String
commentPrefix
()
default
""
;
/**
* The start delimiter that identifies block comments within the SQL scripts.
* <p>Implicitly defaults to {@code "/*"}.
* @see #blockCommentEndDelimiter
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_BLOCK_COMMENT_START_DELIMITER
*/
String
blockCommentStartDelimiter
()
default
""
;
/**
* The end delimiter that identifies block comments within the SQL scripts.
* <p>Implicitly defaults to <code>"*/"</code>.
* @see #blockCommentStartDelimiter
* @see org.springframework.jdbc.datasource.init.ScriptUtils#DEFAULT_BLOCK_COMMENT_END_DELIMITER
*/
String
blockCommentEndDelimiter
()
default
""
;
/**
* The <em>mode</em> to use when an error is encountered while executing an
* SQL statement.
* <p>Defaults to {@link ErrorMode#DEFAULT DEFAULT}.
* @see ErrorMode
*/
ErrorMode
errorMode
()
default
ErrorMode
.
DEFAULT
;
}
spring-test/src/main/java/org/springframework/test/context/jdbc/SqlGroup.java
浏览文件 @
028a6901
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -42,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.*;
@Documented
@Inherited
@Retention
(
RUNTIME
)
@Target
({
TYPE
,
METHOD
})
@Target
({
TYPE
,
METHOD
})
public
@interface
SqlGroup
{
Sql
[]
value
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录