public abstract class TestContextTransactionUtils
extends java.lang.Object主にフレームワーク内での内部使用向け。
| 修飾子と型 | フィールドと説明 |
|---|---|
static java.lang.String | DEFAULT_DATA_SOURCE_NAMEDataSource のデフォルトの Bean 名: "dataSource" |
static java.lang.String | DEFAULT_TRANSACTION_MANAGER_NAMEPlatformTransactionManager のデフォルトの Bean 名: "transactionManager" |
| コンストラクターと説明 |
|---|
TestContextTransactionUtils() |
| 修飾子と型 | メソッドと説明 |
|---|---|
static TransactionAttribute | createDelegatingTransactionAttribute(TestContext testContext, TransactionAttribute targetAttribute) テストクラスの名前とテストメソッドを使用してトランザクションの名前を作成し、提供されたターゲット TransactionAttribute および TestContext の委譲 TransactionAttribute を作成します。 |
static javax.sql.DataSource | retrieveDataSource(TestContext testContext, java.lang.String name) 指定されたテストコンテキストに使用する DataSource を取得します。 |
static PlatformTransactionManager | retrieveTransactionManager(TestContext testContext, java.lang.String name) 指定されたテストコンテキストに使用するトランザクションマネージャーを取得します。 |
public static final java.lang.String DEFAULT_DATA_SOURCE_NAME
DataSource のデフォルトの Bean 名: "dataSource"public static final java.lang.String DEFAULT_TRANSACTION_MANAGER_NAME
PlatformTransactionManager のデフォルトの Bean 名: "transactionManager"@Nullable public static javax.sql.DataSource retrieveDataSource(TestContext testContext, @Nullable java.lang.String name)
DataSource を取得します。 次のアルゴリズムを使用して、提供されたテストコンテキストの ApplicationContext から DataSource を取得します。
name が空でない場合は、型と名前で DataSource を検索し、指定された DataSource が存在しない場合は BeansException をスローします。DataSource を検索してみます。DataSource を検索してみます。DataSource を検索してみます。testContext - DataSource を取得する必要があるテストコンテキスト。nullname - 取得する DataSource の名前 (null または空の可能性があります )DataSource、または見つからない場合は null BeansException - 明示的に指定された DataSource の取得中にエラーが発生した場合 @Nullable public static PlatformTransactionManager retrieveTransactionManager(TestContext testContext, @Nullable java.lang.String name)
次のアルゴリズムは、提供されたテストコンテキストの ApplicationContext からトランザクションマネージャーを取得するために使用されます。
name が空でない場合は、型と明示的な名前でトランザクションマネージャーを検索し、指定されたトランザクションマネージャーが存在しない場合は BeansException をスローします。TransactionManagementConfigurer を介してトランザクションマネージャーを検索してみます。testContext - トランザクションマネージャーを取得する必要があるテストコンテキスト。nullname - 取得するトランザクションマネージャーの名前 (null または空の可能性があります )null BeansException - 明示的に名前が付けられたトランザクションマネージャーの取得中にエラーが発生した場合 java.lang.IllegalStateException - ApplicationContext に複数の TransactionManagementConfigurer が存在する場合 public static TransactionAttribute createDelegatingTransactionAttribute(TestContext testContext, TransactionAttribute targetAttribute)
TransactionAttribute および TestContext の委譲 TransactionAttribute を作成します。testContext - 名前のベースとなる TestContext targetAttribute - 委譲する TransactionAttribute TransactionAttribute