类 TestContextAotGenerator
TestContextAotGenerator generates AOT artifacts for integration tests
that depend on support from the Infra TestContext Framework.- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Harry Yang
- 另请参阅:
-
ApplicationContextAotGenerator
-
字段概要
字段修饰符和类型字段说明private final cn.taketoday.context.aot.ApplicationContextAotGeneratorstatic final StringJVM system property used to set thefailOnErrorflag: "infra.test.aot.processing.failOnError".(专用程序包) final booleanprivate final cn.taketoday.aot.generate.GeneratedFilesprivate static final cn.taketoday.logging.Loggerprivate final MergedContextConfigurationRuntimeHintsprivate final cn.taketoday.aot.hint.RuntimeHintsprivate final AtomicIntegerprivate final cn.taketoday.beans.factory.aot.AotServices<TestRuntimeHintsRegistrar> -
构造器概要
构造器构造器说明TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles.TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles, cn.taketoday.aot.hint.RuntimeHints runtimeHints) TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles, cn.taketoday.aot.hint.RuntimeHints runtimeHints, boolean failOnError) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles,RuntimeHints, andfailOnErrorflag. -
方法概要
修饰符和类型方法说明private MergedContextConfigurationbuildMergedContextConfiguration(Class<?> testClass) classNames(List<Class<?>> classes) private voidcollectRuntimeHintsRegistrarClasses(Class<?> testClass, Set<Class<? extends cn.taketoday.aot.hint.RuntimeHintsRegistrar>> coreRuntimeHintsRegistrarClasses) Collect allRuntimeHintsRegistrarclasses declared via@ImportRuntimeHintson the supplied test class and add them to the suppliedSet.(专用程序包) cn.taketoday.aot.generate.DefaultGenerationContextcreateGenerationContext(Class<?> testClass) private voidprivate voidgenerateAotTestContextInitializerMappings(cn.taketoday.util.MultiValueMap<cn.taketoday.javapoet.ClassName, Class<?>> initializerClassMappings) private static booleanfinal cn.taketoday.aot.hint.RuntimeHintsGet theRuntimeHintsgathered during AOT processing.private cn.taketoday.context.support.GenericApplicationContextloadContextForAotProcessing(MergedContextConfiguration mergedConfig) Load theGenericApplicationContextfor the supplied merged context configuration for AOT processing.private String(专用程序包) cn.taketoday.javapoet.ClassNameprocessAheadOfTime(MergedContextConfiguration mergedConfig, cn.taketoday.aot.generate.GenerationContext generationContext) Process the specifiedMergedContextConfigurationahead-of-time using the specifiedGenerationContext.private cn.taketoday.util.MultiValueMap<cn.taketoday.javapoet.ClassName,Class<?>> processAheadOfTime(cn.taketoday.util.MultiValueMap<MergedContextConfiguration, Class<?>> mergedConfigMappings) voidprocessAheadOfTime(Stream<Class<?>> testClasses) Process each of the supplied Infra integration test classes and generate AOT artifacts.private voidregisterDeclaredConstructors(Class<?> type) private voidregisterPublicMethods(String className) private voidRegister hints for skipped exception types loaded via reflection inTestContextManager.private void
-
字段详细资料
-
FAIL_ON_ERROR_PROPERTY_NAME
JVM system property used to set thefailOnErrorflag: "infra.test.aot.processing.failOnError".The
failOnErrorflag controls whether errors encountered during AOT processing in the Infra TestContext Framework should result in an exception that fails the overall process.Defaults to
true.Supported values include
trueorfalse, ignoring case. For example, the default may be changed tofalseby supplying the following JVM system property via the command line.-Dinfra.test.aot.processing.failOnError=false
May alternatively be configured via the
TodayStrategiesmechanism.- 另请参阅:
-
logger
private static final cn.taketoday.logging.Logger logger -
isDisabledInAotMode
-
aotGenerator
private final cn.taketoday.context.aot.ApplicationContextAotGenerator aotGenerator -
testRuntimeHintsRegistrars
private final cn.taketoday.beans.factory.aot.AotServices<TestRuntimeHintsRegistrar> testRuntimeHintsRegistrars -
mergedConfigRuntimeHints
-
sequence
-
generatedFiles
private final cn.taketoday.aot.generate.GeneratedFiles generatedFiles -
runtimeHints
private final cn.taketoday.aot.hint.RuntimeHints runtimeHints -
failOnError
final boolean failOnError
-
-
构造器详细资料
-
TestContextAotGenerator
public TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles.- 参数:
generatedFiles- theGeneratedFilesto use- 另请参阅:
-
TestContextAotGenerator
public TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles, cn.taketoday.aot.hint.RuntimeHints runtimeHints) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFilesandRuntimeHints.This constructor looks up the value of the
failOnErrorflag via the "infra.test.aot.processing.failOnError" property, defaulting totrueif the property is not set.- 参数:
generatedFiles- theGeneratedFilesto useruntimeHints- theRuntimeHintsto use- 另请参阅:
-
TestContextAotGenerator
public TestContextAotGenerator(cn.taketoday.aot.generate.GeneratedFiles generatedFiles, cn.taketoday.aot.hint.RuntimeHints runtimeHints, boolean failOnError) Create a newTestContextAotGeneratorthat uses the suppliedGeneratedFiles,RuntimeHints, andfailOnErrorflag.- 参数:
generatedFiles- theGeneratedFilesto useruntimeHints- theRuntimeHintsto usefailOnError-trueif errors encountered during AOT processing should result in an exception that fails the overall process
-
-
方法详细资料
-
getRuntimeHints
public final cn.taketoday.aot.hint.RuntimeHints getRuntimeHints()Get theRuntimeHintsgathered during AOT processing. -
processAheadOfTime
Process each of the supplied Infra integration test classes and generate AOT artifacts.- 抛出:
TestContextAotException- if an error occurs during AOT processing
-
collectRuntimeHintsRegistrarClasses
private void collectRuntimeHintsRegistrarClasses(Class<?> testClass, Set<Class<? extends cn.taketoday.aot.hint.RuntimeHintsRegistrar>> coreRuntimeHintsRegistrarClasses) Collect allRuntimeHintsRegistrarclasses declared via@ImportRuntimeHintson the supplied test class and add them to the suppliedSet.- 参数:
testClass- the test class on which to search for@ImportRuntimeHintscoreRuntimeHintsRegistrarClasses- the set of registrar classes
-
resetAotFactories
private void resetAotFactories() -
processAheadOfTime
private cn.taketoday.util.MultiValueMap<cn.taketoday.javapoet.ClassName,Class<?>> processAheadOfTime(cn.taketoday.util.MultiValueMap<MergedContextConfiguration, Class<?>> mergedConfigMappings) -
processAheadOfTime
cn.taketoday.javapoet.ClassName processAheadOfTime(MergedContextConfiguration mergedConfig, cn.taketoday.aot.generate.GenerationContext generationContext) throws TestContextAotException Process the specifiedMergedContextConfigurationahead-of-time using the specifiedGenerationContext.Return the
ClassNameof theApplicationContextInitializerto use to restore an optimized state of the test application context for the givenMergedContextConfiguration.- 参数:
mergedConfig- theMergedContextConfigurationto processgenerationContext- the generation context to use- 返回:
- the
ClassNamefor the generatedApplicationContextInitializer - 抛出:
TestContextAotException- if an error occurs during AOT processing
-
loadContextForAotProcessing
private cn.taketoday.context.support.GenericApplicationContext loadContextForAotProcessing(MergedContextConfiguration mergedConfig) throws TestContextAotException Load theGenericApplicationContextfor the supplied merged context configuration for AOT processing.Only supports
SmartContextLoadersthat createGenericApplicationContexts.- 抛出:
TestContextAotException- if an error occurs while loading the application context or if one of the prerequisites is not met- 另请参阅:
-
buildMergedContextConfiguration
-
createGenerationContext
-
nextTestContextId
-
generateAotTestContextInitializerMappings
private void generateAotTestContextInitializerMappings(cn.taketoday.util.MultiValueMap<cn.taketoday.javapoet.ClassName, Class<?>> initializerClassMappings) -
generateAotTestAttributeMappings
private void generateAotTestAttributeMappings() -
registerPublicMethods
-
registerDeclaredConstructors
-
registerSkippedExceptionTypes
private void registerSkippedExceptionTypes()Register hints for skipped exception types loaded via reflection inTestContextManager. -
getFailOnErrorFlag
private static boolean getFailOnErrorFlag() -
classNames
-