Search in sources :

Example 1 with EvaluationContextProvider

use of org.springframework.data.spel.EvaluationContextProvider in project spring-data-mongodb by spring-projects.

the class AbstractReactiveMongoConfigurationUnitTests method lifecycleCallbacksAreInvokedInAppropriateOrder.

// DATAMONGO-1444
@Test
public void lifecycleCallbacksAreInvokedInAppropriateOrder() {
    AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
    MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
    MongoPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(Entity.class);
    EvaluationContextProvider provider = (EvaluationContextProvider) ReflectionTestUtils.getField(entity, "evaluationContextProvider");
    assertThat(provider).isInstanceOf(ExtensionAwareEvaluationContextProvider.class);
    context.close();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EvaluationContextProvider(org.springframework.data.spel.EvaluationContextProvider) ExtensionAwareEvaluationContextProvider(org.springframework.data.spel.ExtensionAwareEvaluationContextProvider) AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) Test(org.junit.jupiter.api.Test)

Example 2 with EvaluationContextProvider

use of org.springframework.data.spel.EvaluationContextProvider in project spring-data-mongodb by spring-projects.

the class AbstractMongoConfigurationUnitTests method lifecycleCallbacksAreInvokedInAppropriateOrder.

// DATAMONGO-717
@Test
public void lifecycleCallbacksAreInvokedInAppropriateOrder() {
    AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
    MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
    MongoPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(Entity.class);
    EvaluationContextProvider provider = (EvaluationContextProvider) ReflectionTestUtils.getField(entity, "evaluationContextProvider");
    assertThat(provider).isInstanceOf(ExtensionAwareEvaluationContextProvider.class);
    context.close();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EvaluationContextProvider(org.springframework.data.spel.EvaluationContextProvider) ExtensionAwareEvaluationContextProvider(org.springframework.data.spel.ExtensionAwareEvaluationContextProvider) AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 AbstractApplicationContext (org.springframework.context.support.AbstractApplicationContext)2 MongoMappingContext (org.springframework.data.mongodb.core.mapping.MongoMappingContext)2 EvaluationContextProvider (org.springframework.data.spel.EvaluationContextProvider)2 ExtensionAwareEvaluationContextProvider (org.springframework.data.spel.ExtensionAwareEvaluationContextProvider)2