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